diff --git a/meta-oniro-core/recipes-bsp/grub/files/grub.cfg b/meta-oniro-core/recipes-bsp/grub/files/grub.cfg index b72bf6f9d628e8f00cb441a7fd041b0f2f66bcef..8f488fd9e9607621c5efc8be9dcb514d591f4882 100644 --- a/meta-oniro-core/recipes-bsp/grub/files/grub.cfg +++ b/meta-oniro-core/recipes-bsp/grub/files/grub.cfg @@ -33,20 +33,20 @@ echo "note: loaded SYSOTA_BOOT_ACTIVE=$SYSOTA_BOOT_ACTIVE SYSOTA_BOOT_TRY=$SYSOT # Recover active slot if the file is corrupted. if [ -z "$SYSOTA_BOOT_ACTIVE" ]; then echo "warning: SYSOTA_BOOT_ACTIVE is unset, attempting recovery" - if [ -e "(hd0,gpt2)/boot/bzImage" -a -e "(hd0,gpt3)/boot/bzImage" ]; then + if [ -e "(hd0,gpt2)/boot/@KERNEL_IMAGETYPE@" -a -e "(hd0,gpt3)/boot/@KERNEL_IMAGETYPE@" ]; then # Both slots are available, pick the more recent slot. # TODO: handle rollback prevention flags (how?) - if [ "(hd0,gpt2)/boot/bzImage" -nt "(hd0,gpt3)/boot/bzImage" ]; then + if [ "(hd0,gpt2)/boot/@KERNEL_IMAGETYPE@" -nt "(hd0,gpt3)/boot/@KERNEL_IMAGETYPE@" ]; then echo "note: recovered SYSOTA_BOOT_ACTIVE=A (slot A kernel is newer than slot B)" set SYSOTA_BOOT_ACTIVE="A" else echo "note: recovered SYSOTA_BOOT_ACTIVE=B (slot B kernel is newer than slot A)" set SYSOTA_BOOT_ACTIVE="B" fi - elif [ -e "(hd0,gpt2)/boot/bzImage" ]; then + elif [ -e "(hd0,gpt2)/boot/@KERNEL_IMAGETYPE@" ]; then echo "note: recovered SYSOTA_BOOT_ACTIVE=A" set SYSOTA_BOOT_ACTIVE="A" - elif [ -e "(hd0,gpt3)/boot/bzImage" ]; then + elif [ -e "(hd0,gpt3)/boot/@KERNEL_IMAGETYPE@" ]; then echo "note: recovered SYSOTA_BOOT_ACTIVE=B" set SYSOTA_BOOT_ACTIVE="B" else @@ -81,9 +81,9 @@ fi # https://gitlab.eclipse.org/eclipse/oniro-core/sysota/-/wikis/Boot%20Assets%20Specification#efigrub if [ "$SLOT" == "A" ]; then # TODO pass root partition by partuuid. - linux "(hd0,gpt2)/boot/bzImage" root=/dev/sda2 rauc.slot=A $CMDLINE + linux "(hd0,gpt2)/boot/@KERNEL_IMAGETYPE@" root=/dev/sda2 rauc.slot=A $CMDLINE elif [ "$SLOT" == "B" ]; then - linux "(hd0,gpt3)/boot/bzImage" root=/dev/sda3 rauc.slot=B $CMDLINE + linux "(hd0,gpt3)/boot/@KERNEL_IMAGETYPE@" root=/dev/sda3 rauc.slot=B $CMDLINE else echo "error: cannot select slot to boot from, halting" halt diff --git a/meta-oniro-core/recipes-bsp/grub/oniro-grub-bootconf.bb b/meta-oniro-core/recipes-bsp/grub/oniro-grub-bootconf.bb index 856c0aa292337142b5708a6b4ec13e272429548e..ebd1041167cac5de746843fe6313fe6173823061 100644 --- a/meta-oniro-core/recipes-bsp/grub/oniro-grub-bootconf.bb +++ b/meta-oniro-core/recipes-bsp/grub/oniro-grub-bootconf.bb @@ -16,7 +16,7 @@ SRC_URI = " \ file://grubenv \ " -inherit allarch deploy +inherit deploy RPROVIDES:${PN} += "virtual-grub-bootconf" @@ -32,17 +32,18 @@ do_install() { # testing. install -d ${D}${EFI_FILES_PATH} install -m 644 grub.cfg ${D}${EFI_FILES_PATH}/grub.cfg + sed -i "s/@KERNEL_IMAGETYPE@/${KERNEL_IMAGETYPE}/g" ${D}${EFI_FILES_PATH}/grub.cfg install -m 644 grubenv ${D}${EFI_FILES_PATH}/grubenv } do_deploy() { # Install the boot assets into DEPLOYDIR. The deploy bbclass # eventually copies those into the boot partition. - install -m 644 ${WORKDIR}/grub.cfg ${DEPLOYDIR} + install -m 644 ${D}${EFI_FILES_PATH}/grub.cfg ${DEPLOYDIR} # Unlike grub.cfg, nothing installs this file to the boot partition # automatically. It is handled by extending IMAGE_EFI_BOOT_FILES from # conf/distro/oniro-linux.conf. - install -m 644 ${WORKDIR}/grubenv ${DEPLOYDIR} + install -m 644 ${D}${EFI_FILES_PATH}/grubenv ${DEPLOYDIR} } # Cargo-cult from a similar recipe. @@ -52,3 +53,5 @@ FILES:${PN} = "\ ${EFI_FILES_PATH}/grub.cfg \ ${EFI_FILES_PATH}/grubenv \ " + +PACKAGE_ARCH = "${MACHINE_ARCH}"