diff mbox series

[isar-cip-core,v4,1/4] swupdate-config: move swupdate.cfg from customizations to own recipe

Message ID 20240304105453.984881-2-Quirin.Gylstorff@siemens.com (mailing list archive)
State Accepted
Headers show
Series Reduce difference to debian | expand

Commit Message

Gylstorff Quirin March 4, 2024, 10:54 a.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows downstream customizations without including unwanted
packages.

It also adds the new variable `MACHINE_HW_VERSION` to check the
compatibility between machine/image and the swupdate file.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 recipes-core/customizations/common.inc        |  8 ++----
 .../swupdate-config/files/hwrevision.tmpl     |  1 +
 .../files/swupdate.cfg                        |  0
 .../swupdate-config/swupdate-config_0.1.bb    | 27 +++++++++++++++++++
 4 files changed, 30 insertions(+), 6 deletions(-)
 create mode 100644 recipes-core/swupdate-config/files/hwrevision.tmpl
 rename recipes-core/{customizations => swupdate-config}/files/swupdate.cfg (100%)
 create mode 100644 recipes-core/swupdate-config/swupdate-config_0.1.bb

Comments

Jan Kiszka March 6, 2024, 6:58 a.m. UTC | #1
On 04.03.24 11:54, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This allows downstream customizations without including unwanted
> packages.
> 
> It also adds the new variable `MACHINE_HW_VERSION` to check the
> compatibility between machine/image and the swupdate file.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  recipes-core/customizations/common.inc        |  8 ++----
>  .../swupdate-config/files/hwrevision.tmpl     |  1 +
>  .../files/swupdate.cfg                        |  0
>  .../swupdate-config/swupdate-config_0.1.bb    | 27 +++++++++++++++++++
>  4 files changed, 30 insertions(+), 6 deletions(-)
>  create mode 100644 recipes-core/swupdate-config/files/hwrevision.tmpl
>  rename recipes-core/{customizations => swupdate-config}/files/swupdate.cfg (100%)
>  create mode 100644 recipes-core/swupdate-config/swupdate-config_0.1.bb
> 
> diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc
> index 79bf80d..37872c1 100644
> --- a/recipes-core/customizations/common.inc
> +++ b/recipes-core/customizations/common.inc
> @@ -19,8 +19,6 @@ SRC_URI = " \
>      file://99-silent-printk.conf \
>      file://99-watchdog.conf"
>  
> -SRC_URI:append:swupdate = " file://swupdate.cfg"
> -
>  CUSTOM_HOSTNAME ??= "demo"
>  WIRELESS_FIRMWARE_PACKAGE ?= ""
>  INSTALL_WIRELESS_TOOLS ??= "0"
> @@ -29,12 +27,14 @@ TEMPLATE_FILES += "postinst.tmpl"
>  TEMPLATE_VARS += "CUSTOM_HOSTNAME"
>  
>  DEPENDS += "sshd-regen-keys change-root-homedir"
> +RDEPENDS:append:swupdate = " swupdate-config"
>  
>  DEBIAN_DEPENDS = " \
>      ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys, \
>      change-root-homedir \
>      ${@(', iw, wireless-regdb, ' + d.getVar('WIRELESS_FIRMWARE_PACKAGE')) \
>  	if d.getVar('INSTALL_WIRELESS_TOOLS') == '1' else ''}"
> +DEBIAN_DEPENDS:append:swupdate = ", swupdate-config"
>  
>  do_install() {
>  	install -v -d ${D}/etc/network/interfaces.d
> @@ -46,7 +46,3 @@ do_install() {
>  	install -v -d ${D}/etc/systemd/system.conf.d
>  	install -v -m 644 ${WORKDIR}/99-watchdog.conf ${D}/etc/systemd/system.conf.d/
>  }
> -
> -do_install:append:swupdate() {
> -	install -v -m 644 ${WORKDIR}/swupdate.cfg ${D}/etc/
> -}
> diff --git a/recipes-core/swupdate-config/files/hwrevision.tmpl b/recipes-core/swupdate-config/files/hwrevision.tmpl
> new file mode 100644
> index 0000000..1eb0996
> --- /dev/null
> +++ b/recipes-core/swupdate-config/files/hwrevision.tmpl
> @@ -0,0 +1 @@
> +cip-${MACHINE} ${MACHINE_HW_VERSION}
> diff --git a/recipes-core/customizations/files/swupdate.cfg b/recipes-core/swupdate-config/files/swupdate.cfg
> similarity index 100%
> rename from recipes-core/customizations/files/swupdate.cfg
> rename to recipes-core/swupdate-config/files/swupdate.cfg
> diff --git a/recipes-core/swupdate-config/swupdate-config_0.1.bb b/recipes-core/swupdate-config/swupdate-config_0.1.bb
> new file mode 100644
> index 0000000..6991321
> --- /dev/null
> +++ b/recipes-core/swupdate-config/swupdate-config_0.1.bb
> @@ -0,0 +1,27 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Siemens AG, 2024
> +#
> +# Authors:
> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit dpkg-raw
> +
> +SRC_URI = "file://swupdate.cfg \
> +           file://hwrevision.tmpl"
> +
> +MACHINE_HW_VERSION ??= ""
> +TEMPLATE_FILES += "hwrevision.tmpl"
> +TEMPLATE_VARS += "MACHINE MACHINE_HW_VERSION"
> +
> +do_install[cleandirs] = "${D}/etc/"
> +do_install() {
> +	install -v -m 644 "${WORKDIR}"/swupdate.cfg "${D}"/etc/
> +        if [ -n "${MACHINE_HW_VERSION}" ]; then
> +            install -v -m 644 "${WORKDIR}"/hwrevision "${D}"/etc/
> +        fi
> +}

If I'm understanding the docs correctly, the purpose of this recipe is
just to act as a placeholder when we want to use a static
/etc/hwrevision, nothing hardware derived, right? That leads to two
questions/suggestions:

 - How about a better name for this recipe? swupdate-static-hwrevision?
 - How about providing some references/examples for creating hwrevision
   dynamically?

BTW, error reporting of swupdate is by default useless when you have a
hwrevision mismatch:

[INFO ] : SWUPDATE started :  Software Update started !
[ERROR] : SWUPDATE failed [1] Image invalid or corrupted. Not installing ...

Jan
Gylstorff Quirin March 6, 2024, 8:15 a.m. UTC | #2
On 3/6/24 7:58 AM, Jan Kiszka via lists.cip-project.org wrote:
> On 04.03.24 11:54, Quirin Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> This allows downstream customizations without including unwanted
>> packages.
>>
>> It also adds the new variable `MACHINE_HW_VERSION` to check the
>> compatibility between machine/image and the swupdate file.
>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>>   recipes-core/customizations/common.inc        |  8 ++----
>>   .../swupdate-config/files/hwrevision.tmpl     |  1 +
>>   .../files/swupdate.cfg                        |  0
>>   .../swupdate-config/swupdate-config_0.1.bb    | 27 +++++++++++++++++++
>>   4 files changed, 30 insertions(+), 6 deletions(-)
>>   create mode 100644 recipes-core/swupdate-config/files/hwrevision.tmpl
>>   rename recipes-core/{customizations => swupdate-config}/files/swupdate.cfg (100%)
>>   create mode 100644 recipes-core/swupdate-config/swupdate-config_0.1.bb
>>
>> diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc
>> index 79bf80d..37872c1 100644
>> --- a/recipes-core/customizations/common.inc
>> +++ b/recipes-core/customizations/common.inc
>> @@ -19,8 +19,6 @@ SRC_URI = " \
>>       file://99-silent-printk.conf \
>>       file://99-watchdog.conf"
>>   
>> -SRC_URI:append:swupdate = " file://swupdate.cfg"
>> -
>>   CUSTOM_HOSTNAME ??= "demo"
>>   WIRELESS_FIRMWARE_PACKAGE ?= ""
>>   INSTALL_WIRELESS_TOOLS ??= "0"
>> @@ -29,12 +27,14 @@ TEMPLATE_FILES += "postinst.tmpl"
>>   TEMPLATE_VARS += "CUSTOM_HOSTNAME"
>>   
>>   DEPENDS += "sshd-regen-keys change-root-homedir"
>> +RDEPENDS:append:swupdate = " swupdate-config"
>>   
>>   DEBIAN_DEPENDS = " \
>>       ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys, \
>>       change-root-homedir \
>>       ${@(', iw, wireless-regdb, ' + d.getVar('WIRELESS_FIRMWARE_PACKAGE')) \
>>   	if d.getVar('INSTALL_WIRELESS_TOOLS') == '1' else ''}"
>> +DEBIAN_DEPENDS:append:swupdate = ", swupdate-config"
>>   
>>   do_install() {
>>   	install -v -d ${D}/etc/network/interfaces.d
>> @@ -46,7 +46,3 @@ do_install() {
>>   	install -v -d ${D}/etc/systemd/system.conf.d
>>   	install -v -m 644 ${WORKDIR}/99-watchdog.conf ${D}/etc/systemd/system.conf.d/
>>   }
>> -
>> -do_install:append:swupdate() {
>> -	install -v -m 644 ${WORKDIR}/swupdate.cfg ${D}/etc/
>> -}
>> diff --git a/recipes-core/swupdate-config/files/hwrevision.tmpl b/recipes-core/swupdate-config/files/hwrevision.tmpl
>> new file mode 100644
>> index 0000000..1eb0996
>> --- /dev/null
>> +++ b/recipes-core/swupdate-config/files/hwrevision.tmpl
>> @@ -0,0 +1 @@
>> +cip-${MACHINE} ${MACHINE_HW_VERSION}
>> diff --git a/recipes-core/customizations/files/swupdate.cfg b/recipes-core/swupdate-config/files/swupdate.cfg
>> similarity index 100%
>> rename from recipes-core/customizations/files/swupdate.cfg
>> rename to recipes-core/swupdate-config/files/swupdate.cfg
>> diff --git a/recipes-core/swupdate-config/swupdate-config_0.1.bb b/recipes-core/swupdate-config/swupdate-config_0.1.bb
>> new file mode 100644
>> index 0000000..6991321
>> --- /dev/null
>> +++ b/recipes-core/swupdate-config/swupdate-config_0.1.bb
>> @@ -0,0 +1,27 @@
>> +#
>> +# CIP Core, generic profile
>> +#
>> +# Copyright (c) Siemens AG, 2024
>> +#
>> +# Authors:
>> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> +#
>> +# SPDX-License-Identifier: MIT
>> +#
>> +
>> +inherit dpkg-raw
>> +
>> +SRC_URI = "file://swupdate.cfg \
>> +           file://hwrevision.tmpl"
>> +
>> +MACHINE_HW_VERSION ??= ""
>> +TEMPLATE_FILES += "hwrevision.tmpl"
>> +TEMPLATE_VARS += "MACHINE MACHINE_HW_VERSION"
>> +
>> +do_install[cleandirs] = "${D}/etc/"
>> +do_install() {
>> +	install -v -m 644 "${WORKDIR}"/swupdate.cfg "${D}"/etc/
>> +        if [ -n "${MACHINE_HW_VERSION}" ]; then
>> +            install -v -m 644 "${WORKDIR}"/hwrevision "${D}"/etc/
>> +        fi
>> +}
> 
> If I'm understanding the docs correctly, the purpose of this recipe is
> just to act as a placeholder when we want to use a static
> /etc/hwrevision, nothing hardware derived, right? That leads to two
> questions/suggestions:
> 
>   - How about a better name for this recipe? swupdate-static-hwrevision?
>   - How about providing some references/examples for creating hwrevision
>     dynamically?
> 
> BTW, error reporting of swupdate is by default useless when you have a
> hwrevision mismatch:
> 
> [INFO ] : SWUPDATE started :  Software Update started !
> [ERROR] : SWUPDATE failed [1] Image invalid or corrupted. Not installing ...

We can look into upstream to get that message.
Quirin

> 
> Jan
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15237): https://lists.cip-project.org/g/cip-dev/message/15237
> Mute This Topic: https://lists.cip-project.org/mt/104719596/1753640
> Group Owner: cip-dev+owner@lists.cip-project.org
> Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129121/1753640/1405269326/xyzzy [quirin.gylstorff@siemens.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc
index 79bf80d..37872c1 100644
--- a/recipes-core/customizations/common.inc
+++ b/recipes-core/customizations/common.inc
@@ -19,8 +19,6 @@  SRC_URI = " \
     file://99-silent-printk.conf \
     file://99-watchdog.conf"
 
-SRC_URI:append:swupdate = " file://swupdate.cfg"
-
 CUSTOM_HOSTNAME ??= "demo"
 WIRELESS_FIRMWARE_PACKAGE ?= ""
 INSTALL_WIRELESS_TOOLS ??= "0"
@@ -29,12 +27,14 @@  TEMPLATE_FILES += "postinst.tmpl"
 TEMPLATE_VARS += "CUSTOM_HOSTNAME"
 
 DEPENDS += "sshd-regen-keys change-root-homedir"
+RDEPENDS:append:swupdate = " swupdate-config"
 
 DEBIAN_DEPENDS = " \
     ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys, \
     change-root-homedir \
     ${@(', iw, wireless-regdb, ' + d.getVar('WIRELESS_FIRMWARE_PACKAGE')) \
 	if d.getVar('INSTALL_WIRELESS_TOOLS') == '1' else ''}"
+DEBIAN_DEPENDS:append:swupdate = ", swupdate-config"
 
 do_install() {
 	install -v -d ${D}/etc/network/interfaces.d
@@ -46,7 +46,3 @@  do_install() {
 	install -v -d ${D}/etc/systemd/system.conf.d
 	install -v -m 644 ${WORKDIR}/99-watchdog.conf ${D}/etc/systemd/system.conf.d/
 }
-
-do_install:append:swupdate() {
-	install -v -m 644 ${WORKDIR}/swupdate.cfg ${D}/etc/
-}
diff --git a/recipes-core/swupdate-config/files/hwrevision.tmpl b/recipes-core/swupdate-config/files/hwrevision.tmpl
new file mode 100644
index 0000000..1eb0996
--- /dev/null
+++ b/recipes-core/swupdate-config/files/hwrevision.tmpl
@@ -0,0 +1 @@ 
+cip-${MACHINE} ${MACHINE_HW_VERSION}
diff --git a/recipes-core/customizations/files/swupdate.cfg b/recipes-core/swupdate-config/files/swupdate.cfg
similarity index 100%
rename from recipes-core/customizations/files/swupdate.cfg
rename to recipes-core/swupdate-config/files/swupdate.cfg
diff --git a/recipes-core/swupdate-config/swupdate-config_0.1.bb b/recipes-core/swupdate-config/swupdate-config_0.1.bb
new file mode 100644
index 0000000..6991321
--- /dev/null
+++ b/recipes-core/swupdate-config/swupdate-config_0.1.bb
@@ -0,0 +1,27 @@ 
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI = "file://swupdate.cfg \
+           file://hwrevision.tmpl"
+
+MACHINE_HW_VERSION ??= ""
+TEMPLATE_FILES += "hwrevision.tmpl"
+TEMPLATE_VARS += "MACHINE MACHINE_HW_VERSION"
+
+do_install[cleandirs] = "${D}/etc/"
+do_install() {
+	install -v -m 644 "${WORKDIR}"/swupdate.cfg "${D}"/etc/
+        if [ -n "${MACHINE_HW_VERSION}" ]; then
+            install -v -m 644 "${WORKDIR}"/hwrevision "${D}"/etc/
+        fi
+}