Message ID | 20211005141346.2682677-3-Quirin.Gylstorff@siemens.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | Use SWUpdate from salsa.debian.org | expand |
On 05.10.21 16:13, Q. Gylstorff wrote: > From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > > This reduce the maintaince effort for SWUpdate in Debian 11(Bullseye) > and later. > > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > --- > conf/distro/cip-core-bullseye.conf | 1 + > conf/distro/cip-core-buster.conf | 1 + > ...dd-option-to-build-with-efibootguard.patch | 39 ++++++++++ > .../0002-debian-rules-Add-CONFIG_MTD.patch | 27 +++++++ > ...-debian-config-Make-signing-optional.patch | 40 +++++++++++ > ...onfig-Make-image-encryption-optional.patch | 40 +++++++++++ > ...ules-Add-Embedded-Lua-handler-option.patch | 30 ++++++++ > ...es-Add-option-to-disable-fs-creation.patch | 47 ++++++++++++ > ...ules-Add-option-to-disable-webserver.patch | 42 +++++++++++ > ...Make-CONFIG_HW_COMPATIBILTY-optional.patch | 40 +++++++++++ > ...ules-Add-Embedded-Lua-handler-option.patch | 30 ++++++++ > ...prepare-build-for-isar-debian-buster.patch | 72 +++++++++++++++++++ > recipes-core/swupdate/swupdate.inc | 54 ++++++++++++++ > .../swupdate/swupdate_2021.04-1+debian-gbp.bb | 47 ++++++++++++ > 14 files changed, 510 insertions(+) > create mode 100644 recipes-core/swupdate/files/0001-debian-Add-option-to-build-with-efibootguard.patch > create mode 100644 recipes-core/swupdate/files/0002-debian-rules-Add-CONFIG_MTD.patch > create mode 100644 recipes-core/swupdate/files/0003-debian-config-Make-signing-optional.patch > create mode 100644 recipes-core/swupdate/files/0004-debian-config-Make-image-encryption-optional.patch > create mode 100644 recipes-core/swupdate/files/0005-debian-rules-Add-Embedded-Lua-handler-option.patch > create mode 100644 recipes-core/swupdate/files/0005-debian-rules-Add-option-to-disable-fs-creation.patch > create mode 100644 recipes-core/swupdate/files/0006-debian-rules-Add-option-to-disable-webserver.patch > create mode 100644 recipes-core/swupdate/files/0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch > create mode 100644 recipes-core/swupdate/files/0008-debian-rules-Add-Embedded-Lua-handler-option.patch > create mode 100644 recipes-core/swupdate/files/0009-debian-prepare-build-for-isar-debian-buster.patch > create mode 100644 recipes-core/swupdate/swupdate.inc > create mode 100644 recipes-core/swupdate/swupdate_2021.04-1+debian-gbp.bb > > diff --git a/conf/distro/cip-core-bullseye.conf b/conf/distro/cip-core-bullseye.conf > index 38014b4..9357b6c 100644 > --- a/conf/distro/cip-core-bullseye.conf > +++ b/conf/distro/cip-core-bullseye.conf > @@ -14,3 +14,4 @@ require cip-core-common.inc > > PREFERRED_VERSION_linux-cip ?= "4.19.%" > PREFERRED_VERSION_linux-cip-rt ?= "4.19.%" > +PREFERRED_VERSION_swupdate ?= "2021.04-1+debian-gbp" > diff --git a/conf/distro/cip-core-buster.conf b/conf/distro/cip-core-buster.conf > index c5cb39c..61fcb41 100644 > --- a/conf/distro/cip-core-buster.conf > +++ b/conf/distro/cip-core-buster.conf > @@ -14,3 +14,4 @@ require cip-core-common.inc > > PREFERRED_VERSION_linux-cip ?= "4.19.%" > PREFERRED_VERSION_linux-cip-rt ?= "4.19.%" > +PREFERRED_VERSION_swupdate ?= "2021.4-git+isar" > diff --git a/recipes-core/swupdate/files/0001-debian-Add-option-to-build-with-efibootguard.patch b/recipes-core/swupdate/files/0001-debian-Add-option-to-build-with-efibootguard.patch > new file mode 100644 > index 0000000..00f9a5f > --- /dev/null > +++ b/recipes-core/swupdate/files/0001-debian-Add-option-to-build-with-efibootguard.patch > @@ -0,0 +1,39 @@ > +From fe3f090e3764e1e2625d509a56bd521bab507ce7 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Wed, 15 Sep 2021 12:36:09 +0200 > +Subject: [PATCH 1/9] debian: Add option to build with efibootguard > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/control | 1 + > + debian/rules | 2 ++ > + 2 files changed, 3 insertions(+) > + > +diff --git a/debian/control b/debian/control > +index 9e43eab..6031537 100644 > +--- a/debian/control > ++++ b/debian/control > +@@ -28,6 +28,7 @@ Build-Depends: debhelper-compat (= 13), > + libwebsockets-dev (>= 3.2.0) <!pkg.swupdate.bpo>, > + liburiparser-dev <!pkg.swupdate.bpo>, > + libubootenv-dev <pkg.swupdate.uboot>, > ++ efibootguard-dev <pkg.swupdate.efibootguard>, > + libcmocka-dev, > + pkg-config, > + gawk, > +diff --git a/debian/rules b/debian/rules > +index 4b55be2..c076839 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -33,6 +33,8 @@ ifneq (,$(filter pkg.swupdate.uboot,$(DEB_BUILD_PROFILES))) > + else ifneq (,$(filter pkg.swupdate.grub,$(DEB_BUILD_PROFILES))) > + echo CONFIG_BOOTLOADER_GRUB=y >> configs/debian_defconfig > + echo CONFIG_GRUBENV_PATH=\"/boot/grub/grubenv\" >> configs/debian_defconfig > ++else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_BOOTLOADER_EBG=y >> configs/debian_defconfig > + else > + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig > + endif > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0002-debian-rules-Add-CONFIG_MTD.patch b/recipes-core/swupdate/files/0002-debian-rules-Add-CONFIG_MTD.patch > new file mode 100644 > index 0000000..0921aef > --- /dev/null > +++ b/recipes-core/swupdate/files/0002-debian-rules-Add-CONFIG_MTD.patch > @@ -0,0 +1,27 @@ > +From 43365f98d70d83dac42913ff907a8a9dd25a4333 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Wed, 29 Sep 2021 11:29:57 +0200 > +Subject: [PATCH 2/9] debian/rules: Add CONFIG_MTD > + > +if pkg.swupdate.bpo is set CONFIG_MTD is disable but not enabled. > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/rules | 1 + > + 1 file changed, 1 insertion(+) > + > +diff --git a/debian/rules b/debian/rules > +index c076839..292133b 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -20,6 +20,7 @@ endif > + override_dh_auto_configure: > + cp debian/configs/defconfig configs/debian_defconfig > + ifeq (,$(filter pkg.swupdate.bpo,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_MTD=y >> configs/debian_defconfig > + echo CONFIG_SWUFORWARDER_HANDLER=y >> configs/debian_defconfig > + echo CONFIG_CFI=y >> configs/debian_defconfig > + echo CONFIG_CFIHAMMING1=y >> configs/debian_defconfig > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0003-debian-config-Make-signing-optional.patch b/recipes-core/swupdate/files/0003-debian-config-Make-signing-optional.patch > new file mode 100644 > index 0000000..347b316 > --- /dev/null > +++ b/recipes-core/swupdate/files/0003-debian-config-Make-signing-optional.patch > @@ -0,0 +1,40 @@ > +From 37f9afeeac5483f677b5be41b3d31e6557fcc146 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Wed, 29 Sep 2021 15:27:51 +0200 > +Subject: [PATCH 3/9] debian/config: Make signing optional > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/configs/defconfig | 1 - > + debian/rules | 3 +++ > + 2 files changed, 3 insertions(+), 1 deletion(-) > + > +diff --git a/debian/configs/defconfig b/debian/configs/defconfig > +index b38aa62..f959e44 100644 > +--- a/debian/configs/defconfig > ++++ b/debian/configs/defconfig > +@@ -2,7 +2,6 @@ CONFIG_SYSTEMD=y > + CONFIG_HW_COMPATIBILITY=y > + CONFIG_DOWNLOAD=y > + CONFIG_DOWNLOAD_SSL=y > +-CONFIG_SIGNED_IMAGES=y > + CONFIG_SIGALG_CMS=y > + CONFIG_ENCRYPTED_IMAGES=y > + CONFIG_SURICATTA=y > +diff --git a/debian/rules b/debian/rules > +index 292133b..4793c84 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -39,6 +39,9 @@ else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) > + else > + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig > + endif > ++ifeq (,$(filter pkg.swupdate.nosigning,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_SIGNED_IMAGES=y >> configs/debian_defconfig > ++endif > + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES))) > + echo CONFIG_PKCS11=y >> configs/debian_defconfig > + endif > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0004-debian-config-Make-image-encryption-optional.patch b/recipes-core/swupdate/files/0004-debian-config-Make-image-encryption-optional.patch > new file mode 100644 > index 0000000..45990f8 > --- /dev/null > +++ b/recipes-core/swupdate/files/0004-debian-config-Make-image-encryption-optional.patch > @@ -0,0 +1,40 @@ > +From b0cfcc9980c6daf6383c6dc51fdbe90e1c7625d5 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Wed, 29 Sep 2021 15:28:21 +0200 > +Subject: [PATCH 4/9] debian/config: Make image encryption optional > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/configs/defconfig | 1 - > + debian/rules | 3 +++ > + 2 files changed, 3 insertions(+), 1 deletion(-) > + > +diff --git a/debian/configs/defconfig b/debian/configs/defconfig > +index f959e44..8e1a810 100644 > +--- a/debian/configs/defconfig > ++++ b/debian/configs/defconfig > +@@ -3,7 +3,6 @@ CONFIG_HW_COMPATIBILITY=y > + CONFIG_DOWNLOAD=y > + CONFIG_DOWNLOAD_SSL=y > + CONFIG_SIGALG_CMS=y > +-CONFIG_ENCRYPTED_IMAGES=y > + CONFIG_SURICATTA=y > + CONFIG_SURICATTA_SSL=y > + CONFIG_UPDATE_STATE_CHOICE_BOOTLOADER=y > +diff --git a/debian/rules b/debian/rules > +index 4793c84..6d32d50 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -42,6 +42,9 @@ endif > + ifeq (,$(filter pkg.swupdate.nosigning,$(DEB_BUILD_PROFILES))) > + echo CONFIG_SIGNED_IMAGES=y >> configs/debian_defconfig > + endif > ++ifeq (,$(filter pkg.swupdate.noencryption,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_ENCRYPTED_IMAGES=y >> configs/debian_defconfig > ++endif > + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES))) > + echo CONFIG_PKCS11=y >> configs/debian_defconfig > + endif > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0005-debian-rules-Add-Embedded-Lua-handler-option.patch b/recipes-core/swupdate/files/0005-debian-rules-Add-Embedded-Lua-handler-option.patch > new file mode 100644 > index 0000000..84665cd > --- /dev/null > +++ b/recipes-core/swupdate/files/0005-debian-rules-Add-Embedded-Lua-handler-option.patch > @@ -0,0 +1,30 @@ > +From 0200687ad67d6e5a0e9bbdf2e8c86e3f8e717c5e Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Wed, 29 Sep 2021 11:32:41 +0200 > +Subject: [PATCH 5/6] debian/rules: Add Embedded Lua handler option > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/rules | 5 +++++ > + 1 file changed, 5 insertions(+) > + > +diff --git a/debian/rules b/debian/rules > +index 69fd790..9ace348 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -52,7 +52,12 @@ ifneq (,$(LUA_VERSION)) > + echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig > + echo CONFIG_LUASCRIPTHANDLER=y >> configs/debian_defconfig > + echo CONFIG_HANDLER_IN_LUA=y >> configs/debian_defconfig > ++ifneq (,$(filter pkg.swupdate.embeddedlua,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_EMBEDDED_LUA_HANDLER=y >> configs/debian_defconfig > ++ echo CONFIG_EMBEDDED_LUA_HANDLER_SOURCE=\"/usr/share/lua/$(LUA_VERSION)/swupdate_handlers.lua\" >> configs/debian_defconfig > + endif > ++endif > ++ > + echo CONFIG_EXTRA_CFLAGS=\"$(CFLAGS) $(CPPFLAGS)\" >> configs/debian_defconfig > + echo CONFIG_EXTRA_LDFLAGS=\"$(LDFLAGS)\" >> configs/debian_defconfig > + echo CONFIG_EXTRA_LDLIBS=\"$(LDLIBS)\" >> configs/debian_defconfig > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0005-debian-rules-Add-option-to-disable-fs-creation.patch b/recipes-core/swupdate/files/0005-debian-rules-Add-option-to-disable-fs-creation.patch > new file mode 100644 > index 0000000..1121923 > --- /dev/null > +++ b/recipes-core/swupdate/files/0005-debian-rules-Add-option-to-disable-fs-creation.patch > @@ -0,0 +1,47 @@ > +From 22a96e95676123c6ce8800b9d911402704dce9e2 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Mon, 4 Oct 2021 17:15:56 +0200 > +Subject: [PATCH 5/9] debian/rules: Add option to disable fs creation > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/configs/defconfig | 4 ---- > + debian/rules | 7 +++++++ > + 2 files changed, 7 insertions(+), 4 deletions(-) > + > +diff --git a/debian/configs/defconfig b/debian/configs/defconfig > +index 8e1a810..d011deb 100644 > +--- a/debian/configs/defconfig > ++++ b/debian/configs/defconfig > +@@ -9,10 +9,6 @@ CONFIG_UPDATE_STATE_CHOICE_BOOTLOADER=y > + CONFIG_WEBSERVER=y > + CONFIG_MONGOOSESSL=y > + CONFIG_ZSTD=y > +-CONFIG_DISKPART=y > +-CONFIG_DISKFORMAT=y > +-CONFIG_FAT_FILESYSTEM=y > +-CONFIG_EXT_FILESYSTEM=y > + CONFIG_UNIQUEUUID=y > + CONFIG_RAW=y > + CONFIG_RDIFFHANDLER=y > +diff --git a/debian/rules b/debian/rules > +index 6d32d50..9349c22 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -45,6 +45,13 @@ endif > + ifeq (,$(filter pkg.swupdate.noencryption,$(DEB_BUILD_PROFILES))) > + echo CONFIG_ENCRYPTED_IMAGES=y >> configs/debian_defconfig > + endif > ++ifeq (,$(filter pkg.swupdate.nocreatefs,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_DISKPART=y >> configs/debian_defconfig > ++ echo CONFIG_DISKFORMAT=y >> configs/debian_defconfig > ++ echo CONFIG_FAT_FILESYSTEM=y >> configs/debian_defconfig > ++ echo CONFIG_EXT_FILESYSTEM=y >> configs/debian_defconfig > ++endif > ++ > + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES))) > + echo CONFIG_PKCS11=y >> configs/debian_defconfig > + endif > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0006-debian-rules-Add-option-to-disable-webserver.patch b/recipes-core/swupdate/files/0006-debian-rules-Add-option-to-disable-webserver.patch > new file mode 100644 > index 0000000..23a456d > --- /dev/null > +++ b/recipes-core/swupdate/files/0006-debian-rules-Add-option-to-disable-webserver.patch > @@ -0,0 +1,42 @@ > +From 9caabe416aca7ca2bf1cd2d8be89cfc89cedf6cd Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Mon, 4 Oct 2021 17:27:11 +0200 > +Subject: [PATCH 6/9] debian/rules: Add option to disable webserver > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/configs/defconfig | 2 -- > + debian/rules | 4 ++++ > + 2 files changed, 4 insertions(+), 2 deletions(-) > + > +diff --git a/debian/configs/defconfig b/debian/configs/defconfig > +index d011deb..337fcce 100644 > +--- a/debian/configs/defconfig > ++++ b/debian/configs/defconfig > +@@ -6,8 +6,6 @@ CONFIG_SIGALG_CMS=y > + CONFIG_SURICATTA=y > + CONFIG_SURICATTA_SSL=y > + CONFIG_UPDATE_STATE_CHOICE_BOOTLOADER=y > +-CONFIG_WEBSERVER=y > +-CONFIG_MONGOOSESSL=y > + CONFIG_ZSTD=y > + CONFIG_UNIQUEUUID=y > + CONFIG_RAW=y > +diff --git a/debian/rules b/debian/rules > +index 9349c22..4574b18 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -39,6 +39,10 @@ else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) > + else > + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig > + endif > ++ifeq (,$(filter pkg.swupdate.nowebserver,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_WEBSERVER=y >> configs/debian_defconfig > ++ echo CONFIG_MONGOOSESSL=y >> configs/debian_defconfig > ++endif > + ifeq (,$(filter pkg.swupdate.nosigning,$(DEB_BUILD_PROFILES))) > + echo CONFIG_SIGNED_IMAGES=y >> configs/debian_defconfig > + endif > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch b/recipes-core/swupdate/files/0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch > new file mode 100644 > index 0000000..c2d37a9 > --- /dev/null > +++ b/recipes-core/swupdate/files/0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch > @@ -0,0 +1,40 @@ > +From 538e54a36b24eb6caf49d7dca91598fa9fc86713 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Tue, 5 Oct 2021 10:56:25 +0200 > +Subject: [PATCH 7/9] debian: Make CONFIG_HW_COMPATIBILTY optional > + > +Add option for qemu. > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/configs/defconfig | 1 - > + debian/rules | 3 +++ > + 2 files changed, 3 insertions(+), 1 deletion(-) > + > +diff --git a/debian/configs/defconfig b/debian/configs/defconfig > +index 337fcce..6fc1137 100644 > +--- a/debian/configs/defconfig > ++++ b/debian/configs/defconfig > +@@ -1,5 +1,4 @@ > + CONFIG_SYSTEMD=y > +-CONFIG_HW_COMPATIBILITY=y > + CONFIG_DOWNLOAD=y > + CONFIG_DOWNLOAD_SSL=y > + CONFIG_SIGALG_CMS=y > +diff --git a/debian/rules b/debian/rules > +index 4574b18..9a4b0d4 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -39,6 +39,9 @@ else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) > + else > + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig > + endif > ++ifneq (,$(filter pkg.swupdate.hwcompatibility,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_HW_COMPATIBILITY=y >> configs/debian_defconfig > ++endif > + ifeq (,$(filter pkg.swupdate.nowebserver,$(DEB_BUILD_PROFILES))) > + echo CONFIG_WEBSERVER=y >> configs/debian_defconfig > + echo CONFIG_MONGOOSESSL=y >> configs/debian_defconfig > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0008-debian-rules-Add-Embedded-Lua-handler-option.patch b/recipes-core/swupdate/files/0008-debian-rules-Add-Embedded-Lua-handler-option.patch > new file mode 100644 > index 0000000..44a83c4 > --- /dev/null > +++ b/recipes-core/swupdate/files/0008-debian-rules-Add-Embedded-Lua-handler-option.patch > @@ -0,0 +1,30 @@ > +From c2f07b552c6d83562fed5452bc778ae0e5e19cd4 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Wed, 29 Sep 2021 11:32:41 +0200 > +Subject: [PATCH 8/9] debian/rules: Add Embedded Lua handler option > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/rules | 5 +++++ > + 1 file changed, 5 insertions(+) > + > +diff --git a/debian/rules b/debian/rules > +index 9a4b0d4..a1f73fd 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -66,7 +66,12 @@ ifneq (,$(LUA_VERSION)) > + echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig > + echo CONFIG_LUASCRIPTHANDLER=y >> configs/debian_defconfig > + echo CONFIG_HANDLER_IN_LUA=y >> configs/debian_defconfig > ++ifneq (,$(filter pkg.swupdate.embeddedlua,$(DEB_BUILD_PROFILES))) > ++ echo CONFIG_EMBEDDED_LUA_HANDLER=y >> configs/debian_defconfig > ++ echo CONFIG_EMBEDDED_LUA_HANDLER_SOURCE=\"/usr/share/lua/$(LUA_VERSION)/swupdate_handlers.lua\" >> configs/debian_defconfig > + endif > ++endif > ++ > + echo CONFIG_EXTRA_CFLAGS=\"$(CFLAGS) $(CPPFLAGS)\" >> configs/debian_defconfig > + echo CONFIG_EXTRA_LDFLAGS=\"$(LDFLAGS)\" >> configs/debian_defconfig > + echo CONFIG_EXTRA_LDLIBS=\"$(LDLIBS)\" >> configs/debian_defconfig > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/files/0009-debian-prepare-build-for-isar-debian-buster.patch b/recipes-core/swupdate/files/0009-debian-prepare-build-for-isar-debian-buster.patch > new file mode 100644 > index 0000000..8462951 > --- /dev/null > +++ b/recipes-core/swupdate/files/0009-debian-prepare-build-for-isar-debian-buster.patch > @@ -0,0 +1,72 @@ > +From 16dd48c2282aba91f8fc1f458f7b0c06504cac19 Mon Sep 17 00:00:00 2001 > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +Date: Wed, 29 Sep 2021 16:17:03 +0200 > +Subject: [PATCH 9/9] debian: prepare build for isar debian buster > + > +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > +--- > + debian/compat | 1 + > + debian/control | 10 +++++----- > + debian/rules | 4 +++- > + 3 files changed, 9 insertions(+), 6 deletions(-) > + create mode 100644 debian/compat > + > +diff --git a/debian/compat b/debian/compat > +new file mode 100644 > +index 0000000..f599e28 > +--- /dev/null > ++++ b/debian/compat > +@@ -0,0 +1 @@ > ++10 > +diff --git a/debian/control b/debian/control > +index 6031537..710cb2d 100644 > +--- a/debian/control > ++++ b/debian/control > +@@ -4,7 +4,7 @@ Priority: optional > + Maintainer: Stefano Babic <sbabic@denx.de> > + Uploaders: SZ Lin (林上智) <szlin@debian.org>, > + Nobuhiro Iwamatsu <iwamatsu@debian.org> > +-Build-Depends: debhelper-compat (= 13), > ++Build-Depends: debhelper, > + dh-lua:native <!nolua>, > + liblua5.2-dev <!nolua>, > + libfdisk-dev, > +@@ -23,10 +23,10 @@ Build-Depends: debhelper-compat (= 13), > + libzstd-dev, > + libp11-kit-dev <pkg.swupdate.p11>, > + libwolfssl-dev <pkg.swupdate.p11>, > +- libmtd-dev <!pkg.swupdate.bpo>, > +- libubi-dev <!pkg.swupdate.bpo>, > +- libwebsockets-dev (>= 3.2.0) <!pkg.swupdate.bpo>, > +- liburiparser-dev <!pkg.swupdate.bpo>, > ++ libmtd-dev <pkg.swupdate.mtd> <pkg.swupdate.ubi>, > ++ libubi-dev <pkg.swupdate.ubi>, > ++ libwebsockets-dev, > ++ liburiparser-dev, > + libubootenv-dev <pkg.swupdate.uboot>, > + efibootguard-dev <pkg.swupdate.efibootguard>, > + libcmocka-dev, > +diff --git a/debian/rules b/debian/rules > +index a1f73fd..a2ae1ac 100755 > +--- a/debian/rules > ++++ b/debian/rules > +@@ -19,13 +19,15 @@ endif > + > + override_dh_auto_configure: > + cp debian/configs/defconfig configs/debian_defconfig > +-ifeq (,$(filter pkg.swupdate.bpo,$(DEB_BUILD_PROFILES))) > ++ifneq (,$(filter pkg.swupdate.mtd,$(DEB_BUILD_PROFILES))) > + echo CONFIG_MTD=y >> configs/debian_defconfig > ++ifneq (,$(filter pkg.swupdate.ubi,$(DEB_BUILD_PROFILES))) > + echo CONFIG_SWUFORWARDER_HANDLER=y >> configs/debian_defconfig > + echo CONFIG_CFI=y >> configs/debian_defconfig > + echo CONFIG_CFIHAMMING1=y >> configs/debian_defconfig > + echo CONFIG_UBIVOL=y >> configs/debian_defconfig > + echo CONFIG_SSBLSWITCH=y >> configs/debian_defconfig > ++endif > + else > + echo "# CONFIG_MTD is not set" >> configs/debian_defconfig > + endif > +-- > +2.30.2 > + > diff --git a/recipes-core/swupdate/swupdate.inc b/recipes-core/swupdate/swupdate.inc > new file mode 100644 > index 0000000..a7fd662 > --- /dev/null > +++ b/recipes-core/swupdate/swupdate.inc > @@ -0,0 +1,54 @@ > +# > +# CIP Core, generic profile > +# > +# Copyright (c) Siemens AG, 2021 > +# > +# Authors: > +# Quirin Gylstorff <quirin.gylstorff@siemens.com> > +# > +# SPDX-License-Identifier: MIT > + > +DESCRIPTION = "swupdate utility for software updates" > +HOMEPAGE= "https://github.com/sbabic/swupdate" > +LICENSE = "GPL-2.0" > +LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" > + > + Extra linefeed. > +def get_bootloader_build_profile(d): > + bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "" expand=True is the default for for getVar, so you can drop the True. > + if bootloader == "efibootguard": > + return "pkg.swupdate.efibootguard" > + if bootloader == "u-boot": > + return "pkg.swupdate.uboot" > + return "" > + > +SWUPDATE_BUILD_PROFILES += "${@get_bootloader_build_profile(d)}" > + > +def get_bootloader_dependencies(d): > + bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "" > + if bootloader == "efibootguard": > + return "efibootguard-dev" > + if bootloader == "u-boot": > + if d.getVar("U_BOOT_CONFIG_PACKAGE", True) == "1": > + return "libubootenv u-boot-{}-config".format(d.getVar("MACHINE", TRUE)) > + else: > + return "libubootenv" > + return "" > + > +DEPENDS += "${@get_bootloader_dependencies(d)}" > +DEPENDS += "${@bb.utils.contains('SWUPDATE_BUILD_PROFILES', 'mtd', 'mtd-utils', '', d)}" > + > +do_install_builddeps_prepend() { > + export DEB_BUILD_PROFILES="${SWUPDATE_BUILD_PROFILES}" > +} > + > +dpkg_runbuild_prepend() { > + export DEB_BUILD_PROFILES="${SWUPDATE_BUILD_PROFILES}" > +} > + > +python do_check_bootloader () { > + bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "None" > + if not bootloader in ["efibootguard", "u-boot"]: > + bb.warn("swupdate: SWUPDATE_BOOTLOADER set to incompatible value: " + bootloader) > +} > +addtask check_bootloader before do_fetch > diff --git a/recipes-core/swupdate/swupdate_2021.04-1+debian-gbp.bb b/recipes-core/swupdate/swupdate_2021.04-1+debian-gbp.bb > new file mode 100644 > index 0000000..3b8da36 > --- /dev/null > +++ b/recipes-core/swupdate/swupdate_2021.04-1+debian-gbp.bb > @@ -0,0 +1,47 @@ > +# > +# CIP Core, generic profile > +# > +# Copyright (c) Siemens AG, 2021 > +# > +# Authors: > +# Quirin Gylstorff <quirin.gylstorff@siemens.com> > +# > +# SPDX-License-Identifier: MIT > + > +inherit dpkg-gbp > + > +include swupdate.inc > + > +SRC_URI = "git://salsa.debian.org/debian/swupdate.git;protocol=https;branch=debian/master" > +SRCREV ="debian/2021.04-1" > + > +# add options to DEB_BUILD_PROFILES > +SRC_URI += "file://0001-debian-Add-option-to-build-with-efibootguard.patch \ > +file://0002-debian-rules-Add-CONFIG_MTD.patch \ > +file://0003-debian-config-Make-signing-optional.patch \ > +file://0004-debian-config-Make-image-encryption-optional.patch \ > +file://0005-debian-rules-Add-option-to-disable-fs-creation.patch \ > +file://0006-debian-rules-Add-option-to-disable-webserver.patch \ > +file://0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch \ > +file://0008-debian-rules-Add-Embedded-Lua-handler-option.patch" Missing indentions of the continued lines. > + > +# deactivate signing and encryption for simple a/b rootfs update > +SWUPDATE_BUILD_PROFILES += "pkg.swupdate.nosigning pkg.swupdate.noencryption" > + > +# If the luahandler shall be embedded into the swupdate binary > +# include the following lines. > +# DEPENDS += "swupdate-handlers" > +# GBP_DEPENDS += "swupdate-handlers" > +# SWUPDATE_BUILD_PROFILES += "pkg.swupdate.embeddedlua" > + > +# modify for debian buster build > +SRC_URI_append_cip-core-buster = " file://0009-debian-prepare-build-for-isar-debian-buster.patch" > + > +# disable documentation due to missing packages in debian buster > +# disable create filesystem due to missing symbols in debian buster > +# disable webserver due to missing symbols in debian buster > +SWUPDATE_BUILD_PROFILES_append_cip-core-buster = " nodoc \ > + pkg.swupdate.nocreatefs \ > + pkg.swupdate.nowebserver " > +# set compression to xz Rather than writing what it does, it might make more sense to document the reason. > +GBP_EXTRA_OPTIONS += "--git-compression=xz" > Jan
diff --git a/conf/distro/cip-core-bullseye.conf b/conf/distro/cip-core-bullseye.conf index 38014b4..9357b6c 100644 --- a/conf/distro/cip-core-bullseye.conf +++ b/conf/distro/cip-core-bullseye.conf @@ -14,3 +14,4 @@ require cip-core-common.inc PREFERRED_VERSION_linux-cip ?= "4.19.%" PREFERRED_VERSION_linux-cip-rt ?= "4.19.%" +PREFERRED_VERSION_swupdate ?= "2021.04-1+debian-gbp" diff --git a/conf/distro/cip-core-buster.conf b/conf/distro/cip-core-buster.conf index c5cb39c..61fcb41 100644 --- a/conf/distro/cip-core-buster.conf +++ b/conf/distro/cip-core-buster.conf @@ -14,3 +14,4 @@ require cip-core-common.inc PREFERRED_VERSION_linux-cip ?= "4.19.%" PREFERRED_VERSION_linux-cip-rt ?= "4.19.%" +PREFERRED_VERSION_swupdate ?= "2021.4-git+isar" diff --git a/recipes-core/swupdate/files/0001-debian-Add-option-to-build-with-efibootguard.patch b/recipes-core/swupdate/files/0001-debian-Add-option-to-build-with-efibootguard.patch new file mode 100644 index 0000000..00f9a5f --- /dev/null +++ b/recipes-core/swupdate/files/0001-debian-Add-option-to-build-with-efibootguard.patch @@ -0,0 +1,39 @@ +From fe3f090e3764e1e2625d509a56bd521bab507ce7 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Wed, 15 Sep 2021 12:36:09 +0200 +Subject: [PATCH 1/9] debian: Add option to build with efibootguard + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/control | 1 + + debian/rules | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/debian/control b/debian/control +index 9e43eab..6031537 100644 +--- a/debian/control ++++ b/debian/control +@@ -28,6 +28,7 @@ Build-Depends: debhelper-compat (= 13), + libwebsockets-dev (>= 3.2.0) <!pkg.swupdate.bpo>, + liburiparser-dev <!pkg.swupdate.bpo>, + libubootenv-dev <pkg.swupdate.uboot>, ++ efibootguard-dev <pkg.swupdate.efibootguard>, + libcmocka-dev, + pkg-config, + gawk, +diff --git a/debian/rules b/debian/rules +index 4b55be2..c076839 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -33,6 +33,8 @@ ifneq (,$(filter pkg.swupdate.uboot,$(DEB_BUILD_PROFILES))) + else ifneq (,$(filter pkg.swupdate.grub,$(DEB_BUILD_PROFILES))) + echo CONFIG_BOOTLOADER_GRUB=y >> configs/debian_defconfig + echo CONFIG_GRUBENV_PATH=\"/boot/grub/grubenv\" >> configs/debian_defconfig ++else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_BOOTLOADER_EBG=y >> configs/debian_defconfig + else + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig + endif +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0002-debian-rules-Add-CONFIG_MTD.patch b/recipes-core/swupdate/files/0002-debian-rules-Add-CONFIG_MTD.patch new file mode 100644 index 0000000..0921aef --- /dev/null +++ b/recipes-core/swupdate/files/0002-debian-rules-Add-CONFIG_MTD.patch @@ -0,0 +1,27 @@ +From 43365f98d70d83dac42913ff907a8a9dd25a4333 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Wed, 29 Sep 2021 11:29:57 +0200 +Subject: [PATCH 2/9] debian/rules: Add CONFIG_MTD + +if pkg.swupdate.bpo is set CONFIG_MTD is disable but not enabled. + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/rules | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/debian/rules b/debian/rules +index c076839..292133b 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -20,6 +20,7 @@ endif + override_dh_auto_configure: + cp debian/configs/defconfig configs/debian_defconfig + ifeq (,$(filter pkg.swupdate.bpo,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_MTD=y >> configs/debian_defconfig + echo CONFIG_SWUFORWARDER_HANDLER=y >> configs/debian_defconfig + echo CONFIG_CFI=y >> configs/debian_defconfig + echo CONFIG_CFIHAMMING1=y >> configs/debian_defconfig +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0003-debian-config-Make-signing-optional.patch b/recipes-core/swupdate/files/0003-debian-config-Make-signing-optional.patch new file mode 100644 index 0000000..347b316 --- /dev/null +++ b/recipes-core/swupdate/files/0003-debian-config-Make-signing-optional.patch @@ -0,0 +1,40 @@ +From 37f9afeeac5483f677b5be41b3d31e6557fcc146 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Wed, 29 Sep 2021 15:27:51 +0200 +Subject: [PATCH 3/9] debian/config: Make signing optional + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/configs/defconfig | 1 - + debian/rules | 3 +++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/debian/configs/defconfig b/debian/configs/defconfig +index b38aa62..f959e44 100644 +--- a/debian/configs/defconfig ++++ b/debian/configs/defconfig +@@ -2,7 +2,6 @@ CONFIG_SYSTEMD=y + CONFIG_HW_COMPATIBILITY=y + CONFIG_DOWNLOAD=y + CONFIG_DOWNLOAD_SSL=y +-CONFIG_SIGNED_IMAGES=y + CONFIG_SIGALG_CMS=y + CONFIG_ENCRYPTED_IMAGES=y + CONFIG_SURICATTA=y +diff --git a/debian/rules b/debian/rules +index 292133b..4793c84 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -39,6 +39,9 @@ else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) + else + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig + endif ++ifeq (,$(filter pkg.swupdate.nosigning,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_SIGNED_IMAGES=y >> configs/debian_defconfig ++endif + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES))) + echo CONFIG_PKCS11=y >> configs/debian_defconfig + endif +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0004-debian-config-Make-image-encryption-optional.patch b/recipes-core/swupdate/files/0004-debian-config-Make-image-encryption-optional.patch new file mode 100644 index 0000000..45990f8 --- /dev/null +++ b/recipes-core/swupdate/files/0004-debian-config-Make-image-encryption-optional.patch @@ -0,0 +1,40 @@ +From b0cfcc9980c6daf6383c6dc51fdbe90e1c7625d5 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Wed, 29 Sep 2021 15:28:21 +0200 +Subject: [PATCH 4/9] debian/config: Make image encryption optional + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/configs/defconfig | 1 - + debian/rules | 3 +++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/debian/configs/defconfig b/debian/configs/defconfig +index f959e44..8e1a810 100644 +--- a/debian/configs/defconfig ++++ b/debian/configs/defconfig +@@ -3,7 +3,6 @@ CONFIG_HW_COMPATIBILITY=y + CONFIG_DOWNLOAD=y + CONFIG_DOWNLOAD_SSL=y + CONFIG_SIGALG_CMS=y +-CONFIG_ENCRYPTED_IMAGES=y + CONFIG_SURICATTA=y + CONFIG_SURICATTA_SSL=y + CONFIG_UPDATE_STATE_CHOICE_BOOTLOADER=y +diff --git a/debian/rules b/debian/rules +index 4793c84..6d32d50 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -42,6 +42,9 @@ endif + ifeq (,$(filter pkg.swupdate.nosigning,$(DEB_BUILD_PROFILES))) + echo CONFIG_SIGNED_IMAGES=y >> configs/debian_defconfig + endif ++ifeq (,$(filter pkg.swupdate.noencryption,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_ENCRYPTED_IMAGES=y >> configs/debian_defconfig ++endif + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES))) + echo CONFIG_PKCS11=y >> configs/debian_defconfig + endif +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0005-debian-rules-Add-Embedded-Lua-handler-option.patch b/recipes-core/swupdate/files/0005-debian-rules-Add-Embedded-Lua-handler-option.patch new file mode 100644 index 0000000..84665cd --- /dev/null +++ b/recipes-core/swupdate/files/0005-debian-rules-Add-Embedded-Lua-handler-option.patch @@ -0,0 +1,30 @@ +From 0200687ad67d6e5a0e9bbdf2e8c86e3f8e717c5e Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Wed, 29 Sep 2021 11:32:41 +0200 +Subject: [PATCH 5/6] debian/rules: Add Embedded Lua handler option + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/rules | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/debian/rules b/debian/rules +index 69fd790..9ace348 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -52,7 +52,12 @@ ifneq (,$(LUA_VERSION)) + echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig + echo CONFIG_LUASCRIPTHANDLER=y >> configs/debian_defconfig + echo CONFIG_HANDLER_IN_LUA=y >> configs/debian_defconfig ++ifneq (,$(filter pkg.swupdate.embeddedlua,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_EMBEDDED_LUA_HANDLER=y >> configs/debian_defconfig ++ echo CONFIG_EMBEDDED_LUA_HANDLER_SOURCE=\"/usr/share/lua/$(LUA_VERSION)/swupdate_handlers.lua\" >> configs/debian_defconfig + endif ++endif ++ + echo CONFIG_EXTRA_CFLAGS=\"$(CFLAGS) $(CPPFLAGS)\" >> configs/debian_defconfig + echo CONFIG_EXTRA_LDFLAGS=\"$(LDFLAGS)\" >> configs/debian_defconfig + echo CONFIG_EXTRA_LDLIBS=\"$(LDLIBS)\" >> configs/debian_defconfig +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0005-debian-rules-Add-option-to-disable-fs-creation.patch b/recipes-core/swupdate/files/0005-debian-rules-Add-option-to-disable-fs-creation.patch new file mode 100644 index 0000000..1121923 --- /dev/null +++ b/recipes-core/swupdate/files/0005-debian-rules-Add-option-to-disable-fs-creation.patch @@ -0,0 +1,47 @@ +From 22a96e95676123c6ce8800b9d911402704dce9e2 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Mon, 4 Oct 2021 17:15:56 +0200 +Subject: [PATCH 5/9] debian/rules: Add option to disable fs creation + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/configs/defconfig | 4 ---- + debian/rules | 7 +++++++ + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/debian/configs/defconfig b/debian/configs/defconfig +index 8e1a810..d011deb 100644 +--- a/debian/configs/defconfig ++++ b/debian/configs/defconfig +@@ -9,10 +9,6 @@ CONFIG_UPDATE_STATE_CHOICE_BOOTLOADER=y + CONFIG_WEBSERVER=y + CONFIG_MONGOOSESSL=y + CONFIG_ZSTD=y +-CONFIG_DISKPART=y +-CONFIG_DISKFORMAT=y +-CONFIG_FAT_FILESYSTEM=y +-CONFIG_EXT_FILESYSTEM=y + CONFIG_UNIQUEUUID=y + CONFIG_RAW=y + CONFIG_RDIFFHANDLER=y +diff --git a/debian/rules b/debian/rules +index 6d32d50..9349c22 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -45,6 +45,13 @@ endif + ifeq (,$(filter pkg.swupdate.noencryption,$(DEB_BUILD_PROFILES))) + echo CONFIG_ENCRYPTED_IMAGES=y >> configs/debian_defconfig + endif ++ifeq (,$(filter pkg.swupdate.nocreatefs,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_DISKPART=y >> configs/debian_defconfig ++ echo CONFIG_DISKFORMAT=y >> configs/debian_defconfig ++ echo CONFIG_FAT_FILESYSTEM=y >> configs/debian_defconfig ++ echo CONFIG_EXT_FILESYSTEM=y >> configs/debian_defconfig ++endif ++ + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES))) + echo CONFIG_PKCS11=y >> configs/debian_defconfig + endif +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0006-debian-rules-Add-option-to-disable-webserver.patch b/recipes-core/swupdate/files/0006-debian-rules-Add-option-to-disable-webserver.patch new file mode 100644 index 0000000..23a456d --- /dev/null +++ b/recipes-core/swupdate/files/0006-debian-rules-Add-option-to-disable-webserver.patch @@ -0,0 +1,42 @@ +From 9caabe416aca7ca2bf1cd2d8be89cfc89cedf6cd Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Mon, 4 Oct 2021 17:27:11 +0200 +Subject: [PATCH 6/9] debian/rules: Add option to disable webserver + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/configs/defconfig | 2 -- + debian/rules | 4 ++++ + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/debian/configs/defconfig b/debian/configs/defconfig +index d011deb..337fcce 100644 +--- a/debian/configs/defconfig ++++ b/debian/configs/defconfig +@@ -6,8 +6,6 @@ CONFIG_SIGALG_CMS=y + CONFIG_SURICATTA=y + CONFIG_SURICATTA_SSL=y + CONFIG_UPDATE_STATE_CHOICE_BOOTLOADER=y +-CONFIG_WEBSERVER=y +-CONFIG_MONGOOSESSL=y + CONFIG_ZSTD=y + CONFIG_UNIQUEUUID=y + CONFIG_RAW=y +diff --git a/debian/rules b/debian/rules +index 9349c22..4574b18 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -39,6 +39,10 @@ else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) + else + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig + endif ++ifeq (,$(filter pkg.swupdate.nowebserver,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_WEBSERVER=y >> configs/debian_defconfig ++ echo CONFIG_MONGOOSESSL=y >> configs/debian_defconfig ++endif + ifeq (,$(filter pkg.swupdate.nosigning,$(DEB_BUILD_PROFILES))) + echo CONFIG_SIGNED_IMAGES=y >> configs/debian_defconfig + endif +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch b/recipes-core/swupdate/files/0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch new file mode 100644 index 0000000..c2d37a9 --- /dev/null +++ b/recipes-core/swupdate/files/0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch @@ -0,0 +1,40 @@ +From 538e54a36b24eb6caf49d7dca91598fa9fc86713 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Tue, 5 Oct 2021 10:56:25 +0200 +Subject: [PATCH 7/9] debian: Make CONFIG_HW_COMPATIBILTY optional + +Add option for qemu. + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/configs/defconfig | 1 - + debian/rules | 3 +++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/debian/configs/defconfig b/debian/configs/defconfig +index 337fcce..6fc1137 100644 +--- a/debian/configs/defconfig ++++ b/debian/configs/defconfig +@@ -1,5 +1,4 @@ + CONFIG_SYSTEMD=y +-CONFIG_HW_COMPATIBILITY=y + CONFIG_DOWNLOAD=y + CONFIG_DOWNLOAD_SSL=y + CONFIG_SIGALG_CMS=y +diff --git a/debian/rules b/debian/rules +index 4574b18..9a4b0d4 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -39,6 +39,9 @@ else ifneq (,$(filter pkg.swupdate.efibootguard,$(DEB_BUILD_PROFILES))) + else + echo CONFIG_BOOTLOADER_NONE=y >> configs/debian_defconfig + endif ++ifneq (,$(filter pkg.swupdate.hwcompatibility,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_HW_COMPATIBILITY=y >> configs/debian_defconfig ++endif + ifeq (,$(filter pkg.swupdate.nowebserver,$(DEB_BUILD_PROFILES))) + echo CONFIG_WEBSERVER=y >> configs/debian_defconfig + echo CONFIG_MONGOOSESSL=y >> configs/debian_defconfig +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0008-debian-rules-Add-Embedded-Lua-handler-option.patch b/recipes-core/swupdate/files/0008-debian-rules-Add-Embedded-Lua-handler-option.patch new file mode 100644 index 0000000..44a83c4 --- /dev/null +++ b/recipes-core/swupdate/files/0008-debian-rules-Add-Embedded-Lua-handler-option.patch @@ -0,0 +1,30 @@ +From c2f07b552c6d83562fed5452bc778ae0e5e19cd4 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Wed, 29 Sep 2021 11:32:41 +0200 +Subject: [PATCH 8/9] debian/rules: Add Embedded Lua handler option + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/rules | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/debian/rules b/debian/rules +index 9a4b0d4..a1f73fd 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -66,7 +66,12 @@ ifneq (,$(LUA_VERSION)) + echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig + echo CONFIG_LUASCRIPTHANDLER=y >> configs/debian_defconfig + echo CONFIG_HANDLER_IN_LUA=y >> configs/debian_defconfig ++ifneq (,$(filter pkg.swupdate.embeddedlua,$(DEB_BUILD_PROFILES))) ++ echo CONFIG_EMBEDDED_LUA_HANDLER=y >> configs/debian_defconfig ++ echo CONFIG_EMBEDDED_LUA_HANDLER_SOURCE=\"/usr/share/lua/$(LUA_VERSION)/swupdate_handlers.lua\" >> configs/debian_defconfig + endif ++endif ++ + echo CONFIG_EXTRA_CFLAGS=\"$(CFLAGS) $(CPPFLAGS)\" >> configs/debian_defconfig + echo CONFIG_EXTRA_LDFLAGS=\"$(LDFLAGS)\" >> configs/debian_defconfig + echo CONFIG_EXTRA_LDLIBS=\"$(LDLIBS)\" >> configs/debian_defconfig +-- +2.30.2 + diff --git a/recipes-core/swupdate/files/0009-debian-prepare-build-for-isar-debian-buster.patch b/recipes-core/swupdate/files/0009-debian-prepare-build-for-isar-debian-buster.patch new file mode 100644 index 0000000..8462951 --- /dev/null +++ b/recipes-core/swupdate/files/0009-debian-prepare-build-for-isar-debian-buster.patch @@ -0,0 +1,72 @@ +From 16dd48c2282aba91f8fc1f458f7b0c06504cac19 Mon Sep 17 00:00:00 2001 +From: Quirin Gylstorff <quirin.gylstorff@siemens.com> +Date: Wed, 29 Sep 2021 16:17:03 +0200 +Subject: [PATCH 9/9] debian: prepare build for isar debian buster + +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> +--- + debian/compat | 1 + + debian/control | 10 +++++----- + debian/rules | 4 +++- + 3 files changed, 9 insertions(+), 6 deletions(-) + create mode 100644 debian/compat + +diff --git a/debian/compat b/debian/compat +new file mode 100644 +index 0000000..f599e28 +--- /dev/null ++++ b/debian/compat +@@ -0,0 +1 @@ ++10 +diff --git a/debian/control b/debian/control +index 6031537..710cb2d 100644 +--- a/debian/control ++++ b/debian/control +@@ -4,7 +4,7 @@ Priority: optional + Maintainer: Stefano Babic <sbabic@denx.de> + Uploaders: SZ Lin (林上智) <szlin@debian.org>, + Nobuhiro Iwamatsu <iwamatsu@debian.org> +-Build-Depends: debhelper-compat (= 13), ++Build-Depends: debhelper, + dh-lua:native <!nolua>, + liblua5.2-dev <!nolua>, + libfdisk-dev, +@@ -23,10 +23,10 @@ Build-Depends: debhelper-compat (= 13), + libzstd-dev, + libp11-kit-dev <pkg.swupdate.p11>, + libwolfssl-dev <pkg.swupdate.p11>, +- libmtd-dev <!pkg.swupdate.bpo>, +- libubi-dev <!pkg.swupdate.bpo>, +- libwebsockets-dev (>= 3.2.0) <!pkg.swupdate.bpo>, +- liburiparser-dev <!pkg.swupdate.bpo>, ++ libmtd-dev <pkg.swupdate.mtd> <pkg.swupdate.ubi>, ++ libubi-dev <pkg.swupdate.ubi>, ++ libwebsockets-dev, ++ liburiparser-dev, + libubootenv-dev <pkg.swupdate.uboot>, + efibootguard-dev <pkg.swupdate.efibootguard>, + libcmocka-dev, +diff --git a/debian/rules b/debian/rules +index a1f73fd..a2ae1ac 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -19,13 +19,15 @@ endif + + override_dh_auto_configure: + cp debian/configs/defconfig configs/debian_defconfig +-ifeq (,$(filter pkg.swupdate.bpo,$(DEB_BUILD_PROFILES))) ++ifneq (,$(filter pkg.swupdate.mtd,$(DEB_BUILD_PROFILES))) + echo CONFIG_MTD=y >> configs/debian_defconfig ++ifneq (,$(filter pkg.swupdate.ubi,$(DEB_BUILD_PROFILES))) + echo CONFIG_SWUFORWARDER_HANDLER=y >> configs/debian_defconfig + echo CONFIG_CFI=y >> configs/debian_defconfig + echo CONFIG_CFIHAMMING1=y >> configs/debian_defconfig + echo CONFIG_UBIVOL=y >> configs/debian_defconfig + echo CONFIG_SSBLSWITCH=y >> configs/debian_defconfig ++endif + else + echo "# CONFIG_MTD is not set" >> configs/debian_defconfig + endif +-- +2.30.2 + diff --git a/recipes-core/swupdate/swupdate.inc b/recipes-core/swupdate/swupdate.inc new file mode 100644 index 0000000..a7fd662 --- /dev/null +++ b/recipes-core/swupdate/swupdate.inc @@ -0,0 +1,54 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Siemens AG, 2021 +# +# Authors: +# Quirin Gylstorff <quirin.gylstorff@siemens.com> +# +# SPDX-License-Identifier: MIT + +DESCRIPTION = "swupdate utility for software updates" +HOMEPAGE= "https://github.com/sbabic/swupdate" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" + + +def get_bootloader_build_profile(d): + bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "" + if bootloader == "efibootguard": + return "pkg.swupdate.efibootguard" + if bootloader == "u-boot": + return "pkg.swupdate.uboot" + return "" + +SWUPDATE_BUILD_PROFILES += "${@get_bootloader_build_profile(d)}" + +def get_bootloader_dependencies(d): + bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "" + if bootloader == "efibootguard": + return "efibootguard-dev" + if bootloader == "u-boot": + if d.getVar("U_BOOT_CONFIG_PACKAGE", True) == "1": + return "libubootenv u-boot-{}-config".format(d.getVar("MACHINE", TRUE)) + else: + return "libubootenv" + return "" + +DEPENDS += "${@get_bootloader_dependencies(d)}" +DEPENDS += "${@bb.utils.contains('SWUPDATE_BUILD_PROFILES', 'mtd', 'mtd-utils', '', d)}" + +do_install_builddeps_prepend() { + export DEB_BUILD_PROFILES="${SWUPDATE_BUILD_PROFILES}" +} + +dpkg_runbuild_prepend() { + export DEB_BUILD_PROFILES="${SWUPDATE_BUILD_PROFILES}" +} + +python do_check_bootloader () { + bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "None" + if not bootloader in ["efibootguard", "u-boot"]: + bb.warn("swupdate: SWUPDATE_BOOTLOADER set to incompatible value: " + bootloader) +} +addtask check_bootloader before do_fetch diff --git a/recipes-core/swupdate/swupdate_2021.04-1+debian-gbp.bb b/recipes-core/swupdate/swupdate_2021.04-1+debian-gbp.bb new file mode 100644 index 0000000..3b8da36 --- /dev/null +++ b/recipes-core/swupdate/swupdate_2021.04-1+debian-gbp.bb @@ -0,0 +1,47 @@ +# +# CIP Core, generic profile +# +# Copyright (c) Siemens AG, 2021 +# +# Authors: +# Quirin Gylstorff <quirin.gylstorff@siemens.com> +# +# SPDX-License-Identifier: MIT + +inherit dpkg-gbp + +include swupdate.inc + +SRC_URI = "git://salsa.debian.org/debian/swupdate.git;protocol=https;branch=debian/master" +SRCREV ="debian/2021.04-1" + +# add options to DEB_BUILD_PROFILES +SRC_URI += "file://0001-debian-Add-option-to-build-with-efibootguard.patch \ +file://0002-debian-rules-Add-CONFIG_MTD.patch \ +file://0003-debian-config-Make-signing-optional.patch \ +file://0004-debian-config-Make-image-encryption-optional.patch \ +file://0005-debian-rules-Add-option-to-disable-fs-creation.patch \ +file://0006-debian-rules-Add-option-to-disable-webserver.patch \ +file://0007-debian-Make-CONFIG_HW_COMPATIBILTY-optional.patch \ +file://0008-debian-rules-Add-Embedded-Lua-handler-option.patch" + +# deactivate signing and encryption for simple a/b rootfs update +SWUPDATE_BUILD_PROFILES += "pkg.swupdate.nosigning pkg.swupdate.noencryption" + +# If the luahandler shall be embedded into the swupdate binary +# include the following lines. +# DEPENDS += "swupdate-handlers" +# GBP_DEPENDS += "swupdate-handlers" +# SWUPDATE_BUILD_PROFILES += "pkg.swupdate.embeddedlua" + +# modify for debian buster build +SRC_URI_append_cip-core-buster = " file://0009-debian-prepare-build-for-isar-debian-buster.patch" + +# disable documentation due to missing packages in debian buster +# disable create filesystem due to missing symbols in debian buster +# disable webserver due to missing symbols in debian buster +SWUPDATE_BUILD_PROFILES_append_cip-core-buster = " nodoc \ + pkg.swupdate.nocreatefs \ + pkg.swupdate.nowebserver " +# set compression to xz +GBP_EXTRA_OPTIONS += "--git-compression=xz"