Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
- Loading branch information
1 parent
3a5d619
commit a92433f
Showing
8 changed files
with
307 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
182 changes: 182 additions & 0 deletions
182
patches/cip-core/v2-0001-Add-option-to-use-swupdate-handler-roundrobin.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
From 943f2156a077f462d73cf3ceae95ae7a43122b81 Mon Sep 17 00:00:00 2001 | ||
From: Quirin Gylstorff <quirin.gylstorff@siemens.com> | ||
Date: Wed, 28 Apr 2021 16:45:51 +0200 | ||
Subject: [cip-dev][isar-cip-core][RFC v2] Add option to use | ||
swupdate-handler-roundrobin | ||
|
||
The new swupdate round robin handler is available under[1]. | ||
Add the Option `SWUPDATE_USE_ROUND_ROBIN_HANDLER_REPO` to | ||
use the handler directly from the repository. | ||
|
||
The handler currently doesn't support secureboot. | ||
|
||
[1]:https://gitlab.com/cip-playground/swupdate-handler-roundrobin/ | ||
|
||
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> | ||
--- | ||
classes/swupdate-config.bbclass | 12 ++++++--- | ||
kas/opt/ebg-secure-boot-base.yml | 3 +++ | ||
.../files/secure-boot/sw-description.tmpl | 2 +- | ||
recipes-core/images/files/sw-description.tmpl | 21 ++++++++++----- | ||
.../files/swupdate.handler.efibootguard.ini | 26 +++++++++++++++++++ | ||
recipes-core/swupdate/swupdate.bb | 9 ++++++- | ||
6 files changed, 62 insertions(+), 11 deletions(-) | ||
create mode 100644 recipes-core/swupdate/files/swupdate.handler.efibootguard.ini | ||
|
||
diff --git a/classes/swupdate-config.bbclass b/classes/swupdate-config.bbclass | ||
index 4e46b37..a7a7aa4 100644 | ||
--- a/classes/swupdate-config.bbclass | ||
+++ b/classes/swupdate-config.bbclass | ||
@@ -21,9 +21,17 @@ KFEATURE_lua = "" | ||
KFEATURE_lua[BUILD_DEB_DEPENDS] = "liblua5.3-dev" | ||
KFEATURE_lua[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_lua.snippet" | ||
|
||
+SWUPDATE_USE_ROUND_ROBIN_HANDLER_REPO ?= "1" | ||
+ | ||
+SRC_URI_append = " ${@ 'git://gitlab.com/cip-playground/swupdate-handler-roundrobin.git;protocol=https;destsuffix=swupdate-handler-roundrobin;name=swupdate-handler-roundrobin' \ | ||
+ if d.getVar('SWUPDATE_USE_ROUND_ROBIN_HANDLER_REPO') == '1' else '' \ | ||
+ }" | ||
+SRCREV_swupdate-handler-roundrobin ?= "6ac9e49eaa4e866a3eda12eee3a223820ba8e0bf" | ||
+SWUPDATE_LUASCRIPT ?= "swupdate-handler-roundrobin/swupdate_handlers_roundrobin.lua" | ||
KFEATURE_luahandler = "" | ||
KFEATURE_luahandler[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_luahandler.snippet" | ||
-KFEATURE_luahandler[SRC_URI] = "file://${SWUPDATE_LUASCRIPT}" | ||
+KFEATURE_luahandler[SRC_URI] = "${@ 'file://${SWUPDATE_LUASCRIPT}' \ | ||
+ if d.getVar('SWUPDATE_USE_ROUND_ROBIN_HANDLER_REPO') == '0' else '' }" | ||
|
||
KFEATURE_DEPS = "" | ||
KFEATURE_DEPS[luahandler] = "lua" | ||
@@ -57,8 +65,6 @@ KFEATURE_u-boot[DEBIAN_DEPENDS] = "${@ 'libubootenv0.1, u-boot-${MACHINE}-config | ||
KFEATURE_u-boot[DEPENDS] = "libubootenv" | ||
KFEATURE_u-boot[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_u-boot.snippet" | ||
|
||
-SWUPDATE_LUASCRIPT ?= "swupdate_handlers.lua" | ||
- | ||
def get_bootloader_featureset(d): | ||
bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "" | ||
if bootloader == "efibootguard": | ||
diff --git a/kas/opt/ebg-secure-boot-base.yml b/kas/opt/ebg-secure-boot-base.yml | ||
index 30ca35a..484d0e5 100644 | ||
--- a/kas/opt/ebg-secure-boot-base.yml | ||
+++ b/kas/opt/ebg-secure-boot-base.yml | ||
@@ -16,3 +16,6 @@ local_conf_header: | ||
initramfs: | | ||
IMAGE_INSTALL += "initramfs-abrootfs-secureboot" | ||
SWU_DESCRIPTION = "secureboot" | ||
+ swupdate-secureboot: | | ||
+ SWUPDATE_USE_ROUND_ROBIN_HANDLER_REPO = "0" | ||
+ SWUPDATE_LUASCRIPT = "swupdate_handler.efibootguard.secureboot.lua" | ||
diff --git a/recipes-core/images/files/secure-boot/sw-description.tmpl b/recipes-core/images/files/secure-boot/sw-description.tmpl | ||
index bce97d0..897d819 100644 | ||
--- a/recipes-core/images/files/secure-boot/sw-description.tmpl | ||
+++ b/recipes-core/images/files/secure-boot/sw-description.tmpl | ||
@@ -16,7 +16,7 @@ software = | ||
filename = "${ROOTFS_PARTITION_NAME}"; | ||
device = "fedcba98-7654-3210-cafe-5e0710000001,fedcba98-7654-3210-cafe-5e0710000002"; | ||
type = "roundrobin"; | ||
- compressed = "true"; | ||
+ compressed = "zlib"; | ||
filesystem = "ext4"; | ||
}); | ||
files: ({ | ||
diff --git a/recipes-core/images/files/sw-description.tmpl b/recipes-core/images/files/sw-description.tmpl | ||
index bb34088..3309271 100644 | ||
--- a/recipes-core/images/files/sw-description.tmpl | ||
+++ b/recipes-core/images/files/sw-description.tmpl | ||
@@ -16,21 +16,30 @@ software = | ||
filename = "${ROOTFS_PARTITION_NAME}"; | ||
device = "fedcba98-7654-3210-cafe-5e0710000001,fedcba98-7654-3210-cafe-5e0710000002"; | ||
type = "roundrobin"; | ||
- compressed = "true"; | ||
+ compressed = "zlib"; | ||
filesystem = "ext4"; | ||
+ properties: { | ||
+ subtype = "image"; | ||
+ }; | ||
}); | ||
files: ({ | ||
filename = "${KERNEL_IMAGE}"; | ||
path = "vmlinuz"; | ||
- type = "kernelfile"; | ||
- device = "sda2,sda3"; | ||
+ type = "roundrobin"; | ||
+ device = "fedcba98-7654-3210-cafe-5e0710000001->sda2,fedcba98-7654-3210-cafe-5e0710000002->sda3"; | ||
filesystem = "vfat"; | ||
+ properties: { | ||
+ subtype = "kernel"; | ||
+ }; | ||
}, | ||
{ | ||
filename = "${INITRD_IMAGE}"; | ||
- path = "initrd.img"; | ||
- type = "kernelfile"; | ||
- device = "sda2,sda3"; | ||
+ path = "${INITRD_IMAGE}"; | ||
+ type = "roundrobin"; | ||
+ device = "fedcba98-7654-3210-cafe-5e0710000001->sda2,fedcba98-7654-3210-cafe-5e0710000002->sda3"; | ||
filesystem = "vfat"; | ||
+ properties: { | ||
+ subtype = "initrd"; | ||
+ }; | ||
}); | ||
} | ||
diff --git a/recipes-core/swupdate/files/swupdate.handler.efibootguard.ini b/recipes-core/swupdate/files/swupdate.handler.efibootguard.ini | ||
new file mode 100644 | ||
index 0000000..3aee76c | ||
--- /dev/null | ||
+++ b/recipes-core/swupdate/files/swupdate.handler.efibootguard.ini | ||
@@ -0,0 +1,26 @@ | ||
+[image] | ||
+chainhandler=raw | ||
+ | ||
+[image.selector] | ||
+method=cmdline_rr | ||
+key=root | ||
+ | ||
+[image.bootenv] | ||
+kernelparams=root=PARTUUID=${rrtarget} ${cmdline_root} | ||
+ | ||
+[kernel] | ||
+chainhandler=rawfile | ||
+ | ||
+[kernel.selector] | ||
+method=cmdline_rrmap | ||
+key=root | ||
+ | ||
+[kernel.bootenv] | ||
+kernelfile=C:BOOT${rrindex}:vmlinuz | ||
+ | ||
+[initrd] | ||
+chainhandler=rawfile | ||
+ | ||
+[initrd.selector] | ||
+method=cmdline_rrmap | ||
+key=root | ||
diff --git a/recipes-core/swupdate/swupdate.bb b/recipes-core/swupdate/swupdate.bb | ||
index 526c72f..60e0772 100644 | ||
--- a/recipes-core/swupdate/swupdate.bb | ||
+++ b/recipes-core/swupdate/swupdate.bb | ||
@@ -29,6 +29,7 @@ DEBIAN_DEPENDS = "${shlibs:Depends}, ${misc:Depends}" | ||
inherit dpkg | ||
inherit swupdate-config | ||
|
||
+SRC_URI += "file://swupdate.handler.${SWUPDATE_BOOTLOADER}.ini" | ||
KFEATURES += "luahandler" | ||
|
||
S = "${WORKDIR}/git" | ||
@@ -46,5 +47,11 @@ do_prepare_build() { | ||
echo "configs/${DEFCONFIG}" >> ${S}/.gitignore | ||
fi | ||
# luahandler | ||
- install -m 0644 ${WORKDIR}/${SWUPDATE_LUASCRIPT} ${S} | ||
+ if [ -e ${WORKDIR}/${SWUPDATE_LUASCRIPT} ]; then | ||
+ install -m 0644 ${WORKDIR}/${SWUPDATE_LUASCRIPT} ${S}/swupdate_handlers.lua | ||
+ fi | ||
+ if [ -e ${WORKDIR}/swupdate.handler.${SWUPDATE_BOOTLOADER}.ini ]; then | ||
+ install -m 0644 ${WORKDIR}/swupdate.handler.${SWUPDATE_BOOTLOADER}.ini ${S}/swupdate.handler.ini | ||
+ echo "swupdate.handler.ini etc/" >> ${S}/debian/swupdate.install | ||
+ fi | ||
} | ||
-- | ||
2.20.1 | ||
|
104 changes: 104 additions & 0 deletions
104
patches/cip-core/v3-0001-swupdate-config-add-prefix-to-variables.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
From 8e7245731a2e17c12b9d21835beef2c43127114b Mon Sep 17 00:00:00 2001 | ||
From: Quirin Gylstorff <quirin.gylstorff@siemens.com> | ||
Date: Mon, 12 Apr 2021 11:56:21 +0200 | ||
Subject: [cip-dev][isar-cip-core][PATCH v3] swupdate-config: add prefix to | ||
variables | ||
|
||
The variables U_BOOT and BOOTLOADER are only used for swupdate. | ||
Add the prefix SWUPDATE to indicate the intended usage. | ||
|
||
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> | ||
--- | ||
classes/swupdate-config.bbclass | 11 ++++++----- | ||
kas/opt/ebg-secure-boot-snakeoil.yml | 2 +- | ||
kas/opt/ebg-swu.yml | 4 ++-- | ||
kas/opt/qemu-swupdate.yml | 2 +- | ||
4 files changed, 10 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/classes/swupdate-config.bbclass b/classes/swupdate-config.bbclass | ||
index 9909113..8aa6b90 100644 | ||
--- a/classes/swupdate-config.bbclass | ||
+++ b/classes/swupdate-config.bbclass | ||
@@ -45,19 +45,20 @@ KFEATURE_ubi[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_ubi.snippet" | ||
|
||
KFEATURE_DEPS[ubi] = "mtd" | ||
|
||
+SWUPDATE_U_BOOT ?= "u-boot-${MACHINE}" | ||
USE_U_BOOT_CONFIG ?= "true" | ||
KFEATURE_u-boot = "" | ||
KFEATURE_u-boot[BUILD_DEB_DEPENDS] = "libubootenv-dev" | ||
KFEATURE_u-boot[DEBIAN_DEPENDS] = "${@ 'libubootenv0.1, u-boot-${MACHINE}-config' \ | ||
if d.getVar("USE_U_BOOT_CONFIG", True) == "true" \ | ||
else 'libubootenv0.1'}" | ||
-KFEATURE_u-boot[DEPENDS] = "${U_BOOT} libubootenv" | ||
+KFEATURE_u-boot[DEPENDS] = "${SWUPDATE_U_BOOT} libubootenv" | ||
KFEATURE_u-boot[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_u-boot.snippet" | ||
|
||
SWUPDATE_LUASCRIPT ?= "swupdate_handlers.lua" | ||
|
||
def get_bootloader_featureset(d): | ||
- bootloader = d.getVar("BOOTLOADER", True) or "" | ||
+ bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "" | ||
if bootloader == "efibootguard": | ||
return "efibootguard" | ||
if bootloader == "u-boot": | ||
@@ -68,11 +69,11 @@ SWUPDATE_KFEATURES ??= "" | ||
KFEATURES = "${SWUPDATE_KFEATURES}" | ||
KFEATURES += "${@get_bootloader_featureset(d)}" | ||
|
||
-# Astonishingly, as an anonymous python function, BOOTLOADER is always None | ||
+# Astonishingly, as an anonymous python function, SWUPDATE_BOOTLOADER is always None | ||
# one time before it gets set. So the following must be a task. | ||
python do_check_bootloader () { | ||
- bootloader = d.getVar("BOOTLOADER", True) or "None" | ||
+ bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "None" | ||
if not bootloader in ["efibootguard", "u-boot"]: | ||
- bb.warn("swupdate: BOOTLOADER set to incompatible value: " + bootloader) | ||
+ bb.warn("swupdate: SWUPDATE_BOOTLOADER set to incompatible value: " + bootloader) | ||
} | ||
addtask check_bootloader before do_fetch | ||
diff --git a/kas/opt/ebg-secure-boot-snakeoil.yml b/kas/opt/ebg-secure-boot-snakeoil.yml | ||
index 8a72084..c0ed1a2 100644 | ||
--- a/kas/opt/ebg-secure-boot-snakeoil.yml | ||
+++ b/kas/opt/ebg-secure-boot-snakeoil.yml | ||
@@ -20,7 +20,7 @@ local_conf_header: | ||
# Add snakeoil and ovmf binaries for qemu | ||
IMAGER_BUILD_DEPS += "ebg-secure-boot-snakeoil ovmf-binaries" | ||
IMAGER_INSTALL += "ebg-secure-boot-snakeoil" | ||
- WKS_FILE = "${MACHINE}-${BOOTLOADER}-secureboot.wks" | ||
+ WKS_FILE = "${MACHINE}-efibootguard-secureboot.wks" | ||
|
||
ovmf: | | ||
# snakeoil certs are only part of backports | ||
diff --git a/kas/opt/ebg-swu.yml b/kas/opt/ebg-swu.yml | ||
index aa3aed1..63dda09 100644 | ||
--- a/kas/opt/ebg-swu.yml | ||
+++ b/kas/opt/ebg-swu.yml | ||
@@ -15,7 +15,7 @@ header: | ||
local_conf_header: | ||
swupdate: | | ||
IMAGE_INSTALL_append = " swupdate efibootguard" | ||
- BOOTLOADER = "efibootguard" | ||
+ SWUPDATE_BOOTLOADER = "efibootguard" | ||
|
||
efibootguard: | | ||
WDOG_TIMEOUT = "0" | ||
@@ -23,4 +23,4 @@ local_conf_header: | ||
|
||
wic: | | ||
IMAGE_TYPE = "wic-swu-img" | ||
- WKS_FILE ?= "${MACHINE}-${BOOTLOADER}.wks" | ||
+ WKS_FILE ?= "${MACHINE}-${SWUPDATE_BOOTLOADER}.wks" | ||
diff --git a/kas/opt/qemu-swupdate.yml b/kas/opt/qemu-swupdate.yml | ||
index 3f5fedf..daebd2c 100644 | ||
--- a/kas/opt/qemu-swupdate.yml | ||
+++ b/kas/opt/qemu-swupdate.yml | ||
@@ -16,4 +16,4 @@ header: | ||
local_conf_header: | ||
qemu-wic: | | ||
IMAGE_TYPE ?= "wic-swu-img" | ||
- WKS_FILE = "qemu-amd64-${BOOTLOADER}.wks" | ||
+ WKS_FILE = "qemu-amd64-${SWUPDATE_BOOTLOADER}.wks" | ||
-- | ||
2.20.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[image] | ||
chainhandler=raw | ||
|
||
[image.selector] | ||
method=cmdline_rr | ||
key=root | ||
|
||
[image.bootenv] | ||
ustate=1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
swupdate usr/bin | ||
swupdate.cfg /etc | ||
swupdate.handler.ini /etc | ||
swupdate.cfg etc | ||
swupdate_handlers.lua /usr/share/lua/5.3 | ||
acknowledge_update.sh usr/bin | ||
swupdate.handler.ini etc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters