From adb15224777ac380dfb6729106de394f2722666f Mon Sep 17 00:00:00 2001 From: Natalia Kovalenko <waykovalenko@gmail.com> Date: Mon, 17 Oct 2022 09:59:21 +0200 Subject: [PATCH] seco-imx8mm-c61: Add RAUC/SYSOTA support configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit manifests/default.xml: Update source revision on meta-seco-imx. Add a new partition scheme in wic input file for seco-imx8mm-c61. 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. rauc: Move machines specific configurations into dedicated include file (rauc-conf.inc) for meta-data sharing. 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. sysota/sysota_git.bb: Add seco-imx8mm-c61 model and bootloader type. bundles/oniro-bundle-base.bb Add seco-imx8mm-c61 bundle compatibility string. Signed-off-by: Natalia Kovalenko <waykovalenko@gmail.com> --- manifests/default.xml | 2 +- .../recipes-bsp/grub/files/grub.cfg | 10 ++++-- .../recipes-bsp/grub/oniro-grub-bootconf.bb | 7 +++- .../recipes-core/bundles/oniro-bundle-base.bb | 1 + .../recipes-core/rauc/rauc-conf.inc | 34 +++++++++++++++++++ .../recipes-core/rauc/rauc_%.bbappend | 32 +---------------- .../recipes-core/sysota/sysota_git.bb | 3 ++ 7 files changed, 53 insertions(+), 36 deletions(-) create mode 100644 meta-oniro-core/recipes-core/rauc/rauc-conf.inc diff --git a/manifests/default.xml b/manifests/default.xml index 22fbed56..49c1c049 100644 --- a/manifests/default.xml +++ b/manifests/default.xml @@ -33,7 +33,7 @@ SPDX-FileCopyrightText: Huawei Inc. <project name="meta-intel" remote="yocto" revision="15cdda250fc5aa762ac0139087f96411ca696036" path="meta-intel" /> <project name="pub/intel/yocto/meta-seco-intel" remote="seco" revision="65a673560211b11986db5785c70254fad190785f" path="meta-seco-intel" /> <project name="meta-freescale" remote="yocto" revision="2e785f257ad98581b684f0e32f6d4bb96faefb10" path="meta-freescale" /> - <project name="pub/i.mx/yocto/5.x/meta-seco-imx" remote="seco" revision="604eea652c97a2b1aad94bf466ccb148e1c334a4" path="meta-seco-imx" /> + <project name="pub/i.mx/yocto/5.x/meta-seco-imx" remote="seco" revision="f2cb750471dc263bc7c94ca6921cbaf25c37ccba" path="meta-seco-imx" /> <project name="meta-raspberrypi" remote="yocto" revision="0135a02ea577bd39dd552236ead2c5894d89da1d" path="meta-raspberrypi" /> <project name="meta-security" remote="yocto" revision="c79262a30bd385f5dbb009ef8704a1a01644528e" path="meta-security" /> <project name="rauc/meta-rauc" remote="github" revision="ea4236412dc4449eff4d52d3ef6b6d230355f936" path="meta-rauc" /> diff --git a/meta-oniro-core/recipes-bsp/grub/files/grub.cfg b/meta-oniro-core/recipes-bsp/grub/files/grub.cfg index 2dec6f31..6c6cfb7a 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 5ce781a3..2c4de3f8 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/bundles/oniro-bundle-base.bb b/meta-oniro-core/recipes-core/bundles/oniro-bundle-base.bb index 858d15d0..1e13414f 100644 --- a/meta-oniro-core/recipes-core/bundles/oniro-bundle-base.bb +++ b/meta-oniro-core/recipes-core/bundles/oniro-bundle-base.bb @@ -9,6 +9,7 @@ SUMMARY = "SysOTA/RAUC Update Bundle for Oniro Base Image" RAUC_BUNDLE_COMPATIBLE:raspberrypi-armv7 = "Raspberry Pi ARMv7" RAUC_BUNDLE_COMPATIBLE:raspberrypi4-64 = "Raspberry Pi 4" RAUC_BUNDLE_COMPATIBLE:seco-intel-b68 := "SECO Alvin" +RAUC_BUNDLE_COMPATIBLE:seco-imx8mm-c61 := "SECO Astrid" RAUC_BUNDLE_COMPATIBLE:qemux86 = "QEMU x86" RAUC_BUNDLE_COMPATIBLE:qemux86-64 = "QEMU x86-64" RAUC_BUNDLE_COMPATIBLE:qemuarm-efi = "QEMU ARM (EFI)" 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 00000000..1aab2a0c --- /dev/null +++ b/meta-oniro-core/recipes-core/rauc/rauc-conf.inc @@ -0,0 +1,34 @@ +# 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:seco-imx8mm-c61 := "SECO Astrid" +RAUC_SLOT_A:seco-imx8mm-c61 := "/dev/mmcblk0p2" +RAUC_SLOT_B:seco-imx8mm-c61 := "/dev/mmcblk0p3" + +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 a970cef2..464b6472 100644 --- a/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend +++ b/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend @@ -17,37 +17,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" 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 \ diff --git a/meta-oniro-core/recipes-core/sysota/sysota_git.bb b/meta-oniro-core/recipes-core/sysota/sysota_git.bb index 007bdcf2..f90cf54c 100644 --- a/meta-oniro-core/recipes-core/sysota/sysota_git.bb +++ b/meta-oniro-core/recipes-core/sysota/sysota_git.bb @@ -121,6 +121,9 @@ SYSOTA_BOOTLOADER_TYPE:qemuarm64-efi := "GRUB" SYSOTA_MODEL:seco-intel-b68 := "B68 / Alvin" SYSOTA_BOOTLOADER_TYPE:seco-intel-b68 := "GRUB" +SYSOTA_MODEL:seco-imx8mm-c61 := "C61 / Astrid" +SYSOTA_BOOTLOADER_TYPE:seco-imx8mm-c61 := "GRUB" + do_install:prepend() { sed \ -e 's,@SYSOTA_BOOTLOADER_TYPE@,${SYSOTA_BOOTLOADER_TYPE},g' \ -- GitLab