diff mbox series

[isar-cip-core,v2] swupdate: Add recipe for 2022.12 for bullseye and buster

Message ID 20230511153938.860495-1-Quirin.Gylstorff@siemens.com (mailing list archive)
State Superseded
Headers show
Series [isar-cip-core,v2] swupdate: Add recipe for 2022.12 for bullseye and buster | expand

Commit Message

Quirin Gylstorff May 11, 2023, 3:39 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows modified swupdate builds in cip-core. It also
adds the option to use suricatta-lua instead of the default
suricatta-hawkbit to communicate with a webserver.

`suricatta-lua` is currently in use for internal projects. Some of these
projects are planned to be released as open source.

To enable suricatta-lua add the following line to the local.conf:
```
OVERRIDE .= " :suricatta-lua"
```
or add the following line to the swupdate recipe.
```
DEB_BUILD_PROFILES += "pkg.swupdate.suricattalua"
```

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
Changes v2:
 - Add usage of `suricatta-lua` the to commit message
 - Add missing space to DEB_BUILD_PROFILES

 conf/distro/cip-core-bookworm.conf            |  1 +
 conf/distro/cip-core-bullseye.conf            |  4 +++
 conf/distro/cip-core-buster.conf              |  1 +
 ...eferences.swupdate-bullseye-backports.conf |  3 ++
 kas/opt/swupdate.yml                          |  1 +
 ...d-rules-Add-option-for-suricatta_lua.patch | 30 ++++++++++++++++
 .../swupdate/swupdate_2022.12+dfsg-4-gbp.bb   | 35 +++++++++++++++++++
 7 files changed, 75 insertions(+)
 create mode 100644 conf/distro/preferences.swupdate-bullseye-backports.conf
 create mode 100644 recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
 create mode 100644 recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb

Comments

Jan Kiszka May 14, 2023, 10:54 a.m. UTC | #1
On 11.05.23 17:39, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This allows modified swupdate builds in cip-core. It also
> adds the option to use suricatta-lua instead of the default
> suricatta-hawkbit to communicate with a webserver.
> 
> `suricatta-lua` is currently in use for internal projects. Some of these
> projects are planned to be released as open source.
> 
> To enable suricatta-lua add the following line to the local.conf:
> ```
> OVERRIDE .= " :suricatta-lua"
> ```

I think, this is a bit overkill, given that only one switch needs to be
flipped in an own swupdate_%.bbappend file.

> or add the following line to the swupdate recipe.
> ```
> DEB_BUILD_PROFILES += "pkg.swupdate.suricattalua"
> ```
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
> Changes v2:
>  - Add usage of `suricatta-lua` the to commit message
>  - Add missing space to DEB_BUILD_PROFILES
> 
>  conf/distro/cip-core-bookworm.conf            |  1 +
>  conf/distro/cip-core-bullseye.conf            |  4 +++
>  conf/distro/cip-core-buster.conf              |  1 +
>  ...eferences.swupdate-bullseye-backports.conf |  3 ++
>  kas/opt/swupdate.yml                          |  1 +
>  ...d-rules-Add-option-for-suricatta_lua.patch | 30 ++++++++++++++++
>  .../swupdate/swupdate_2022.12+dfsg-4-gbp.bb   | 35 +++++++++++++++++++
>  7 files changed, 75 insertions(+)
>  create mode 100644 conf/distro/preferences.swupdate-bullseye-backports.conf
>  create mode 100644 recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
>  create mode 100644 recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
> 
> diff --git a/conf/distro/cip-core-bookworm.conf b/conf/distro/cip-core-bookworm.conf
> index de2e435..f05d3d3 100644
> --- a/conf/distro/cip-core-bookworm.conf
> +++ b/conf/distro/cip-core-bookworm.conf
> @@ -12,5 +12,6 @@
>  require conf/distro/debian-bookworm.conf
>  require cip-core-common.inc
>  
> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>  PREFERRED_VERSION_linux-cip ?= "5.10.%"
>  PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
> diff --git a/conf/distro/cip-core-bullseye.conf b/conf/distro/cip-core-bullseye.conf
> index 3a0550c..9c83054 100644
> --- a/conf/distro/cip-core-bullseye.conf
> +++ b/conf/distro/cip-core-bullseye.conf
> @@ -12,5 +12,9 @@
>  require conf/distro/debian-bullseye.conf
>  require cip-core-common.inc
>  
> +DISTRO_APT_SOURCES:append:swupdate = " conf/distro/debian-bullseye-backports.list"
> +DISTRO_APT_PREFERENCES:append:swupdate = " conf/distro/preferences.swupdate-bullseye-backports.conf"
> +
> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>  PREFERRED_VERSION_linux-cip ?= "5.10.%"
>  PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
> diff --git a/conf/distro/cip-core-buster.conf b/conf/distro/cip-core-buster.conf
> index c5cb39c..4e9a4a7 100644
> --- a/conf/distro/cip-core-buster.conf
> +++ b/conf/distro/cip-core-buster.conf
> @@ -12,5 +12,6 @@
>  require conf/distro/debian-buster.conf
>  require cip-core-common.inc
>  
> +PREFERRED_VERSION_swupdate ?= "2021.11%"

Err, the subject says that buster is also using 2022.12. Confused.

>  PREFERRED_VERSION_linux-cip ?= "4.19.%"
>  PREFERRED_VERSION_linux-cip-rt ?= "4.19.%"
> diff --git a/conf/distro/preferences.swupdate-bullseye-backports.conf b/conf/distro/preferences.swupdate-bullseye-backports.conf
> new file mode 100644
> index 0000000..a2377bb
> --- /dev/null
> +++ b/conf/distro/preferences.swupdate-bullseye-backports.conf
> @@ -0,0 +1,3 @@
> +Package: dh-nodejs
> +Pin: release n=bullseye-backports
> +Pin-Priority: 801
> diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml
> index 29b7dd6..1528b09 100644
> --- a/kas/opt/swupdate.yml
> +++ b/kas/opt/swupdate.yml
> @@ -17,6 +17,7 @@ header:
>  local_conf_header:
>    image-option-swupdate: |
>      CIP_IMAGE_OPTIONS:append = " swupdate.inc"
> +    OVERRIDES .= ":swupdate"
>  
>    wic-swu: |
>      IMAGE_TYPEDEP:wic += "squashfs"
> diff --git a/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
> new file mode 100644
> index 0000000..0be5a71
> --- /dev/null
> +++ b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
> @@ -0,0 +1,30 @@
> +From 00fc691802e671594cea1d0a5e880d255e04b7f0 Mon Sep 17 00:00:00 2001
> +From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +Date: Wed, 3 May 2023 16:02:37 +0200
> +Subject: [PATCH] d/rules: Add option for suricatta_lua
> +
> +This allows to use lua plugins as suricatta backends. It is optional
> +as it overrides the default HAWKBIT backend.
> +
> +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +---
> + debian/rules | 3 +++
> + 1 file changed, 3 insertions(+)
> +
> +diff --git a/debian/rules b/debian/rules
> +index 57da4ca7..91106fbd 100755
> +--- a/debian/rules
> ++++ b/debian/rules
> +@@ -56,6 +56,9 @@ endif
> + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES)))
> + 	echo CONFIG_PKCS11=y >> configs/debian_defconfig
> + endif
> ++ifneq (,$(filter pkg.swupdate.suricattalua,$(DEB_BUILD_PROFILES)))
> ++	echo CONFIG_SURICATTA_LUA=y >> configs/debian_defconfig
> ++endif
> + ifneq (,$(LUA_VERSION))
> + 	echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig
> + 	echo CONFIG_LUASCRIPTHANDLER=y           >> configs/debian_defconfig
> +-- 
> +2.39.2
> +
> diff --git a/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
> new file mode 100644
> index 0000000..f5478a3
> --- /dev/null
> +++ b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
> @@ -0,0 +1,35 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Siemens AG, 2023
> +#
> +# Authors:
> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +
> +inherit dpkg-gbp
> +
> +require swupdate.inc
> +
> +DEPENDS += "libebgenv-dev"
> +
> +DEB_BUILD_PROFILES += "nodoc"
> +DEB_BUILD_OPTIONS += "nodoc"
> +
> +SRC_URI = "git://salsa.debian.org/debian/swupdate.git;protocol=https;branch=debian/master"
> +SRCREV ="aa9edf070567fa5b3e942c270633a8feef49dad8"
> +SRC_URI += "file://0001-d-rules-Add-option-for-suricatta_lua.patch"
> +
> +# deactivate signing and hardware compability for simple a/b rootfs update
> +DEB_BUILD_PROFILES += "pkg.swupdate.nosigning"
> +DEB_BUILD_PROFILES += "pkg.swupdate.nohwcompat"
> +DEB_BUILD_PROFILES:append:suricatta-lua = " pkg.swupdate.suricattalua"
> +
> +# Disable cross for arm and arm64 on bullseye
> +ISAR_CROSS_COMPILE:bullseye = "0"

Why that?

> +
> +# add cross build and deactivate testing for arm based builds

Does this comment apply to both lines above?

> +DEB_BUILD_PROFILES += "cross nocheck"
> +DEB_BUILD_PROFILES:append:bullseye = " pkg.swupdate.bpo"

Or what does the last line?

> +

Jan
Felix Moessbauer May 15, 2023, 2:29 a.m. UTC | #2
On Thu, 2023-05-11 at 17:39 +0200, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This allows modified swupdate builds in cip-core. It also
> adds the option to use suricatta-lua instead of the default
> suricatta-hawkbit to communicate with a webserver.
> 
> `suricatta-lua` is currently in use for internal projects. Some of
> these
> projects are planned to be released as open source.
> 
> To enable suricatta-lua add the following line to the local.conf:
> ```
> OVERRIDE .= " :suricatta-lua"
> ```
> or add the following line to the swupdate recipe.
> ```
> DEB_BUILD_PROFILES += "pkg.swupdate.suricattalua"
> ```
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
> Changes v2:
>  - Add usage of `suricatta-lua` the to commit message
>  - Add missing space to DEB_BUILD_PROFILES
> 
>  conf/distro/cip-core-bookworm.conf            |  1 +
>  conf/distro/cip-core-bullseye.conf            |  4 +++
>  conf/distro/cip-core-buster.conf              |  1 +
>  ...eferences.swupdate-bullseye-backports.conf |  3 ++
>  kas/opt/swupdate.yml                          |  1 +
>  ...d-rules-Add-option-for-suricatta_lua.patch | 30 ++++++++++++++++
>  .../swupdate/swupdate_2022.12+dfsg-4-gbp.bb   | 35
> +++++++++++++++++++
>  7 files changed, 75 insertions(+)
>  create mode 100644 conf/distro/preferences.swupdate-bullseye-
> backports.conf
>  create mode 100644 recipes-core/swupdate/files/0001-d-rules-Add-
> option-for-suricatta_lua.patch
>  create mode 100644 recipes-core/swupdate/swupdate_2022.12+dfsg-4-
> gbp.bb
> 
> diff --git a/conf/distro/cip-core-bookworm.conf b/conf/distro/cip-
> core-bookworm.conf
> index de2e435..f05d3d3 100644
> --- a/conf/distro/cip-core-bookworm.conf
> +++ b/conf/distro/cip-core-bookworm.conf
> @@ -12,5 +12,6 @@
>  require conf/distro/debian-bookworm.conf
>  require cip-core-common.inc
>  
> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>  PREFERRED_VERSION_linux-cip ?= "5.10.%"
>  PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
> diff --git a/conf/distro/cip-core-bullseye.conf b/conf/distro/cip-
> core-bullseye.conf
> index 3a0550c..9c83054 100644
> --- a/conf/distro/cip-core-bullseye.conf
> +++ b/conf/distro/cip-core-bullseye.conf
> @@ -12,5 +12,9 @@
>  require conf/distro/debian-bullseye.conf
>  require cip-core-common.inc
>  
> +DISTRO_APT_SOURCES:append:swupdate = " conf/distro/debian-bullseye-
> backports.list"
> +DISTRO_APT_PREFERENCES:append:swupdate = "
> conf/distro/preferences.swupdate-bullseye-backports.conf"
> +
> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>  PREFERRED_VERSION_linux-cip ?= "5.10.%"
>  PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
> diff --git a/conf/distro/cip-core-buster.conf b/conf/distro/cip-core-
> buster.conf
> index c5cb39c..4e9a4a7 100644
> --- a/conf/distro/cip-core-buster.conf
> +++ b/conf/distro/cip-core-buster.conf
> @@ -12,5 +12,6 @@
>  require conf/distro/debian-buster.conf
>  require cip-core-common.inc
>  
> +PREFERRED_VERSION_swupdate ?= "2021.11%"
>  PREFERRED_VERSION_linux-cip ?= "4.19.%"
>  PREFERRED_VERSION_linux-cip-rt ?= "4.19.%"
> diff --git a/conf/distro/preferences.swupdate-bullseye-backports.conf
> b/conf/distro/preferences.swupdate-bullseye-backports.conf
> new file mode 100644
> index 0000000..a2377bb
> --- /dev/null
> +++ b/conf/distro/preferences.swupdate-bullseye-backports.conf
> @@ -0,0 +1,3 @@
> +Package: dh-nodejs
> +Pin: release n=bullseye-backports
> +Pin-Priority: 801
> diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml
> index 29b7dd6..1528b09 100644
> --- a/kas/opt/swupdate.yml
> +++ b/kas/opt/swupdate.yml
> @@ -17,6 +17,7 @@ header:
>  local_conf_header:
>    image-option-swupdate: |
>      CIP_IMAGE_OPTIONS:append = " swupdate.inc"
> +    OVERRIDES .= ":swupdate"
>  
>    wic-swu: |
>      IMAGE_TYPEDEP:wic += "squashfs"
> diff --git a/recipes-core/swupdate/files/0001-d-rules-Add-option-for-
> suricatta_lua.patch b/recipes-core/swupdate/files/0001-d-rules-Add-
> option-for-suricatta_lua.patch
> new file mode 100644
> index 0000000..0be5a71
> --- /dev/null
> +++ b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-
> suricatta_lua.patch
> @@ -0,0 +1,30 @@
> +From 00fc691802e671594cea1d0a5e880d255e04b7f0 Mon Sep 17 00:00:00
> 2001
> +From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +Date: Wed, 3 May 2023 16:02:37 +0200
> +Subject: [PATCH] d/rules: Add option for suricatta_lua
> +
> +This allows to use lua plugins as suricatta backends. It is optional
> +as it overrides the default HAWKBIT backend.

Can't we fix that in upstream debian? The idea would be to have a
multi-package build with different configurations? Then, we would not
need the patching of the debian/rules file in cip-core. All these build
profiles are problematic, as they generate different configurations of
the same package, also with the same name.

Ideally, we could even fix that in swupdate itself by making these
options runtime configurable.

Felix

