diff --git a/meta-oniro-core/recipes-core/rauc/files/qemux86-64/system.conf b/meta-oniro-core/recipes-core/rauc/files/qemux86-64/system.conf deleted file mode 100644 index 44062374625ff24cbe34edb0c655cf433d62f2f3..0000000000000000000000000000000000000000 --- a/meta-oniro-core/recipes-core/rauc/files/qemux86-64/system.conf +++ /dev/null @@ -1,39 +0,0 @@ -# SPDX-FileCopyrightText: Huawei Inc. -# -# SPDX-License-Identifier: Apache-2.0 - -[system] -compatible=QEMU x86-64 -# Use the custom boot loader backend. The handler program is set in the -# [handlers] section below. This loops in SystemOTA into the update process and -# delegates slot status and slot active flag responsibilities to it. -bootloader=custom -# Keep the RAUC status file in the system data partition, in a directory that -# is common across revisions of the operating system. In other words, this file -# is explicitly exempt from the A/B update process. -statusfile=/run/mount/sysdata/common/status.raucs - -# Description of A/B slots used on QEMU. -# Refer to meta-oniro-core/wic/x-gpt-efi-disk.wks.in for details. -[slot.system.0] -device=/dev/sda2 -bootname=A - -[slot.system.1] -device=/dev/sda3 -bootname=B - -[keyring] -path=/etc/rauc/oniro-insecure-cert.pem - -[handlers] -# Use SystemOTA for RAUC pre-install and post-install handlers. This is -# required for correct operation of the custom boot backend as well as for the -# operation of the state management handlers as provided by SystemOTA. -pre-install=/usr/libexec/sysota/rauc-pre-install-handler -post-install=/usr/libexec/sysota/rauc-post-install-handler - -# Use SystemOTA to implement the custom RAUC boot backend. On platforms where -# RAUC manages the boot loader directly remove this line and set the correct -# bootloader= in the [system] section. -bootloader-custom-backend=/usr/libexec/sysota/rauc-custom-boot-handler diff --git a/meta-oniro-core/recipes-core/rauc/files/raspberrypi4/system.conf b/meta-oniro-core/recipes-core/rauc/files/raspberrypi4/system.conf deleted file mode 100644 index 8ffc203668a9d267317faaf79a683e2e9ec0999f..0000000000000000000000000000000000000000 --- a/meta-oniro-core/recipes-core/rauc/files/raspberrypi4/system.conf +++ /dev/null @@ -1,39 +0,0 @@ -# SPDX-FileCopyrightText: Huawei Inc. -# -# SPDX-License-Identifier: Apache-2.0 - -[system] -compatible=Raspberry Pi 4 -# Use the custom boot loader backend. The handler program is set in the -# [handlers] section below. This loops in SystemOTA into the update process and -# delegates slot status and slot active flag responsibilities to it. -bootloader=custom -# Keep the RAUC status file in the system data partition, in a directory that -# is common across revisions of the operating system. In other words, this file -# is explicitly exempt from the A/B update process. -statusfile=/run/mount/sysdata/common/status.raucs - -# Description of A/B slots used on the Raspberry Pi 4. -# Refer to meta-oniro-core/wic/x-raspberrypi.wks.in for details. -[slot.system.0] -device=/dev/mmcblk0p2 -bootname=A - -[slot.system.1] -device=/dev/mmcblk0p3 -bootname=B - -[keyring] -path=/etc/rauc/oniro-insecure-cert.pem - -[handlers] -# Use SystemOTA for RAUC pre-install and post-install handlers. This is -# required for correct operation of the custom boot backend as well as for the -# operation of the state management handlers as provided by SystemOTA. -pre-install=/usr/libexec/sysota/rauc-pre-install-handler -post-install=/usr/libexec/sysota/rauc-post-install-handler - -# Use SystemOTA to implement the custom RAUC boot backend. On platforms where -# RAUC manages the boot loader directly remove this line and set the correct -# bootloader= in the [system] section. -bootloader-custom-backend=/usr/libexec/sysota/rauc-custom-boot-handler diff --git a/meta-oniro-core/recipes-core/rauc/files/qemux86/system.conf b/meta-oniro-core/recipes-core/rauc/files/system.conf.in similarity index 89% rename from meta-oniro-core/recipes-core/rauc/files/qemux86/system.conf rename to meta-oniro-core/recipes-core/rauc/files/system.conf.in index 380b9b35a2e4079f0ec17e7f2c063b76605bb412..00da80c93b3fe7ff3e78f4308460a6a512fc08ae 100644 --- a/meta-oniro-core/recipes-core/rauc/files/qemux86/system.conf +++ b/meta-oniro-core/recipes-core/rauc/files/system.conf.in @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 [system] -compatible=QEMU x86 +compatible=@RAUC_COMPAT@ # Use the custom boot loader backend. The handler program is set in the # [handlers] section below. This loops in SystemOTA into the update process and # delegates slot status and slot active flag responsibilities to it. @@ -13,14 +13,13 @@ bootloader=custom # is explicitly exempt from the A/B update process. statusfile=/run/mount/sysdata/common/status.raucs -# Description of A/B slots used on QEMU. -# Refer to meta-oniro-core/wic/x-gpt-efi-disk.wks.in for details. +# Description of A/B slots used by the system. [slot.system.0] -device=/dev/sda2 +device=@RAUC_SLOT_A@ bootname=A [slot.system.1] -device=/dev/sda3 +device=@RAUC_SLOT_B@ bootname=B [keyring] diff --git a/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend b/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend index 0e3553e0ba08a915fd6ad2456b332dc7cfb6603d..ce1b8f9eb2aceebf04f63a28c0fff25803b5a4b7 100644 --- a/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend +++ b/meta-oniro-core/recipes-core/rauc/rauc_%.bbappend @@ -2,20 +2,43 @@ # # SPDX-License-Identifier: Apache-2.0 -# For specific MACHINE configurations, provide a pre-baked RAUC system config -# file. This confi file must be paired with equally tailored SystemOTA config -# file. +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# Make the RAUC package machine-specific. This lets us put the specific configuration +# file, which encodes the slot configuration, into it safely. +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Generate RAUC's system.conf configuration file and place it in the workdir +# where it is picked up by the logic from rauc-target.inc. # # FIXME(zyga): The file defines RAUC compatible string which is technically # something that SystemOTA should be responsible for (make/model and remodel # operations). This should be addressed before re-model is supported. -FILESEXTRAPATHS:prepend:raspberrypi4-64 := "${THISDIR}/files/raspberrypi4:" -FILESEXTRAPATHS:prepend:qemux86 := "${THISDIR}/files/qemux86:" -FILESEXTRAPATHS:prepend:qemux86-64 := "${THISDIR}/files/qemux86-64:" +SRC_URI:append = " \ + file://system.conf.in \ + " + +# Define the slots and compatible strings for reference boards. +RAUC_COMPAT:raspberrypi4-64 := "Raspberry Pi 4" +RAUC_SLOT_A:raspberrypi4-64 := "/dev/mmcblk0p2" +RAUC_SLOT_B:raspberrypi4-64 := "/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" + +do_install:prepend() { + sed \ + -e 's,@RAUC_COMPAT@,${RAUC_COMPAT},g' \ + -e 's,@RAUC_SLOT_A@,${RAUC_SLOT_A},g' \ + -e 's,@RAUC_SLOT_B@,${RAUC_SLOT_B},g' \ + <"${WORKDIR}/system.conf.in" >"${WORKDIR}/system.conf" +} -# Make the RAUC package machine-specific. This lets us put the specific configuration -# file, which encodes the slot configuration, into it safely. -PACKAGE_ARCH = "${MACHINE_ARCH}" # Use the known insecure public key which is a part of this layer as the key # baked into our reference images. @@ -38,7 +61,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" # key. This variable is also set up to append to SRC_URI, so no additional # declaration is needed. RAUC_KEYRING_FILE ?= "oniro-insecure-cert.pem" -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" do_install:append() { if [ -f ${D}${sysconfdir}/rauc/oniro-insecure-cert.pem ]; then