diff --git a/layers/meta-balena-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bbappend b/layers/meta-balena-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bbappend index 8ae43d118..ba9e8b872 100644 --- a/layers/meta-balena-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bbappend +++ b/layers/meta-balena-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bbappend @@ -6,3 +6,7 @@ CMDLINE += " ${@bb.utils.contains('DISTRO_FEATURES','osdev-image',"console=tty1 CMDLINE += " cgroup_enable=memory" CMDLINE:remove = "root=/dev/mmcblk0p2" CMDLINE_DEBUG = "" + +# Necessary for balena bootloader to work +# These will not be passed to the actual kernel +CMDLINE:append:raspberrypi4-64 := " balena_stage2 nr_cpus=1" 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 5f85e4f0d..835995d53 100644 --- a/layers/meta-balena-raspberrypi/recipes-core/images/balena-image.bbappend +++ b/layers/meta-balena-raspberrypi/recipes-core/images/balena-image.bbappend @@ -30,6 +30,16 @@ BALENA_BOOT_PARTITION_FILES:rpi = " \ bootfiles:/ \ " +BALENA_BOOT_PARTITION_FILES:remove:raspberrypi4-64 = " \ + u-boot.bin:/${SDIMG_KERNELIMAGE} \ + boot.scr:/boot.scr \ + " + +BALENA_BOOT_PARTITION_FILES:append:raspberrypi4-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" @@ -63,6 +73,11 @@ python overlay_dtbs_handler () { do_resin_boot_dirgen_and_deploy[prefuncs] += "overlay_dtbs_handler" IMAGE_INSTALL:append:rpi = " u-boot" +IMAGE_INSTALL:remove:raspberrypi4-64 = " u-boot" +IMAGE_INSTALL:append:raspberrypi4-64 = " grub-editenv" + +do_rootfs[depends] += "${@oe.utils.conditional('MACHINE','raspberrypi4-64',' virtual/balena-bootloader:do_deploy','',d)}" +do_image_balenaos_img[depends] += "${@oe.utils.conditional('MACHINE','raspberrypi4-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 new file mode 100644 index 000000000..a1f7ba9e4 --- /dev/null +++ b/layers/meta-balena-raspberrypi/recipes-kernel/linux/linux-balena-bootloader_6.1.bb @@ -0,0 +1,50 @@ +LINUX_VERSION ?= "6.1.64" +LINUX_RPI_BRANCH ?= "rpi-6.1.y" +LINUX_RPI_KMETA_BRANCH ?= "yocto-6.1" + +SRCREV_machine = "dad5d57939cfae7af363e7c9862b59d33d96794b" +SRCREV_meta = "f845a7f37d7114230d6609e2bd630070f2f6cd9b" + +KMETA = "kernel-meta" + +SRC_URI = " \ + git://github.com/raspberrypi/linux.git;name=machine;branch=${LINUX_RPI_BRANCH};protocol=https \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${LINUX_RPI_KMETA_BRANCH};destsuffix=${KMETA} \ +" +SRC_URI:remove = "file://initramfs-image-bundle.cfg" +SRC_URI:remove = "file://vc4graphics.cfg" + +require recipes-kernel/linux/linux-raspberrypi.inc + +inherit balena-bootloader + +BALENA_DEFCONFIG_NAME = "${KBUILD_DEFCONFIG}" + +BALENA_CONFIGS:append = " \ + rpisense \ + " + +BALENA_CONFIGS[rpisense] = " \ + CONFIG_MFD_RPISENSE_CORE=n \ + CONFIG_FB_RPISENSE=n \ + " + +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" + +KERNEL_PACKAGE_NAME = "balena-bootloader" + +KERNEL_DEVICETREE = "${RPI_KERNEL_DEVICETREE}" + +PROVIDES = "virtual/balena-bootloader" 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 d30c267bc..5e876c74b 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:raspberrypi4-64 = "99-resin-uboot 999-resin-boot-cleaner" +HOSTAPP_HOOKS:append:raspberrypi4-64 = " 99-balena-bootloader"