> +
> +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +---
> + debian/rules | 3 +++
> + 1 file changed, 3 insertions(+)
> +
> +diff --git a/debian/rules b/debian/rules
> +index 57da4ca7..91106fbd 100755
> +--- a/debian/rules
> ++++ b/debian/rules
> +@@ -56,6 +56,9 @@ endif
> + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES)))
> +       echo CONFIG_PKCS11=y >> configs/debian_defconfig
> + endif
> ++ifneq (,$(filter pkg.swupdate.suricattalua,$(DEB_BUILD_PROFILES)))
> ++      echo CONFIG_SURICATTA_LUA=y >> configs/debian_defconfig
> ++endif
> + ifneq (,$(LUA_VERSION))
> +       echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >>
> configs/debian_defconfig
> +       echo CONFIG_LUASCRIPTHANDLER=y           >>
> configs/debian_defconfig
> +-- 
> +2.39.2
> +
> diff --git a/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
> b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
> new file mode 100644
> index 0000000..f5478a3
> --- /dev/null
> +++ b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
> @@ -0,0 +1,35 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Siemens AG, 2023
> +#
> +# Authors:
> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +
> +inherit dpkg-gbp
> +
> +require swupdate.inc
> +
> +DEPENDS += "libebgenv-dev"
> +
> +DEB_BUILD_PROFILES += "nodoc"
> +DEB_BUILD_OPTIONS += "nodoc"
> +
> +SRC_URI =
> "git://salsa.debian.org/debian/swupdate.git;protocol=https;branch=deb
> ian/master"
> +SRCREV ="aa9edf070567fa5b3e942c270633a8feef49dad8"
> +SRC_URI += "file://0001-d-rules-Add-option-for-suricatta_lua.patch"
> +
> +# deactivate signing and hardware compability for simple a/b rootfs
> update
> +DEB_BUILD_PROFILES += "pkg.swupdate.nosigning"
> +DEB_BUILD_PROFILES += "pkg.swupdate.nohwcompat"
> +DEB_BUILD_PROFILES:append:suricatta-lua = "
> pkg.swupdate.suricattalua"
> +
> +# Disable cross for arm and arm64 on bullseye
> +ISAR_CROSS_COMPILE:bullseye = "0"
> +
> +# add cross build and deactivate testing for arm based builds
> +DEB_BUILD_PROFILES += "cross nocheck"
> +DEB_BUILD_PROFILES:append:bullseye = " pkg.swupdate.bpo"
> +
Quirin Gylstorff May 15, 2023, 7:08 a.m. UTC | #3
On 5/15/23 04:29, MOESSBAUER, Felix (T CED INW-CN) wrote:
> On Thu, 2023-05-11 at 17:39 +0200, Quirin Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> This allows modified swupdate builds in cip-core. It also
>> adds the option to use suricatta-lua instead of the default
>> suricatta-hawkbit to communicate with a webserver.
>>
>> `suricatta-lua` is currently in use for internal projects. Some of
>> these
>> projects are planned to be released as open source.
>>
>> To enable suricatta-lua add the following line to the local.conf:
>> ```
>> OVERRIDE .= " :suricatta-lua"
>> ```
>> or add the following line to the swupdate recipe.
>> ```
>> DEB_BUILD_PROFILES += "pkg.swupdate.suricattalua"
>> ```
>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>> Changes v2:
>>   - Add usage of `suricatta-lua` the to commit message
>>   - Add missing space to DEB_BUILD_PROFILES
>>
>>   conf/distro/cip-core-bookworm.conf            |  1 +
>>   conf/distro/cip-core-bullseye.conf            |  4 +++
>>   conf/distro/cip-core-buster.conf              |  1 +
>>   ...eferences.swupdate-bullseye-backports.conf |  3 ++
>>   kas/opt/swupdate.yml                          |  1 +
>>   ...d-rules-Add-option-for-suricatta_lua.patch | 30 ++++++++++++++++
>>   .../swupdate/swupdate_2022.12+dfsg-4-gbp.bb   | 35
>> +++++++++++++++++++
>>   7 files changed, 75 insertions(+)
>>   create mode 100644 conf/distro/preferences.swupdate-bullseye-
>> backports.conf
>>   create mode 100644 recipes-core/swupdate/files/0001-d-rules-Add-
>> option-for-suricatta_lua.patch
>>   create mode 100644 recipes-core/swupdate/swupdate_2022.12+dfsg-4-
>> gbp.bb
>>
>> diff --git a/conf/distro/cip-core-bookworm.conf b/conf/distro/cip-
>> core-bookworm.conf
>> index de2e435..f05d3d3 100644
>> --- a/conf/distro/cip-core-bookworm.conf
>> +++ b/conf/distro/cip-core-bookworm.conf
>> @@ -12,5 +12,6 @@
>>   require conf/distro/debian-bookworm.conf
>>   require cip-core-common.inc
>>
>> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>>   PREFERRED_VERSION_linux-cip ?= "5.10.%"
>>   PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
>> diff --git a/conf/distro/cip-core-bullseye.conf b/conf/distro/cip-
>> core-bullseye.conf
>> index 3a0550c..9c83054 100644
>> --- a/conf/distro/cip-core-bullseye.conf
>> +++ b/conf/distro/cip-core-bullseye.conf
>> @@ -12,5 +12,9 @@
>>   require conf/distro/debian-bullseye.conf
>>   require cip-core-common.inc
>>
>> +DISTRO_APT_SOURCES:append:swupdate = " conf/distro/debian-bullseye-
>> backports.list"
>> +DISTRO_APT_PREFERENCES:append:swupdate = "
>> conf/distro/preferences.swupdate-bullseye-backports.conf"
>> +
>> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>>   PREFERRED_VERSION_linux-cip ?= "5.10.%"
>>   PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
>> diff --git a/conf/distro/cip-core-buster.conf b/conf/distro/cip-core-
>> buster.conf
>> index c5cb39c..4e9a4a7 100644
>> --- a/conf/distro/cip-core-buster.conf
>> +++ b/conf/distro/cip-core-buster.conf
>> @@ -12,5 +12,6 @@
>>   require conf/distro/debian-buster.conf
>>   require cip-core-common.inc
>>
>> +PREFERRED_VERSION_swupdate ?= "2021.11%"
>>   PREFERRED_VERSION_linux-cip ?= "4.19.%"
>>   PREFERRED_VERSION_linux-cip-rt ?= "4.19.%"
>> diff --git a/conf/distro/preferences.swupdate-bullseye-backports.conf
>> b/conf/distro/preferences.swupdate-bullseye-backports.conf
>> new file mode 100644
>> index 0000000..a2377bb
>> --- /dev/null
>> +++ b/conf/distro/preferences.swupdate-bullseye-backports.conf
>> @@ -0,0 +1,3 @@
>> +Package: dh-nodejs
>> +Pin: release n=bullseye-backports
>> +Pin-Priority: 801
>> diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml
>> index 29b7dd6..1528b09 100644
>> --- a/kas/opt/swupdate.yml
>> +++ b/kas/opt/swupdate.yml
>> @@ -17,6 +17,7 @@ header:
>>   local_conf_header:
>>     image-option-swupdate: |
>>       CIP_IMAGE_OPTIONS:append = " swupdate.inc"
>> +    OVERRIDES .= ":swupdate"
>>
>>     wic-swu: |
>>       IMAGE_TYPEDEP:wic += "squashfs"
>> diff --git a/recipes-core/swupdate/files/0001-d-rules-Add-option-for-
>> suricatta_lua.patch b/recipes-core/swupdate/files/0001-d-rules-Add-
>> option-for-suricatta_lua.patch
>> new file mode 100644
>> index 0000000..0be5a71
>> --- /dev/null
>> +++ b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-
>> suricatta_lua.patch
>> @@ -0,0 +1,30 @@
>> +From 00fc691802e671594cea1d0a5e880d255e04b7f0 Mon Sep 17 00:00:00
>> 2001
>> +From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> +Date: Wed, 3 May 2023 16:02:37 +0200
>> +Subject: [PATCH] d/rules: Add option for suricatta_lua
>> +
>> +This allows to use lua plugins as suricatta backends. It is optional
>> +as it overrides the default HAWKBIT backend.
> 
> Can't we fix that in upstream debian? The idea would be to have a
> multi-package build with different configurations? Then, we would not
> need the patching of the debian/rules file in cip-core. All these build
> profiles are problematic, as they generate different configurations of
> the same package, also with the same name.
> 
> Ideally, we could even fix that in swupdate itself by making these
> options runtime configurable.
> 
> Felix

Currently there is no upstream use case for suricatta-lua. Also a 
runtime option should be added with the next SWUpdate release[1].

[1]: https://groups.google.com/g/swupdate/c/qLHm6iIMdMQ

Quirin

> 
>> +
>> +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> +---
>> + debian/rules | 3 +++
>> + 1 file changed, 3 insertions(+)
>> +
>> +diff --git a/debian/rules b/debian/rules
>> +index 57da4ca7..91106fbd 100755
>> +--- a/debian/rules
>> ++++ b/debian/rules
>> +@@ -56,6 +56,9 @@ endif
>> + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES)))
>> +       echo CONFIG_PKCS11=y >> configs/debian_defconfig
>> + endif
>> ++ifneq (,$(filter pkg.swupdate.suricattalua,$(DEB_BUILD_PROFILES)))
>> ++      echo CONFIG_SURICATTA_LUA=y >> configs/debian_defconfig
>> ++endif
>> + ifneq (,$(LUA_VERSION))
>> +       echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >>
>> configs/debian_defconfig
>> +       echo CONFIG_LUASCRIPTHANDLER=y           >>
>> configs/debian_defconfig
>> +--
>> +2.39.2
>> +
>> diff --git a/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
>> b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
>> new file mode 100644
>> index 0000000..f5478a3
>> --- /dev/null
>> +++ b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
>> @@ -0,0 +1,35 @@
>> +#
>> +# CIP Core, generic profile
>> +#
>> +# Copyright (c) Siemens AG, 2023
>> +#
>> +# Authors:
>> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> +#
>> +# SPDX-License-Identifier: MIT
>> +
>> +inherit dpkg-gbp
>> +
>> +require swupdate.inc
>> +
>> +DEPENDS += "libebgenv-dev"
>> +
>> +DEB_BUILD_PROFILES += "nodoc"
>> +DEB_BUILD_OPTIONS += "nodoc"
>> +
>> +SRC_URI =
>> "git://salsa.debian.org/debian/swupdate.git;protocol=https;branch=deb
>> ian/master"
>> +SRCREV ="aa9edf070567fa5b3e942c270633a8feef49dad8"
>> +SRC_URI += "file://0001-d-rules-Add-option-for-suricatta_lua.patch"
>> +
>> +# deactivate signing and hardware compability for simple a/b rootfs
>> update
>> +DEB_BUILD_PROFILES += "pkg.swupdate.nosigning"
>> +DEB_BUILD_PROFILES += "pkg.swupdate.nohwcompat"
>> +DEB_BUILD_PROFILES:append:suricatta-lua = "
>> pkg.swupdate.suricattalua"
>> +
>> +# Disable cross for arm and arm64 on bullseye
>> +ISAR_CROSS_COMPILE:bullseye = "0"
>> +
>> +# add cross build and deactivate testing for arm based builds
>> +DEB_BUILD_PROFILES += "cross nocheck"
>> +DEB_BUILD_PROFILES:append:bullseye = " pkg.swupdate.bpo"
>> +
>
Quirin Gylstorff May 15, 2023, 7:40 a.m. UTC | #4
On 5/14/23 12:54, Jan Kiszka wrote:
> On 11.05.23 17:39, Quirin Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> This allows modified swupdate builds in cip-core. It also
>> adds the option to use suricatta-lua instead of the default
>> suricatta-hawkbit to communicate with a webserver.
>>
>> `suricatta-lua` is currently in use for internal projects. Some of these
>> projects are planned to be released as open source.
>>
>> To enable suricatta-lua add the following line to the local.conf:
>> ```
>> OVERRIDE .= " :suricatta-lua"
>> ```
> 
> I think, this is a bit overkill, given that only one switch needs to be
> flipped in an own swupdate_%.bbappend file.

