[Buildroot] [PATCH 1/1] board/raspberrypi: add Raspberry Pi Zero 2 W

Peter Seiderer ps.report at gmx.net
Thu Oct 28 21:23:29 UTC 2021


Hello Julien,

thanks for (the fast) contribution of the new rpi variant, comments below...

On Thu, 28 Oct 2021 08:26:17 +0200, Julien Grossholtz <julien.grossholtz at openest.io> wrote:

> The Raspberry-Pi Zero 2 W is an affordable single board computer. It is
> a more powerful drop-in replacement for the Raspberry Pi Zero W.
>
> The board incorporates an Raspberry-Pi RP3A0 system-in-package (SiP) with
> a Broadcom BCM2710A1 and 512MB LPDDR2 SDRAM. The CPU is a quad-core 1Ghz
> 64-bit Arm Cortex-A53. As for other Raspberry-Pis it also provides
> 2.4GHz 802.11 b/g/n Wifi, Bluetooth 4.2 and BLE.
>
> The BCM2710 cpu is similar to the Raspberry-Pi 3 and the form factor is
> the same as the previous Zero W. Therefore, this board support uses the
> Pi 3's Linux configuration and the original Zero W device-tree.
>
> Signed-off-by: Julien Grossholtz <julien.grossholtz at openest.io>
> ---
>  board/raspberrypi/config_zero2.txt            | 29 ++++++++++++++
>  .../raspberrypi/genimage-raspberrypizero2.cfg | 31 +++++++++++++++
>  board/raspberrypi/readme.txt                  |  5 +++
>  board/raspberrypizero2                        |  1 +
>  configs/raspberrypizero2_defconfig            | 38 +++++++++++++++++++
>  5 files changed, 104 insertions(+)
>  create mode 100644 board/raspberrypi/config_zero2.txt
>  create mode 100644 board/raspberrypi/genimage-raspberrypizero2.cfg
>  create mode 120000 board/raspberrypizero2
>  create mode 100644 configs/raspberrypizero2_defconfig
>
> diff --git a/board/raspberrypi/config_zero2.txt b/board/raspberrypi/config_zero2.txt
> new file mode 100644
> index 0000000000..9e6b7f5ccf
> --- /dev/null
> +++ b/board/raspberrypi/config_zero2.txt
> @@ -0,0 +1,29 @@
> +# Please note that this is only a sample, we recommend you to change it to fit
> +# your needs.
> +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE.
> +# See http://buildroot.org/manual.html#rootfs-custom
> +# and http://elinux.org/RPiconfig for a description of config.txt syntax
> +
> +start_file=start.elf
> +fixup_file=fixup.dat
> +
> +kernel=zImage
> +
> +# To use an external initramfs file
> +#initramfs rootfs.cpio.gz
> +
> +# Disable overscan assuming the display supports displaying the full resolution
> +# If the text shown on the screen disappears off the edge, comment this out
> +disable_overscan=1
> +
> +# How much memory in MB to assign to the GPU on Pi models having
> +# 256, 512 or 1024 MB total memory
> +gpu_mem_256=100
> +gpu_mem_512=100
> +gpu_mem_1024=100
> +
> +# fixes rpi (3B, 3B+, 3A+, 4B ,zero W and zero 2) ttyAMA0 serial console
> +dtoverlay=miniuart-bt
> +
> +# enable autoprobing of Bluetooth driver without need of hciattach/btattach
> +dtoverlay=krnbt=on
> diff --git a/board/raspberrypi/genimage-raspberrypizero2.cfg b/board/raspberrypi/genimage-raspberrypizero2.cfg
> new file mode 100644
> index 0000000000..f76256ef8a
> --- /dev/null
> +++ b/board/raspberrypi/genimage-raspberrypizero2.cfg
> @@ -0,0 +1,31 @@
> +image boot.vfat {
> +  vfat {
> +    files = {
> +      "bcm2708-rpi-zero-w.dtb",
> +      "rpi-firmware/bootcode.bin",
> +      "rpi-firmware/cmdline.txt",
> +      "rpi-firmware/config.txt",
> +      "rpi-firmware/fixup.dat",
> +      "rpi-firmware/start.elf",
> +      "rpi-firmware/overlays",
> +      "zImage"
> +    }
> +  }
> +  size = 32M
> +}
> +
> +image sdcard.img {
> +  hdimage {
> +  }
> +
> +  partition boot {
> +    partition-type = 0xC
> +    bootable = "true"
> +    image = "boot.vfat"
> +  }
> +
> +  partition rootfs {
> +    partition-type = 0x83
> +    image = "rootfs.ext4"
> +  }
> +}
> diff --git a/board/raspberrypi/readme.txt b/board/raspberrypi/readme.txt
> index 98c44d80a1..7d134d17fb 100644
> --- a/board/raspberrypi/readme.txt
> +++ b/board/raspberrypi/readme.txt
> @@ -28,6 +28,10 @@ For model Zero (model A+ in smaller form factor):
>
>    $ make raspberrypi0_defconfig
>
> +For model Zero 2 (model B3 in smaller form factor):
> +
> +  $ make raspberrypizero2_defconfig
> +
>  For model 2 B:
>
>    $ make raspberrypi2_defconfig
> @@ -76,6 +80,7 @@ After building, you should obtain this tree:
>      output/images/
>      +-- bcm2708-rpi-b.dtb           [1]
>      +-- bcm2708-rpi-b-plus.dtb      [1]
> +    +-- bcm2708-rpi-zero-w.dtb      [1]
>      +-- bcm2709-rpi-2-b.dtb         [1]
>      +-- bcm2710-rpi-3-b.dtb         [1]
>      +-- bcm2710-rpi-3-b-plus.dtb    [1]
> diff --git a/board/raspberrypizero2 b/board/raspberrypizero2
> new file mode 120000
> index 0000000000..fcdafc81ed
> --- /dev/null
> +++ b/board/raspberrypizero2
> @@ -0,0 +1 @@
> +raspberrypi
> \ No newline at end of file
> diff --git a/configs/raspberrypizero2_defconfig b/configs/raspberrypizero2_defconfig
> new file mode 100644
> index 0000000000..81d92ee6b7
> --- /dev/null
> +++ b/configs/raspberrypizero2_defconfig
> @@ -0,0 +1,38 @@
> +BR2_arm=y
> +BR2_cortex_a53=y
> +BR2_ARM_FPU_NEON_VFPV4=y
> +
> +# Linux headers same as kernel, 5.10 series
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
> +
> +BR2_TOOLCHAIN_BUILDROOT_CXX=y
> +
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
> +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,24c8b0546a820222a1ebcfe606dfacb0e228c466)/linux-24c8b0546a820222a1ebcfe606dfacb0e228c466.tar.gz"
> +BR2_LINUX_KERNEL_DEFCONFIG="bcm2709"
> +
> +# The zero2 uses the same processor as the Raspberry Pi 3 with the same
> +# form-factor as the zero-w

For the dts not the form-factor but the board layout/components
are important...

> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-zero-w"

With commit [1] a new bcm2710-rpi-zero-2.dtb is available...

Seems time for an rpi linux-kernel/rpi-firmware update to support
the new hardware...

Otherwise the patch looks good...

Sorry no rpi-zero-2-w hardware for testing ;-)

Regards,
Peter

[1] https://github.com/raspberrypi/linux/commit/84dc624be6ae704fdb3c413b7d86315cf49fbb0b

> +
> +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +
> +BR2_PACKAGE_RPI_FIRMWARE=y
> +BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y
> +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y
> +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypizero2/config_zero2.txt"
> +
> +# MicroSD images generation tools
> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_PACKAGE_HOST_MTOOLS=y
> +
> +# Filesystem / image
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_4=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
> +# BR2_TARGET_ROOTFS_TAR is not set
> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypizero2/post-build.sh"
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypizero2/post-image.sh"



More information about the buildroot mailing list