diff mbox series

[isar-cip-core,v5,4/7] swupdate.bbclass: Add SWU_EXTEND_SW_DESCRIPTION

Message ID 20240111200015.190376-5-Quirin.Gylstorff@siemens.com (mailing list archive)
State Accepted
Headers show
Series Add Bootloader to sw-description | expand

Commit Message

Gylstorff Quirin Jan. 11, 2024, 7:59 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

The elements of the new variable are called as functions. This
allows the user to extend the sw-description file with new template
variables and new entries.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 classes/swupdate.bbclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass
index 117f9fe..dfe8ef1 100644
--- a/classes/swupdate.bbclass
+++ b/classes/swupdate.bbclass
@@ -53,6 +53,16 @@  IMAGE_TEMPLATE_VARS:swu = " \
 addtask do_transform_template after do_generate_image_uuid
 
 python(){
+    cmds = d.getVar("SWU_EXTEND_SW_DESCRIPTION")
+    if cmds is None or not cmds.strip():
+        return
+    cmds = cmds.split()
+    for cmd in cmds:
+        bb.build.exec_func(cmd, d)
+}
+
+SWU_EXTEND_SW_DESCRIPTION += "add_swu_hw_compat"
+python add_swu_hw_compat(){
     # create SWU_HW_COMPAT_NODE based on list of supported hw
     hw_compat = d.getVar('SWU_HW_COMPAT')
     if hw_compat:
@@ -61,7 +71,10 @@  python(){
             'hardware-compatibility: [ ' + hw_entries +' ];')
     else:
         d.setVar('SWU_HW_COMPAT_NODE', '')
+}
 
+SWU_EXTEND_SW_DESCRIPTION += "add_swu_compression"
+python add_swu_compression(){
     # create SWU_COMPRESSION_NODE node if compression is enabled
     calgo = d.getVar('SWU_COMPRESSION_TYPE')
     if calgo: