diff --git a/meta-oniro-core/recipes-bsp/grub/files/grub.cfg b/meta-oniro-core/recipes-bsp/grub/files/grub.cfg index 2dec6f31a5c0d0abb340124353df242e749b3c51..6c6cfb7ab2344455f789e530ab27433c03703518 100644 --- a/meta-oniro-core/recipes-bsp/grub/files/grub.cfg +++ b/meta-oniro-core/recipes-bsp/grub/files/grub.cfg @@ -7,7 +7,7 @@ serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 -set CMDLINE="console=ttyS0,115200 panic=60 rootwait quiet" +set CMDLINE="console=@SERIAL_CONSOLES@ panic=60 rootwait quiet" # Find the boot partition. We need to know where to load from and save the # environment to. The boot partition is saved into the ONIRO_GRUB_BOOT @@ -81,9 +81,13 @@ 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/@KERNEL_IMAGETYPE@" root=/dev/sda2 rauc.slot=A $CMDLINE +menuentry 'boot' { + linux "(hd0,gpt2)/boot/@KERNEL_IMAGETYPE@" root=@RAUC_SLOT_A@ rauc.slot=A $CMDLINE +} elif [ "$SLOT" == "B" ]; then - linux "(hd0,gpt3)/boot/@KERNEL_IMAGETYPE@" root=/dev/sda3 rauc.slot=B $CMDLINE +menuentry 'boot' { + linux "(hd0,gpt3)/boot/@KERNEL_IMAGETYPE@" root=@RAUC_SLOT_B@ 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 5ce781a3ed1fb2b397c092717e5af313c8d2c23d..2c4de3f801466a023234fabf2196eed60cc174a3 100644 --- a/meta-oniro-core/recipes-bsp/grub/oniro-grub-bootconf.bb +++ b/meta-oniro-core/recipes-bsp/grub/oniro-grub-bootconf.bb @@ -15,7 +15,7 @@ SRC_URI = " \ file://grub.cfg \ file://grubenv \ " - +require recipes-core/rauc/rauc-conf.inc inherit deploy RPROVIDES:${PN} += "virtual-grub-bootconf" @@ -33,6 +33,11 @@ do_install() { 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 + baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` + ttydev=`echo "${SERIAL_CONSOLES}" | sed -e 's/^[0-9]*\;//' -e 's/ .*//'` + sed -i "s/@SERIAL_CONSOLES@/${ttydev},${baudrate}/g" ${D}${EFI_FILES_PATH}/grub.cfg + sed -i "s,@RAUC_SLOT_A@,${RAUC_SLOT_A},g" ${D}${EFI_FILES_PATH}/grub.cfg + sed -i "s,@RAUC_SLOT_B@,${RAUC_SLOT_B},g" ${D}${EFI_FILES_PATH}/grub.cfg install -m 644 grubenv ${D}${EFI_FILES_PATH}/grubenv } diff --git a/meta-oniro-core/recipes-core/rauc/rauc-conf.inc b/meta-oniro-core/recipes-core/rauc/rauc-conf.inc new file mode 100644 index 0000000000000000000000000000000000000000..80cad39efe3c579c380ff4f8915b40a397514e65 --- /dev/null +++ b/meta-oniro-core/recipes-core/rauc/rauc-conf.inc @@ -0,0 +1,34 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: MIT + +# Define the slots and compatible strings for reference boards. +# The values here must be synchronized with those in the bundle. +# Look at meta-oniro-core/recipes-core/bundles/oniro-bundle-base.bb +RAUC_COMPAT:raspberrypi-armv7 := "Raspberry Pi ARMv7" +RAUC_SLOT_A:raspberrypi-armv7 := "/dev/mmcblk0p2" +RAUC_SLOT_B:raspberrypi-armv7 := "/dev/mmcblk0p3" + +RAUC_COMPAT:raspberrypi4-64 := "Raspberry Pi 4" +RAUC_SLOT_A:raspberrypi4-64 := "/dev/mmcblk0p2" +RAUC_SLOT_B:raspberrypi4-64 := "/dev/mmcblk0p3" + +RAUC_COMPAT:seco-intel-b68 := "SECO Alvin" +RAUC_SLOT_A:seco-intel-b68 := "/dev/sda2" +RAUC_SLOT_B:seco-intel-b68 := "/dev/sda3" + +RAUC_COMPAT:qemux86 := "QEMU x86" +RAUC_SLOT_A:qemux86 := "/dev/sda2" +RAUC_SLOT_B:qemux86 := "/dev/sda3" + +RAUC_COMPAT:qemux86-64 := "QEMU x86-64" +RAUC_SLOT_A:qemux86-64 := "/dev/sda2" +RAUC_SLOT_B:qemux86-64 := "/dev/sda3" + +RAUC_COMPAT:qemuarm-efi:= "QEMU ARM (EFI)" +RAUC_SLOT_A:qemuarm-efi := "/dev/sda2" +RAUC_SLOT_B:qemuarm-efi := "/dev/sda3" + +RAUC_COMPAT:qemuarm64-efi:= "QEMU ARM64 (EFI)" +RAUC_SLOT_A:qemuarm64-efi := "/dev/sda2" +RAUC_SLOT_B:qemuarm64-efi := "/dev/sda3" diff --git a/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend b/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend index a970cef2348310796df431ab7137b786ab71a14a..4ab08c3ffde39187ce9b1183b9ecad1f63b58270 100644 --- a/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend +++ b/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend @@ -18,36 +18,7 @@ SRC_URI:append = " \ file://system.conf.in \ " -# Define the slots and compatible strings for reference boards. -# The values here must be synchronized with those in the bundle. -# Look at meta-oniro-core/recipes-core/bundles/oniro-bundle-base.bb -RAUC_COMPAT:raspberrypi-armv7 := "Raspberry Pi ARMv7" -RAUC_SLOT_A:raspberrypi-armv7 := "/dev/mmcblk0p2" -RAUC_SLOT_B:raspberrypi-armv7 := "/dev/mmcblk0p3" - -RAUC_COMPAT:raspberrypi4-64 := "Raspberry Pi 4" -RAUC_SLOT_A:raspberrypi4-64 := "/dev/mmcblk0p2" -RAUC_SLOT_B:raspberrypi4-64 := "/dev/mmcblk0p3" - -RAUC_COMPAT:seco-intel-b68 := "SECO Alvin" -RAUC_SLOT_A:seco-intel-b68 := "/dev/sda2" -RAUC_SLOT_B:seco-intel-b68 := "/dev/sda3" - -RAUC_COMPAT:qemux86 := "QEMU x86" -RAUC_SLOT_A:qemux86 := "/dev/sda2" -RAUC_SLOT_B:qemux86 := "/dev/sda3" - -RAUC_COMPAT:qemux86-64 := "QEMU x86-64" -RAUC_SLOT_A:qemux86-64 := "/dev/sda2" -RAUC_SLOT_B:qemux86-64 := "/dev/sda3" - -RAUC_COMPAT:qemuarm-efi:= "QEMU ARM (EFI)" -RAUC_SLOT_A:qemuarm-efi := "/dev/sda2" -RAUC_SLOT_B:qemuarm-efi := "/dev/sda3" - -RAUC_COMPAT:qemuarm64-efi:= "QEMU ARM64 (EFI)" -RAUC_SLOT_A:qemuarm64-efi := "/dev/sda2" -RAUC_SLOT_B:qemuarm64-efi := "/dev/sda3" +include rauc-conf.inc do_install:prepend() { sed \