Skip to content
Snippets Groups Projects
Commit 9b934c57 authored by Zygmunt Krynicki's avatar Zygmunt Krynicki
Browse files

rauc: generate RAUC configuration file from template


As we add support for additional boards, doing it by copying and
modifying a file with relatively few parts changing got tedious.

The change adds three new variables - RAUC_{COMPAT,SLOT_A,SLOT_B},
and defines them for the boards supported thus far.

Signed-off-by: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
parent 1c6af91d
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !77. Comments created here will be created in the context of that merge request.
# 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
# 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
......@@ -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]
......
......@@ -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
......
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