From 57b5b2f6b221506c95b09abd671bf8dbfb412f9c Mon Sep 17 00:00:00 2001 From: Michal Toman Date: Fri, 22 Sep 2023 10:05:01 +0200 Subject: [PATCH] balena-image: Use balena bootloader on raspberrypi5-64 Change-type: patch Changelog-entry: Use balena bootloader on Raspberry Pi 5 Signed-off-by: Michal Toman --- .../recipes-core/images/balena-image.bbappend | 15 +++++++++++++++ .../linux/linux-balena-bootloader_6.1.bb | 10 ++++++++++ .../hostapp-update-hooks.bbappend | 3 +++ 3 files changed, 28 insertions(+) diff --git a/layers/meta-balena-raspberrypi/recipes-core/images/balena-image.bbappend b/layers/meta-balena-raspberrypi/recipes-core/images/balena-image.bbappend index 26b6e947..11488a03 100644 --- a/layers/meta-balena-raspberrypi/recipes-core/images/balena-image.bbappend +++ b/layers/meta-balena-raspberrypi/recipes-core/images/balena-image.bbappend @@ -25,6 +25,16 @@ BALENA_BOOT_PARTITION_FILES:rpi = " \ bootfiles:/ \ " +BALENA_BOOT_PARTITION_FILES:remove:raspberrypi5-64 = " \ + u-boot.bin:/${SDIMG_KERNELIMAGE} \ + boot.scr:/boot.scr \ + " + +BALENA_BOOT_PARTITION_FILES:append:raspberrypi5-64 = " \ + balena-bootloader/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin:/${SDIMG_KERNELIMAGE} \ + balena-bootloader/bootenv:/bootenv \ + " + BALENA_BOOT_PARTITION_FILES:append:revpi-core-3 = " revpi-core-dt-blob-overlay.dtb:/dt-blob.bin" BALENA_BOOT_PARTITION_FILES:append:revpi-connect = " revpi-connect-dt-blob-overlay.dtb:/dt-blob.bin" @@ -58,6 +68,11 @@ python overlay_dtbs_handler () { do_resin_boot_dirgen_and_deploy[prefuncs] += "overlay_dtbs_handler" IMAGE_INSTALL:append:rpi = " u-boot" +IMAGE_INSTALL:remove:raspberrypi5-64 = " u-boot" +IMAGE_INSTALL:append:raspberrypi5-64 = " grub-editenv" + +do_rootfs[depends] += "${@oe.utils.conditional('MACHINE','raspberrypi5-64',' virtual/balena-bootloader:do_deploy','',d)}" +do_image_balenaos_img[depends] += "${@oe.utils.conditional('MACHINE','raspberrypi5-64',' virtual/balena-bootloader:do_deploy','',d)}" do_resin_boot_dirgen_and_deploy[depends] += "virtual/kernel:do_install" diff --git a/layers/meta-balena-raspberrypi/recipes-kernel/linux/linux-balena-bootloader_6.1.bb b/layers/meta-balena-raspberrypi/recipes-kernel/linux/linux-balena-bootloader_6.1.bb index 8dfc0315..a99ad629 100644 --- a/layers/meta-balena-raspberrypi/recipes-kernel/linux/linux-balena-bootloader_6.1.bb +++ b/layers/meta-balena-raspberrypi/recipes-kernel/linux/linux-balena-bootloader_6.1.bb @@ -16,6 +16,16 @@ SRC_URI:remove = "file://initramfs-image-bundle.cfg" require recipes-kernel/linux/linux-raspberrypi.inc +do_deploy:append () { + BOOTENV_FILE="${DEPLOYDIR}/${KERNEL_PACKAGE_NAME}/bootenv" + grub-editenv "${BOOTENV_FILE}" create + grub-editenv "${BOOTENV_FILE}" set "resin_root_part=A" + grub-editenv "${BOOTENV_FILE}" set "bootcount=0" + grub-editenv "${BOOTENV_FILE}" set "upgrade_available=0" +} + +do_deploy[depends] += " grub-native:do_populate_sysroot" + KERNEL_DTC_FLAGS += "-@ -H epapr" INITRAMFS_IMAGE = "balena-image-bootloader-initramfs" diff --git a/layers/meta-balena-raspberrypi/recipes-support/hostapp-update-hooks/hostapp-update-hooks.bbappend b/layers/meta-balena-raspberrypi/recipes-support/hostapp-update-hooks/hostapp-update-hooks.bbappend index d30c267b..4fc883b7 100644 --- a/layers/meta-balena-raspberrypi/recipes-support/hostapp-update-hooks/hostapp-update-hooks.bbappend +++ b/layers/meta-balena-raspberrypi/recipes-support/hostapp-update-hooks/hostapp-update-hooks.bbappend @@ -2,3 +2,6 @@ FILESEXTRAPATHS:append := ":${THISDIR}/files" HOSTAPP_HOOKS += " 99-resin-uboot 999-resin-boot-cleaner" HOSTAPP_HOOKS:append:revpi-core-3 = " 9999-bootfiles" + +HOSTAPP_HOOKS:remove:raspberrypi5-64 = "99-resin-uboot 999-resin-boot-cleaner" +HOSTAPP_HOOKS:append:raspberrypi5-64 = " 99-balena-bootloader"