Skip to content
Snippets Groups Projects
Commit c7104db5 authored by Natalia Kovalenko's avatar Natalia Kovalenko
Browse files

Wrap common GRUB and RAUC configuration metadata in variables

and share them using the common include file.

    rauc: Move machines specific configurations into
    dedicated include file (rauc-conf.inc) for metadata sharing.

    grub/oniro-grub-bootconf.bb: Include rauc-conf.inc. Retrieve the
    values ​​of SERIAL_CONSOLES, RAUC_SLOT_A, RAUC_SLOT_B to pass them to
    grub.cfg file.

    grub/files/grub.cfg: Use SERIAL_CONSOLES, RAUC_SLOT_A, RAUC_SLOT_B
    variables instead of hard-coding their values, to be suitable for
    different target machines.

Signed-off-by: default avatarNatalia Kovalenko <waykovalenko@gmail.com>
parent af619d54
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
}
......
# 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"
......@@ -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 \
......
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