From 240c24240cc6031c0d914c8361123aa9d3784f96 Mon Sep 17 00:00:00 2001 From: Alexandru Costache Date: Mon, 5 Jun 2023 08:54:01 +0200 Subject: [PATCH 1/2] rpi-u-boot-scr: Add crc32 checks for fdt ... in the u-boot scripts. This depends on the crc32 checks PR in meta-balena. We only check that the kernel did not overlap the fdt, because no other operation is performed after unzipping the kernel image, apart from booting. Changelog-entry: rpi-u-boot-scr: Add crc32 checks for fdt Signed-off-by: Alexandru Costache --- .../recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/boot.cmd.in | 2 ++ .../rpi-u-boot-scr/raspberrypi0-2w-64/boot.cmd.in | 2 ++ .../rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi3-64/boot.cmd.in | 2 ++ .../rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi4-64/boot.cmd.in | 2 ++ 4 files changed, 8 insertions(+) diff --git a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/boot.cmd.in b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/boot.cmd.in index 8cc025cfa..69c388075 100644 --- a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/boot.cmd.in +++ b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/boot.cmd.in @@ -4,5 +4,7 @@ fdt addr ${fdt_addr} fdt get value bootargs /chosen bootargs env set bootargs "${bootargs} ${resin_kernel_root} rootwait" fdt rm /chosen bootargs +run balena_fdt_load_crc_save; load ${resin_dev_type} ${resin_dev_index}:${resin_root_part} ${resin_kernel_load_addr} /boot/@@KERNEL_IMAGETYPE@@ +run balena_fdt_load_crc_check; @@KERNEL_BOOTCMD@@ ${resin_kernel_load_addr} - ${fdt_addr} diff --git a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi0-2w-64/boot.cmd.in b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi0-2w-64/boot.cmd.in index 65d967458..e6174ff2a 100644 --- a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi0-2w-64/boot.cmd.in +++ b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi0-2w-64/boot.cmd.in @@ -5,6 +5,8 @@ fdt addr ${fdt_addr} fdt get value bootargs /chosen bootargs env set bootargs "${bootargs} ${resin_kernel_root} rootwait" fdt rm /chosen bootargs +run balena_fdt_load_crc_save; load ${resin_dev_type} ${resin_dev_index}:${resin_root_part} ${resin_tmp_loadaddr} /boot/@@KERNEL_IMAGETYPE@@ unzip ${fileaddr} ${resin_kernel_load_addr} +run balena_fdt_load_crc_check; @@KERNEL_BOOTCMD@@ ${resin_kernel_load_addr} - ${fdt_addr} diff --git a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi3-64/boot.cmd.in b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi3-64/boot.cmd.in index 65d967458..e6174ff2a 100644 --- a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi3-64/boot.cmd.in +++ b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi3-64/boot.cmd.in @@ -5,6 +5,8 @@ fdt addr ${fdt_addr} fdt get value bootargs /chosen bootargs env set bootargs "${bootargs} ${resin_kernel_root} rootwait" fdt rm /chosen bootargs +run balena_fdt_load_crc_save; load ${resin_dev_type} ${resin_dev_index}:${resin_root_part} ${resin_tmp_loadaddr} /boot/@@KERNEL_IMAGETYPE@@ unzip ${fileaddr} ${resin_kernel_load_addr} +run balena_fdt_load_crc_check; @@KERNEL_BOOTCMD@@ ${resin_kernel_load_addr} - ${fdt_addr} diff --git a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi4-64/boot.cmd.in b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi4-64/boot.cmd.in index 65d967458..e6174ff2a 100644 --- a/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi4-64/boot.cmd.in +++ b/layers/meta-balena-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr/raspberrypi4-64/boot.cmd.in @@ -5,6 +5,8 @@ fdt addr ${fdt_addr} fdt get value bootargs /chosen bootargs env set bootargs "${bootargs} ${resin_kernel_root} rootwait" fdt rm /chosen bootargs +run balena_fdt_load_crc_save; load ${resin_dev_type} ${resin_dev_index}:${resin_root_part} ${resin_tmp_loadaddr} /boot/@@KERNEL_IMAGETYPE@@ unzip ${fileaddr} ${resin_kernel_load_addr} +run balena_fdt_load_crc_check; @@KERNEL_BOOTCMD@@ ${resin_kernel_load_addr} - ${fdt_addr} From b58699ed6f28dc94632cef8499c1cacd0aaf3e39 Mon Sep 17 00:00:00 2001 From: Alexandru Costache Date: Mon, 5 Jun 2023 08:56:04 +0200 Subject: [PATCH 2/2] u-boot: Remove kconfig specific env integration patch UBOOT_KCONFIG_SUPPORT defaults to 1 in meta-balena starting with commit ef248aa5163 and the static integration of the env is no longer necessary because it is already done by the OS u-boot class. Signed-off-by: Alexandru Costache --- ...e-independent-resin-environment-conf.patch | 36 ------------------- .../recipes-bsp/u-boot/u-boot_%.bbappend | 5 --- 2 files changed, 41 deletions(-) delete mode 100644 layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot/0001-Integrate-machine-independent-resin-environment-conf.patch diff --git a/layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot/0001-Integrate-machine-independent-resin-environment-conf.patch b/layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot/0001-Integrate-machine-independent-resin-environment-conf.patch deleted file mode 100644 index 0c02615c3..000000000 --- a/layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot/0001-Integrate-machine-independent-resin-environment-conf.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 8c41dcb55ad8fe4ab0a8202b53b8342e5c47fd7b Mon Sep 17 00:00:00 2001 -From: Andrei Gherzan -Date: Wed, 1 Mar 2017 23:53:02 +0100 -Subject: [PATCH] Integrate machine independent resin environment configuration - -This patch integrates resin default environment configuration in an u-boot which -has a version with Kconfig support. - -Signed-off-by: Andrei Gherzan - -Upstream-Status: Inappropriate [configuration] ---- - include/env_default.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/include/env_default.h b/include/env_default.h -index 1ddd64ba8ffe..2c0a6838c735 100644 ---- a/include/env_default.h -+++ b/include/env_default.h -@@ -10,6 +10,8 @@ - #include - #include - -+#include -+ - #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED - env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = { - ENV_CRC, /* CRC Sum */ -@@ -25,6 +27,7 @@ uchar default_environment[] = { - const uchar default_environment[] = { - #endif - #ifndef CONFIG_USE_DEFAULT_ENV_FILE -+ BALENA_ENV - #ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT - ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0" - #endif diff --git a/layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend b/layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend index 4656b759e..582f5955e 100644 --- a/layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend +++ b/layers/meta-balena-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend @@ -1,11 +1,7 @@ inherit resin-u-boot -UBOOT_KCONFIG_SUPPORT = "1" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -# Remove patch inherited from meta-resin. This needs to be rebased for v2018.07 -SRC_URI:remove = " file://resin-specific-env-integration-kconfig.patch " - # Update to u-boot v2021.10 on top of which # we apply the NVME patches for CM4. SRCREV="d80bb749fab53da72c4a0e09b8c2d2aaa3103c91" @@ -21,7 +17,6 @@ RPI_PATCHES = " \ " SRC_URI += " \ - file://0001-Integrate-machine-independent-resin-environment-conf.patch \ ${RPI_PATCHES} \ "