diff --git a/meta-oniro-core/recipes-core/sysota/files/qemux86-64/sysotad.conf b/meta-oniro-core/recipes-core/sysota/files/qemux86-64/sysotad.conf deleted file mode 100644 index 0488748f3dde8d96144cf469fefdc02d2d607326..0000000000000000000000000000000000000000 --- a/meta-oniro-core/recipes-core/sysota/files/qemux86-64/sysotad.conf +++ /dev/null @@ -1,20 +0,0 @@ -# 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-64 - -[Quirks] -RebootDelay=180 diff --git a/meta-oniro-core/recipes-core/sysota/files/qemux86/sysotad.conf b/meta-oniro-core/recipes-core/sysota/files/qemux86/sysotad.conf deleted file mode 100644 index e45d53558616b12b7c99bd8d2d840672b6d74fe0..0000000000000000000000000000000000000000 --- a/meta-oniro-core/recipes-core/sysota/files/qemux86/sysotad.conf +++ /dev/null @@ -1,20 +0,0 @@ -# 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 diff --git a/meta-oniro-core/recipes-core/sysota/files/raspberrypi4/sysotad.conf b/meta-oniro-core/recipes-core/sysota/files/raspberrypi4/sysotad.conf deleted file mode 100644 index dadd6a71cc6c000e99454bb4f1230976d53f1b4d..0000000000000000000000000000000000000000 --- a/meta-oniro-core/recipes-core/sysota/files/raspberrypi4/sysotad.conf +++ /dev/null @@ -1,17 +0,0 @@ -# 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 diff --git a/meta-oniro-core/recipes-core/sysota/files/sysotad.conf b/meta-oniro-core/recipes-core/sysota/files/sysotad.conf index ca1a87de62331953654e578180b2f916cb63858a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/meta-oniro-core/recipes-core/sysota/files/sysotad.conf +++ b/meta-oniro-core/recipes-core/sysota/files/sysotad.conf @@ -1,10 +0,0 @@ -# SPDX-FileCopyrightText: Huawei Inc. -# -# SPDX-License-Identifier: Apache-2.0 - -[OTA] -BootLoaderType=inert - -[Device] -Maker=Oniro Project -Model=Reference Device diff --git a/meta-oniro-core/recipes-core/sysota/files/sysotad.conf.in b/meta-oniro-core/recipes-core/sysota/files/sysotad.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..a4d0c62e80e28298885bba710a46bd987e7ece43 --- /dev/null +++ b/meta-oniro-core/recipes-core/sysota/files/sysotad.conf.in @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +[OTA] +BootLoaderType=@SYSOTA_BOOTLOADER_TYPE@ +BootPartitionMountDir=@SYSOTA_BOOT_PARTITION_MOUNT_DIR@ + +[Device] +Maker=@SYSOTA_MAKER@ +Model=@SYSOTA_MODEL@ + +[GRUB] +EnvPath=@SYSOTA_GRUB_ENV_PATH@ + +[Compatible] +Machine=@SYSOTA_COMPAT_MACHINE@ + +[Quirks] +RebootDelay=@SYSOTA_QUIRK_REBOOT_DELAY@ diff --git a/meta-oniro-core/recipes-core/sysota/sysota_git.bb b/meta-oniro-core/recipes-core/sysota/sysota_git.bb index 41802ffadf22f1112a8f0bdf5a6024fb79e879a2..fe324aaf91ca433df7e89def634d6c7e40d0c20b 100644 --- a/meta-oniro-core/recipes-core/sysota/sysota_git.bb +++ b/meta-oniro-core/recipes-core/sysota/sysota_git.bb @@ -7,7 +7,7 @@ LICENSE = "Apache-2.0" 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 \ - file://sysotad.conf \ + file://sysotad.conf.in \ " SRCREV = "4fc590e1d329aa9e05e64ae3a15d91481aa86e1d" S = "${WORKDIR}/git" @@ -88,6 +88,38 @@ do_compile:append() { 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() { oe_runmake -C ${B}/make-build --warn-undefined-variables install DESTDIR=${D} @@ -115,10 +147,6 @@ RDEPENDS:${PN}-dev += "bash" REQUIRED_DISTRO_FEATURES = "systemd" 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 # configuration file, which encodes boot loader type, into it safely. PACKAGE_ARCH = "${MACHINE_ARCH}"