Ok i will remove that option in a v3 but will add a comment into the 
swupdate recipe how to enable it.

> 
>> or add the following line to the swupdate recipe.
>> ```
>> DEB_BUILD_PROFILES += "pkg.swupdate.suricattalua"
>> ```
>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>> Changes v2:
>>   - Add usage of `suricatta-lua` the to commit message
>>   - Add missing space to DEB_BUILD_PROFILES
>>
>>   conf/distro/cip-core-bookworm.conf            |  1 +
>>   conf/distro/cip-core-bullseye.conf            |  4 +++
>>   conf/distro/cip-core-buster.conf              |  1 +
>>   ...eferences.swupdate-bullseye-backports.conf |  3 ++
>>   kas/opt/swupdate.yml                          |  1 +
>>   ...d-rules-Add-option-for-suricatta_lua.patch | 30 ++++++++++++++++
>>   .../swupdate/swupdate_2022.12+dfsg-4-gbp.bb   | 35 +++++++++++++++++++
>>   7 files changed, 75 insertions(+)
>>   create mode 100644 conf/distro/preferences.swupdate-bullseye-backports.conf
>>   create mode 100644 recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
>>   create mode 100644 recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
>>
>> diff --git a/conf/distro/cip-core-bookworm.conf b/conf/distro/cip-core-bookworm.conf
>> index de2e435..f05d3d3 100644
>> --- a/conf/distro/cip-core-bookworm.conf
>> +++ b/conf/distro/cip-core-bookworm.conf
>> @@ -12,5 +12,6 @@
>>   require conf/distro/debian-bookworm.conf
>>   require cip-core-common.inc
>>   
>> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>>   PREFERRED_VERSION_linux-cip ?= "5.10.%"
>>   PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
>> diff --git a/conf/distro/cip-core-bullseye.conf b/conf/distro/cip-core-bullseye.conf
>> index 3a0550c..9c83054 100644
>> --- a/conf/distro/cip-core-bullseye.conf
>> +++ b/conf/distro/cip-core-bullseye.conf
>> @@ -12,5 +12,9 @@
>>   require conf/distro/debian-bullseye.conf
>>   require cip-core-common.inc
>>   
>> +DISTRO_APT_SOURCES:append:swupdate = " conf/distro/debian-bullseye-backports.list"
>> +DISTRO_APT_PREFERENCES:append:swupdate = " conf/distro/preferences.swupdate-bullseye-backports.conf"
>> +
>> +PREFERRED_VERSION_swupdate ?= "2022.12%"
>>   PREFERRED_VERSION_linux-cip ?= "5.10.%"
>>   PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
>> diff --git a/conf/distro/cip-core-buster.conf b/conf/distro/cip-core-buster.conf
>> index c5cb39c..4e9a4a7 100644
>> --- a/conf/distro/cip-core-buster.conf
>> +++ b/conf/distro/cip-core-buster.conf
>> @@ -12,5 +12,6 @@
>>   require conf/distro/debian-buster.conf
>>   require cip-core-common.inc
>>   
>> +PREFERRED_VERSION_swupdate ?= "2021.11%"
> 
> Err, the subject says that buster is also using 2022.12. Confused.
> 
>>   PREFERRED_VERSION_linux-cip ?= "4.19.%"
>>   PREFERRED_VERSION_linux-cip-rt ?= "4.19.%"
>> diff --git a/conf/distro/preferences.swupdate-bullseye-backports.conf b/conf/distro/preferences.swupdate-bullseye-backports.conf
>> new file mode 100644
>> index 0000000..a2377bb
>> --- /dev/null
>> +++ b/conf/distro/preferences.swupdate-bullseye-backports.conf
>> @@ -0,0 +1,3 @@
>> +Package: dh-nodejs
>> +Pin: release n=bullseye-backports
>> +Pin-Priority: 801
>> diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml
>> index 29b7dd6..1528b09 100644
>> --- a/kas/opt/swupdate.yml
>> +++ b/kas/opt/swupdate.yml
>> @@ -17,6 +17,7 @@ header:
>>   local_conf_header:
>>     image-option-swupdate: |
>>       CIP_IMAGE_OPTIONS:append = " swupdate.inc"
>> +    OVERRIDES .= ":swupdate"
>>   
>>     wic-swu: |
>>       IMAGE_TYPEDEP:wic += "squashfs"
>> diff --git a/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
>> new file mode 100644
>> index 0000000..0be5a71
>> --- /dev/null
>> +++ b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
>> @@ -0,0 +1,30 @@
>> +From 00fc691802e671594cea1d0a5e880d255e04b7f0 Mon Sep 17 00:00:00 2001
>> +From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> +Date: Wed, 3 May 2023 16:02:37 +0200
>> +Subject: [PATCH] d/rules: Add option for suricatta_lua
>> +
>> +This allows to use lua plugins as suricatta backends. It is optional
>> +as it overrides the default HAWKBIT backend.
>> +
>> +Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> +---
>> + debian/rules | 3 +++
>> + 1 file changed, 3 insertions(+)
>> +
>> +diff --git a/debian/rules b/debian/rules
>> +index 57da4ca7..91106fbd 100755
>> +--- a/debian/rules
>> ++++ b/debian/rules
>> +@@ -56,6 +56,9 @@ endif
>> + ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES)))
>> + 	echo CONFIG_PKCS11=y >> configs/debian_defconfig
>> + endif
>> ++ifneq (,$(filter pkg.swupdate.suricattalua,$(DEB_BUILD_PROFILES)))
>> ++	echo CONFIG_SURICATTA_LUA=y >> configs/debian_defconfig
>> ++endif
>> + ifneq (,$(LUA_VERSION))
>> + 	echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig
>> + 	echo CONFIG_LUASCRIPTHANDLER=y           >> configs/debian_defconfig
>> +--
>> +2.39.2
>> +
>> diff --git a/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
>> new file mode 100644
>> index 0000000..f5478a3
>> --- /dev/null
>> +++ b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
>> @@ -0,0 +1,35 @@
>> +#
>> +# CIP Core, generic profile
>> +#
>> +# Copyright (c) Siemens AG, 2023
>> +#
>> +# Authors:
>> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> +#
>> +# SPDX-License-Identifier: MIT
>> +
>> +inherit dpkg-gbp
>> +
>> +require swupdate.inc
>> +
>> +DEPENDS += "libebgenv-dev"
>> +
>> +DEB_BUILD_PROFILES += "nodoc"
>> +DEB_BUILD_OPTIONS += "nodoc"
>> +
>> +SRC_URI = "git://salsa.debian.org/debian/swupdate.git;protocol=https;branch=debian/master"
>> +SRCREV ="aa9edf070567fa5b3e942c270633a8feef49dad8"
>> +SRC_URI += "file://0001-d-rules-Add-option-for-suricatta_lua.patch"
>> +
>> +# deactivate signing and hardware compability for simple a/b rootfs update
>> +DEB_BUILD_PROFILES += "pkg.swupdate.nosigning"
>> +DEB_BUILD_PROFILES += "pkg.swupdate.nohwcompat"
>> +DEB_BUILD_PROFILES:append:suricatta-lua = " pkg.swupdate.suricattalua"
>> +
>> +# Disable cross for arm and arm64 on bullseye
>> +ISAR_CROSS_COMPILE:bullseye = "0"
> 
> Why that?

