From 877a1b1f037a3c6335f488677645f424cf059206 Mon Sep 17 00:00:00 2001 From: Florin Sarbu Date: Wed, 25 Oct 2023 09:04:57 +0200 Subject: [PATCH 1/8] Add Raspberry Pi 5 Signed-off-by: Florin Sarbu --- .github/workflows/yocto-builds.yml | 1 + conf/machine/include/rpi-base.inc | 1 + conf/machine/raspberrypi-armv8.conf | 1 + conf/machine/raspberrypi5.conf | 23 ++++++++++++++++++++++ recipes-kernel/linux/linux-raspberrypi.inc | 1 + 5 files changed, 27 insertions(+) create mode 100644 conf/machine/raspberrypi5.conf diff --git a/.github/workflows/yocto-builds.yml b/.github/workflows/yocto-builds.yml index 93f9f46d6..408d25ea2 100644 --- a/.github/workflows/yocto-builds.yml +++ b/.github/workflows/yocto-builds.yml @@ -25,6 +25,7 @@ jobs: - raspberrypi3 - raspberrypi4-64 - raspberrypi4 + - raspberrypi5 - raspberrypi-cm3 - raspberrypi-cm - raspberrypi-armv7 diff --git a/conf/machine/include/rpi-base.inc b/conf/machine/include/rpi-base.inc index 472f18efa..98639e709 100644 --- a/conf/machine/include/rpi-base.inc +++ b/conf/machine/include/rpi-base.inc @@ -77,6 +77,7 @@ RPI_KERNEL_DEVICETREE ?= " \ bcm2710-rpi-cm3.dtb \ bcm2711-rpi-cm4.dtb \ bcm2711-rpi-cm4s.dtb \ + bcm2712-rpi-5-b.dtb \ " KERNEL_DEVICETREE ??= " \ diff --git a/conf/machine/raspberrypi-armv8.conf b/conf/machine/raspberrypi-armv8.conf index 8d412ba18..0128bdc71 100644 --- a/conf/machine/raspberrypi-armv8.conf +++ b/conf/machine/raspberrypi-armv8.conf @@ -32,6 +32,7 @@ RPI_KERNEL_DEVICETREE = " \ broadcom/bcm2711-rpi-400.dtb \ broadcom/bcm2711-rpi-cm4.dtb \ broadcom/bcm2711-rpi-cm4s.dtb \ + broadcom/bcm2712-rpi-5-b.dtb \ " SDIMG_KERNELIMAGE ?= "kernel8.img" diff --git a/conf/machine/raspberrypi5.conf b/conf/machine/raspberrypi5.conf new file mode 100644 index 000000000..9ea494129 --- /dev/null +++ b/conf/machine/raspberrypi5.conf @@ -0,0 +1,23 @@ +#@TYPE: Machine +#@NAME: RaspberryPi 5 Development Board (64bit) +#@DESCRIPTION: Machine configuration for the RaspberryPi 5 in 64 bits mode + +require conf/machine/include/arm/armv8-2a/tune-cortexa76.inc +include conf/machine/include/rpi-base.inc + +MACHINE_FEATURES += "pci" +MACHINE_EXTRA_RRECOMMENDS += "\ + linux-firmware-rpidistro-bcm43455 \ + bluez-firmware-rpidistro-bcm4345c0-hcd \ + linux-firmware-rpidistro-bcm43456 \ + bluez-firmware-rpidistro-bcm4345c5-hcd \ +" + +RPI_KERNEL_DEVICETREE = " \ + broadcom/bcm2712-rpi-5-b.dtb \ +" + +SDIMG_KERNELIMAGE ?= "kernel8.img" +SERIAL_CONSOLES ?= "115200;ttyS0" + +VC4DTBO ?= "vc4-kms-v3d" diff --git a/recipes-kernel/linux/linux-raspberrypi.inc b/recipes-kernel/linux/linux-raspberrypi.inc index b77d1c4cf..c4b690047 100644 --- a/recipes-kernel/linux/linux-raspberrypi.inc +++ b/recipes-kernel/linux/linux-raspberrypi.inc @@ -33,6 +33,7 @@ KBUILD_DEFCONFIG:raspberrypi4 ?= "bcm2711_defconfig" KBUILD_DEFCONFIG:raspberrypi4-64 ?= "bcm2711_defconfig" KBUILD_DEFCONFIG:raspberrypi-armv7 ?= "bcm2711_defconfig" KBUILD_DEFCONFIG:raspberrypi-armv8 ?= "bcm2711_defconfig" +KBUILD_DEFCONFIG:raspberrypi5 ?= "bcm2711_defconfig" LINUX_VERSION_EXTENSION ?= "" From 954bd8808cfdcaa5e9ce34cafeae4ccb8b861e7a Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Thu, 16 Nov 2023 19:22:14 +0200 Subject: [PATCH 2/8] rpi-base.inc: Add vc4-kms-v3d-pi5.dtbo Add overlays/vc4-kms-v3d-pi5.dtbo to use vc4-kms-v3d driver on Raspberry Pi 5. This work was sponsored by GOVCERT.LU. Signed-off-by: Leon Anavi --- conf/machine/include/rpi-base.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/machine/include/rpi-base.inc b/conf/machine/include/rpi-base.inc index 98639e709..c87ab97d8 100644 --- a/conf/machine/include/rpi-base.inc +++ b/conf/machine/include/rpi-base.inc @@ -54,6 +54,7 @@ RPI_KERNEL_DEVICETREE_OVERLAYS ?= " \ overlays/vc4-fkms-v3d-pi4.dtbo \ overlays/vc4-kms-v3d.dtbo \ overlays/vc4-kms-v3d-pi4.dtbo \ + overlays/vc4-kms-v3d-pi5.dtbo \ overlays/vc4-kms-dsi-7inch.dtbo \ overlays/w1-gpio.dtbo \ overlays/w1-gpio-pullup.dtbo \ From dec31c1dad4f2f396280f0643624efb6dd8c10a3 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Thu, 16 Nov 2023 19:24:04 +0200 Subject: [PATCH 3/8] u-boot_%.bbappend: Skip for Raspberry Pi 5 Temporary avoid Raspberry Pi 5 machines because U-Boot has not been ported to it yet. This work was sponsored by GOVCERT.LU. Signed-off-by: Leon Anavi --- recipes-bsp/u-boot/u-boot_%.bbappend | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes-bsp/u-boot/u-boot_%.bbappend b/recipes-bsp/u-boot/u-boot_%.bbappend index e50acf5fb..78b3e484a 100644 --- a/recipes-bsp/u-boot/u-boot_%.bbappend +++ b/recipes-bsp/u-boot/u-boot_%.bbappend @@ -12,3 +12,6 @@ do_install:append:rpi () { install -d ${D}${sysconfdir} install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config } + +# Temporary avoid Raspberry Pi 5 because U-Boot has not been ported yet +COMPATIBLE_MACHINE:raspberrypi5 = "(-)" From cae3339749c6c7646f5a77dbb8bbb76826453502 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Thu, 16 Nov 2023 19:25:21 +0200 Subject: [PATCH 4/8] rpi-config: Reduce config.txt size Remove some comments to reduce config.txt file size to avoid file corruption and make sure Raspberry Pi 5 will boot successfully. The issue with large config.txt has been reported to related projects: https://github.com/raspberrypi/firmware/issues/1848 https://github.com/Evilpaul/RPi-config/issues/9 This work was sponsored by GOVCERT.LU. Signed-off-by: Leon Anavi --- recipes-bsp/bootfiles/rpi-config_git.bb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes-bsp/bootfiles/rpi-config_git.bb b/recipes-bsp/bootfiles/rpi-config_git.bb index ee0f407be..737815977 100644 --- a/recipes-bsp/bootfiles/rpi-config_git.bb +++ b/recipes-bsp/bootfiles/rpi-config_git.bb @@ -317,6 +317,13 @@ do_deploy() { echo "# Enable One-Wire Interface" >> $CONFIG echo "dtoverlay=w1-gpio" >> $CONFIG fi + + # Reduce config.txt file size to avoid corruption and + # to boot successfully Raspberry Pi 5. The issue has + # been reported to related projects: + # https://github.com/raspberrypi/firmware/issues/1848 + # https://github.com/Evilpaul/RPi-config/issues/9 + sed -i '/^##/d' $CONFIG } do_deploy:append:raspberrypi3-64() { From 5b3178a4d919c8ab36f99e69f527d65592cc83d8 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Wed, 22 Nov 2023 18:46:27 +0200 Subject: [PATCH 5/8] linux-raspberrypi.inc: bcm2712_defconfig for rpi5 Use bcm2711_defconfig instead of bcm2712_defconfig for Raspberry Pi 5 as per the instructions in the documentation: https://www.raspberrypi.com/documentation/computers/linux_kernel.html#kernel-configuration This work was sponsored by GOVCERT.LU. Signed-off-by: Leon Anavi --- recipes-kernel/linux/linux-raspberrypi.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-kernel/linux/linux-raspberrypi.inc b/recipes-kernel/linux/linux-raspberrypi.inc index c4b690047..e62ff3ff7 100644 --- a/recipes-kernel/linux/linux-raspberrypi.inc +++ b/recipes-kernel/linux/linux-raspberrypi.inc @@ -33,7 +33,7 @@ KBUILD_DEFCONFIG:raspberrypi4 ?= "bcm2711_defconfig" KBUILD_DEFCONFIG:raspberrypi4-64 ?= "bcm2711_defconfig" KBUILD_DEFCONFIG:raspberrypi-armv7 ?= "bcm2711_defconfig" KBUILD_DEFCONFIG:raspberrypi-armv8 ?= "bcm2711_defconfig" -KBUILD_DEFCONFIG:raspberrypi5 ?= "bcm2711_defconfig" +KBUILD_DEFCONFIG:raspberrypi5 ?= "bcm2712_defconfig" LINUX_VERSION_EXTENSION ?= "" From b19385dd258b61e2cf1d4683928d771ffaa184c3 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Sat, 25 Nov 2023 10:09:52 +0100 Subject: [PATCH 6/8] conf/machine/raspberrypi5.conf: kernel_2712.img Set SDIMG_KERNELIMAGE to kernel_2712.img instead of kernel8.img. Raspberry Pi 5 firmware defaults to loading kernel_2712.img because this image contains optimisations specific to Raspberry Pi 5 (e.g. 16K page-size). For more details: https://www.raspberrypi.com/documentation/computers/config_txt.html#kernel This work was sponsored by GOVCERT.LU. Signed-off-by: Leon Anavi --- conf/machine/raspberrypi5.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/machine/raspberrypi5.conf b/conf/machine/raspberrypi5.conf index 9ea494129..b7450fbf7 100644 --- a/conf/machine/raspberrypi5.conf +++ b/conf/machine/raspberrypi5.conf @@ -17,7 +17,7 @@ RPI_KERNEL_DEVICETREE = " \ broadcom/bcm2712-rpi-5-b.dtb \ " -SDIMG_KERNELIMAGE ?= "kernel8.img" +SDIMG_KERNELIMAGE ?= "kernel_2712.img" SERIAL_CONSOLES ?= "115200;ttyS0" VC4DTBO ?= "vc4-kms-v3d" From d39feaa8aaf22c8857b3fe9ce3d6052c58728256 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Sat, 25 Nov 2023 10:11:47 +0100 Subject: [PATCH 7/8] conf/machine/raspberrypi5.conf: ttyAMA10 Set SERIAL_CONSOLES to ttyAMA10. This fixes login on the UART no matter if systemd is used. This work was sponsored by GOVCERT.LU. Suggested-by: Gael PORTAY Signed-off-by: Leon Anavi --- conf/machine/raspberrypi5.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/machine/raspberrypi5.conf b/conf/machine/raspberrypi5.conf index b7450fbf7..21221fd46 100644 --- a/conf/machine/raspberrypi5.conf +++ b/conf/machine/raspberrypi5.conf @@ -18,6 +18,6 @@ RPI_KERNEL_DEVICETREE = " \ " SDIMG_KERNELIMAGE ?= "kernel_2712.img" -SERIAL_CONSOLES ?= "115200;ttyS0" +SERIAL_CONSOLES ?= "115200;ttyAMA10" VC4DTBO ?= "vc4-kms-v3d" From 2cbbd0139324ee17046978e12f005080123042fe Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Fri, 5 Jan 2024 15:06:03 +0200 Subject: [PATCH 8/8] conf/machine/raspberrypi5.conf: Use "Image" "zImage" not supported on arm64 so set KERNEL_IMAGETYPE_DIRECT to "Image" for Raspberry Pi 5 and avoid the following errors: | make: *** No rule to make target 'zImage'. Stop. | ERROR: oe_runmake failed This work was sponsored by GOVCERT.LU. Signed-off-by: Leon Anavi --- conf/machine/raspberrypi5.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf/machine/raspberrypi5.conf b/conf/machine/raspberrypi5.conf index 21221fd46..8c38637a2 100644 --- a/conf/machine/raspberrypi5.conf +++ b/conf/machine/raspberrypi5.conf @@ -21,3 +21,6 @@ SDIMG_KERNELIMAGE ?= "kernel_2712.img" SERIAL_CONSOLES ?= "115200;ttyAMA10" VC4DTBO ?= "vc4-kms-v3d" + +# "zImage" not supported on arm64 and ".gz" images not supported by bootloader yet +KERNEL_IMAGETYPE_DIRECT ?= "Image"