Skip to content
Snippets Groups Projects
Commit 8179c873 authored by Andrei Gherzan's avatar Andrei Gherzan :penguin:
Browse files

oniro-grub-bootconf: Respect KERNEL_IMAGETYPE as opposed to hardcoding bzImage


This patch makes sure that the resulting cfg takes into consideration
the kernel image type for the specific machine. This change makes now
the recipe/package machine specific so we drop allarch and set
PACKAGE_ARCH accordingly.

Signed-off-by: Andrei Gherzan's avatarAndrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: default avatarLuca Seritan <luca.seritan@huawei.com>
parent 79ba6e1d
No related branches found
No related tags found
1 merge request!250Add support for qemuarm/64 machines with EFI
...@@ -33,20 +33,20 @@ echo "note: loaded SYSOTA_BOOT_ACTIVE=$SYSOTA_BOOT_ACTIVE SYSOTA_BOOT_TRY=$SYSOT ...@@ -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. # Recover active slot if the file is corrupted.
if [ -z "$SYSOTA_BOOT_ACTIVE" ]; then if [ -z "$SYSOTA_BOOT_ACTIVE" ]; then
echo "warning: SYSOTA_BOOT_ACTIVE is unset, attempting recovery" 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. # Both slots are available, pick the more recent slot.
# TODO: handle rollback prevention flags (how?) # 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)" echo "note: recovered SYSOTA_BOOT_ACTIVE=A (slot A kernel is newer than slot B)"
set SYSOTA_BOOT_ACTIVE="A" set SYSOTA_BOOT_ACTIVE="A"
else else
echo "note: recovered SYSOTA_BOOT_ACTIVE=B (slot B kernel is newer than slot A)" echo "note: recovered SYSOTA_BOOT_ACTIVE=B (slot B kernel is newer than slot A)"
set SYSOTA_BOOT_ACTIVE="B" set SYSOTA_BOOT_ACTIVE="B"
fi fi
elif [ -e "(hd0,gpt2)/boot/bzImage" ]; then elif [ -e "(hd0,gpt2)/boot/@KERNEL_IMAGETYPE@" ]; then
echo "note: recovered SYSOTA_BOOT_ACTIVE=A" echo "note: recovered SYSOTA_BOOT_ACTIVE=A"
set 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" echo "note: recovered SYSOTA_BOOT_ACTIVE=B"
set SYSOTA_BOOT_ACTIVE="B" set SYSOTA_BOOT_ACTIVE="B"
else else
...@@ -81,9 +81,9 @@ fi ...@@ -81,9 +81,9 @@ fi
# https://gitlab.eclipse.org/eclipse/oniro-core/sysota/-/wikis/Boot%20Assets%20Specification#efigrub # https://gitlab.eclipse.org/eclipse/oniro-core/sysota/-/wikis/Boot%20Assets%20Specification#efigrub
if [ "$SLOT" == "A" ]; then if [ "$SLOT" == "A" ]; then
# TODO pass root partition by partuuid. # 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 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 else
echo "error: cannot select slot to boot from, halting" echo "error: cannot select slot to boot from, halting"
halt halt
......
...@@ -16,7 +16,7 @@ SRC_URI = " \ ...@@ -16,7 +16,7 @@ SRC_URI = " \
file://grubenv \ file://grubenv \
" "
inherit allarch deploy inherit deploy
RPROVIDES:${PN} += "virtual-grub-bootconf" RPROVIDES:${PN} += "virtual-grub-bootconf"
...@@ -32,17 +32,18 @@ do_install() { ...@@ -32,17 +32,18 @@ do_install() {
# testing. # testing.
install -d ${D}${EFI_FILES_PATH} install -d ${D}${EFI_FILES_PATH}
install -m 644 grub.cfg ${D}${EFI_FILES_PATH}/grub.cfg 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 install -m 644 grubenv ${D}${EFI_FILES_PATH}/grubenv
} }
do_deploy() { do_deploy() {
# Install the boot assets into DEPLOYDIR. The deploy bbclass # Install the boot assets into DEPLOYDIR. The deploy bbclass
# eventually copies those into the boot partition. # 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 # Unlike grub.cfg, nothing installs this file to the boot partition
# automatically. It is handled by extending IMAGE_EFI_BOOT_FILES from # automatically. It is handled by extending IMAGE_EFI_BOOT_FILES from
# conf/distro/oniro-linux.conf. # 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. # Cargo-cult from a similar recipe.
...@@ -52,3 +53,5 @@ FILES:${PN} = "\ ...@@ -52,3 +53,5 @@ FILES:${PN} = "\
${EFI_FILES_PATH}/grub.cfg \ ${EFI_FILES_PATH}/grub.cfg \
${EFI_FILES_PATH}/grubenv \ ${EFI_FILES_PATH}/grubenv \
" "
PACKAGE_ARCH = "${MACHINE_ARCH}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment