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

sysota: 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 half a dozen new variables for selecting the boot loader
type, various strings and directories. The defaults are safe, even if
unused, for all kinds of boards. The machine-specific overrides tune the
bootloader used by each board and provide proper identification strings.

Signed-off-by: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
parent fb7aac54
No related branches found
No related tags found
1 merge request!79sysota: generate RAUC configuration file from template
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
[OTA]
BootLoaderType=GRUB
BootPartitionMountDir=/run/mount/boot
[GRUB]
EnvPath=/run/mount/boot/EFI/BOOT/grubenv
[Device]
Maker=Oniro Project
Model=QEMU Virtual Machine
[Compatible]
Machine=qemux86
[Quirks]
RebootDelay=180
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
[OTA]
BootLoaderType=pi-boot
BootPartitionMountDir=/run/mount/boot
[Device]
Maker=Oniro Project
Model=Raspberry Pi 4B
[Compatible]
Machine=raspberrypi4-64
[Quirks]
RebootDelay=180
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
[OTA]
BootLoaderType=inert
[Device]
Maker=Oniro Project
Model=Reference Device
...@@ -3,18 +3,18 @@ ...@@ -3,18 +3,18 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
[OTA] [OTA]
BootLoaderType=GRUB BootLoaderType=@SYSOTA_BOOTLOADER_TYPE@
BootPartitionMountDir=/run/mount/boot BootPartitionMountDir=@SYSOTA_BOOT_PARTITION_MOUNT_DIR@
[GRUB]
EnvPath=/run/mount/boot/EFI/BOOT/grubenv
[Device] [Device]
Maker=Oniro Project Maker=@SYSOTA_MAKER@
Model=QEMU Virtual Machine Model=@SYSOTA_MODEL@
[GRUB]
EnvPath=@SYSOTA_GRUB_ENV_PATH@
[Compatible] [Compatible]
Machine=qemux86-64 Machine=@SYSOTA_COMPAT_MACHINE@
[Quirks] [Quirks]
RebootDelay=180 RebootDelay=@SYSOTA_QUIRK_REBOOT_DELAY@
...@@ -7,7 +7,7 @@ LICENSE = "Apache-2.0" ...@@ -7,7 +7,7 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSES/Apache-2.0.txt;md5=c846ebb396f8b174b10ded4771514fcc" LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSES/Apache-2.0.txt;md5=c846ebb396f8b174b10ded4771514fcc"
SRC_URI = "git://gitlab.eclipse.org/eclipse/oniro-core/sysota.git;protocol=https;branch=main \ SRC_URI = "git://gitlab.eclipse.org/eclipse/oniro-core/sysota.git;protocol=https;branch=main \
file://sysotad.conf \ file://sysotad.conf.in \
" "
SRCREV = "4fc590e1d329aa9e05e64ae3a15d91481aa86e1d" SRCREV = "4fc590e1d329aa9e05e64ae3a15d91481aa86e1d"
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
...@@ -88,6 +88,38 @@ do_compile:append() { ...@@ -88,6 +88,38 @@ do_compile:append() {
do_compile[network] = "1" do_compile[network] = "1"
# Generate sysotad.conf configuration file based on several variables.
SYSOTA_BOOTLOADER_TYPE ?= "inert"
SYSOTA_BOOT_PARTITION_MOUNT_DIR ?= "/run/mount/boot"
SYSOTA_MAKER ?= "Oniro Project"
SYSOTA_MODEL ?= "Reference Device"
SYSOTA_GRUB_ENV_PATH ?= "/run/mount/boot/EFI/BOOT/grubenv"
SYSOTA_COMPAT_MACHINE ?= "${MACHINE}"
SYSOTA_QUIRK_REBOOT_DELAY ?= "180"
# Define machine-specific configuration overrides.
SYSOTA_MODEL:raspberrypi4-64 := "Raspberry Pi 4B"
SYSOTA_BOOTLOADER_TYPE:raspberrypi4-64 := "pi-boot"
SYSOTA_MODEL:qemux86 := "QEMU Virtual Machine"
SYSOTA_BOOTLOADER_TYPE:qemux86 := "GRUB"
SYSOTA_MODEL:qemux86-64 := "QEMU Virtual Machine"
SYSOTA_BOOTLOADER_TYPE:qemux86-64 := "GRUB"
do_install:prepend() {
sed \
-e 's,@SYSOTA_BOOTLOADER_TYPE@,${SYSOTA_BOOTLOADER_TYPE},g' \
-e 's,@SYSOTA_BOOT_PARTITION_MOUNT_DIR@,${SYSOTA_BOOT_PARTITION_MOUNT_DIR},g' \
-e 's,@SYSOTA_MAKER@,${SYSOTA_MAKER},g' \
-e 's,@SYSOTA_MODEL@,${SYSOTA_MODEL},g' \
-e 's,@SYSOTA_GRUB_ENV_PATH@,${SYSOTA_GRUB_ENV_PATH},g' \
-e 's,@SYSOTA_COMPAT_MACHINE@,${SYSOTA_COMPAT_MACHINE},g' \
-e 's,@SYSOTA_QUIRK_REBOOT_DELAY@,${SYSOTA_QUIRK_REBOOT_DELAY},g' \
<"${WORKDIR}/sysotad.conf.in" >"${WORKDIR}/sysotad.conf"
}
do_install:append() { do_install:append() {
oe_runmake -C ${B}/make-build --warn-undefined-variables install DESTDIR=${D} oe_runmake -C ${B}/make-build --warn-undefined-variables install DESTDIR=${D}
...@@ -115,10 +147,6 @@ RDEPENDS:${PN}-dev += "bash" ...@@ -115,10 +147,6 @@ RDEPENDS:${PN}-dev += "bash"
REQUIRED_DISTRO_FEATURES = "systemd" REQUIRED_DISTRO_FEATURES = "systemd"
SYSTEMD_SERVICE:${PN} = "sysotad.service" SYSTEMD_SERVICE:${PN} = "sysotad.service"
# Specific MACHINE configurations have sysotad.conf which provides the right
# settings, like the boot loader type.
FILESEXTRAPATHS:prepend:raspberrypi4-64 := "${THISDIR}/files/raspberrypi4:"
# Make the SystemOTA package machine-specific. This lets us put the specific # Make the SystemOTA package machine-specific. This lets us put the specific
# configuration file, which encodes boot loader type, into it safely. # configuration file, which encodes boot loader type, into it safely.
PACKAGE_ARCH = "${MACHINE_ARCH}" PACKAGE_ARCH = "${MACHINE_ARCH}"
......
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