If I try to cross compile it we a have a unsatisfied dependency to 
dh-nodejs. I am look into it on ISAR if this is a reoccuring problem 
with cross-compile.

> 
>> +
>> +# add cross build and deactivate testing for arm based builds
> 
> Does this comment apply to both lines above?
> 
No it is only for the next comment.

>> +DEB_BUILD_PROFILES += "cross nocheck"
>> +DEB_BUILD_PROFILES:append:bullseye = " pkg.swupdate.bpo"
> 
> Or what does the last line?
This will use the backports option to build SWUpdate for Debian bullseye.

Quirin
Storm, Christian May 22, 2023, 7:32 a.m. UTC | #5
Hi,

> > diff --git a/recipes-core/swupdate/files/0001-d-rules-Add-option-for-
> > suricatta_lua.patch b/recipes-core/swupdate/files/0001-d-rules-Add-
> > option-for-suricatta_lua.patch
> > new file mode 100644
> > index 0000000..0be5a71
> > --- /dev/null
> > +++ b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-
> > suricatta_lua.patch
> > @@ -0,0 +1,30 @@
> > +From 00fc691802e671594cea1d0a5e880d255e04b7f0 Mon Sep 17 00:00:00
> > 2001
> > +From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > +Date: Wed, 3 May 2023 16:02:37 +0200
> > +Subject: [PATCH] d/rules: Add option for suricatta_lua
> > +
> > +This allows to use lua plugins as suricatta backends. It is optional
> > +as it overrides the default HAWKBIT backend.
> 
> Can't we fix that in upstream debian? The idea would be to have a
> multi-package build with different configurations? Then, we would not
> need the patching of the debian/rules file in cip-core. All these build
> profiles are problematic, as they generate different configurations of
> the same package, also with the same name.
> 
> Ideally, we could even fix that in swupdate itself by making these
> options runtime configurable.

This is exactly what I did and brought upstream to SWUpdate. It's not in
a release yet but will come with the 2023.05 release. Then, you can
compile-in support for multiple backends and chose one at run-time.
Still, you have the choice to either bake in a Lua Suricatta Module (so
only one is available in addition to other Suricatta backends) or to
load it from the filesystem at run-time. Then, you have to place such
a file somewhere Lua can find it...


Kind regards,
  Christian
diff mbox series

Patch

diff --git a/conf/distro/cip-core-bookworm.conf b/conf/distro/cip-core-bookworm.conf
index de2e435..f05d3d3 100644
--- a/conf/distro/cip-core-bookworm.conf
+++ b/conf/distro/cip-core-bookworm.conf
@@ -12,5 +12,6 @@ 
 require conf/distro/debian-bookworm.conf
 require cip-core-common.inc
 
+PREFERRED_VERSION_swupdate ?= "2022.12%"
 PREFERRED_VERSION_linux-cip ?= "5.10.%"
 PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
diff --git a/conf/distro/cip-core-bullseye.conf b/conf/distro/cip-core-bullseye.conf
index 3a0550c..9c83054 100644
--- a/conf/distro/cip-core-bullseye.conf
+++ b/conf/distro/cip-core-bullseye.conf
@@ -12,5 +12,9 @@ 
 require conf/distro/debian-bullseye.conf
 require cip-core-common.inc
 
+DISTRO_APT_SOURCES:append:swupdate = " conf/distro/debian-bullseye-backports.list"
+DISTRO_APT_PREFERENCES:append:swupdate = " conf/distro/preferences.swupdate-bullseye-backports.conf"
+
+PREFERRED_VERSION_swupdate ?= "2022.12%"
 PREFERRED_VERSION_linux-cip ?= "5.10.%"
 PREFERRED_VERSION_linux-cip-rt ?= "5.10.%"
diff --git a/conf/distro/cip-core-buster.conf b/conf/distro/cip-core-buster.conf
index c5cb39c..4e9a4a7 100644
--- a/conf/distro/cip-core-buster.conf
+++ b/conf/distro/cip-core-buster.conf
@@ -12,5 +12,6 @@ 
 require conf/distro/debian-buster.conf
 require cip-core-common.inc
 
+PREFERRED_VERSION_swupdate ?= "2021.11%"
 PREFERRED_VERSION_linux-cip ?= "4.19.%"
 PREFERRED_VERSION_linux-cip-rt ?= "4.19.%"
diff --git a/conf/distro/preferences.swupdate-bullseye-backports.conf b/conf/distro/preferences.swupdate-bullseye-backports.conf
new file mode 100644
index 0000000..a2377bb
--- /dev/null
+++ b/conf/distro/preferences.swupdate-bullseye-backports.conf
@@ -0,0 +1,3 @@ 
+Package: dh-nodejs
+Pin: release n=bullseye-backports
+Pin-Priority: 801
diff --git a/kas/opt/swupdate.yml b/kas/opt/swupdate.yml
index 29b7dd6..1528b09 100644
--- a/kas/opt/swupdate.yml
+++ b/kas/opt/swupdate.yml
@@ -17,6 +17,7 @@  header:
 local_conf_header:
   image-option-swupdate: |
     CIP_IMAGE_OPTIONS:append = " swupdate.inc"
+    OVERRIDES .= ":swupdate"
 
   wic-swu: |
     IMAGE_TYPEDEP:wic += "squashfs"
diff --git a/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
new file mode 100644
index 0000000..0be5a71
--- /dev/null
+++ b/recipes-core/swupdate/files/0001-d-rules-Add-option-for-suricatta_lua.patch
@@ -0,0 +1,30 @@ 
+From 00fc691802e671594cea1d0a5e880d255e04b7f0 Mon Sep 17 00:00:00 2001
+From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
+Date: Wed, 3 May 2023 16:02:37 +0200
+Subject: [PATCH] d/rules: Add option for suricatta_lua
+
+This allows to use lua plugins as suricatta backends. It is optional
+as it overrides the default HAWKBIT backend.
+
+Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
+---
+ debian/rules | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/debian/rules b/debian/rules
+index 57da4ca7..91106fbd 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -56,6 +56,9 @@ endif
+ ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES)))
+ 	echo CONFIG_PKCS11=y >> configs/debian_defconfig
+ endif
++ifneq (,$(filter pkg.swupdate.suricattalua,$(DEB_BUILD_PROFILES)))
++	echo CONFIG_SURICATTA_LUA=y >> configs/debian_defconfig
++endif
+ ifneq (,$(LUA_VERSION))
+ 	echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig
+ 	echo CONFIG_LUASCRIPTHANDLER=y           >> configs/debian_defconfig
+-- 
+2.39.2
+
diff --git a/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
new file mode 100644
index 0000000..f5478a3
--- /dev/null
+++ b/recipes-core/swupdate/swupdate_2022.12+dfsg-4-gbp.bb
@@ -0,0 +1,35 @@ 
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2023
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-gbp
+
+require swupdate.inc
+
+DEPENDS += "libebgenv-dev"
+
+DEB_BUILD_PROFILES += "nodoc"
+DEB_BUILD_OPTIONS += "nodoc"
+
+SRC_URI = "git://salsa.debian.org/debian/swupdate.git;protocol=https;branch=debian/master"
+SRCREV ="aa9edf070567fa5b3e942c270633a8feef49dad8"
+SRC_URI += "file://0001-d-rules-Add-option-for-suricatta_lua.patch"
+
+# deactivate signing and hardware compability for simple a/b rootfs update
+DEB_BUILD_PROFILES += "pkg.swupdate.nosigning"
+DEB_BUILD_PROFILES += "pkg.swupdate.nohwcompat"
+DEB_BUILD_PROFILES:append:suricatta-lua = " pkg.swupdate.suricattalua"
+
+# Disable cross for arm and arm64 on bullseye
+ISAR_CROSS_COMPILE:bullseye = "0"
+
+# add cross build and deactivate testing for arm based builds
+DEB_BUILD_PROFILES += "cross nocheck"
+DEB_BUILD_PROFILES:append:bullseye = " pkg.swupdate.bpo"
+