[meta-swupdate,1/2] classes: add support for DISTRO suffix in artifact names

Message ID 20260429141258.616058-2-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • Add support for stm32mp25 boards
Related show

Commit Message

Dario Binacchi April 29, 2026, 2:12 p.m. UTC
Currently, only images containing the MACHINE name are supported. With
this change, when both SWUPDATE_IMAGES_NOAPPEND_DISTRO
and SWUPDATE_IMAGES_NOAPPEND_MACHINE are set to 0, rootfs formatted as
<image-name>-<DISTRO>-<MACHINE> will be searched too.

This is particularly useful for STMicroelectronics (OpenSTLinux)
BSPs, where the generated rootfs for a selected image always
contains both the distro and the machine names.

For example:

core-image-full-cmdline-openstlinux-weston-stm32mp25-eval.rootfs.ext4.gz

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 classes-recipe/swupdate-common.bbclass | 5 ++++-
 classes-recipe/swupdate.bbclass        | 7 ++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
index 80a5d5b2c917..a5ad10672154 100644
--- a/classes-recipe/swupdate-common.bbclass
+++ b/classes-recipe/swupdate-common.bbclass
@@ -296,8 +296,11 @@  def swupdate_add_artifacts(d, list_for_cpio):
         fstypes = (d.getVarFlag("SWUPDATE_IMAGES_FSTYPES", image) or "").split()
         encrypted = (d.getVarFlag("SWUPDATE_IMAGES_ENCRYPTED", image) or "")
         if fstypes:
+            noappend_distro = d.getVarFlag("SWUPDATE_IMAGES_NOAPPEND_DISTRO", image)
             noappend_machine = d.getVarFlag("SWUPDATE_IMAGES_NOAPPEND_MACHINE", image)
-            if noappend_machine == "0":  # Search for a file explicitly with MACHINE
+            if noappend_distro == "0" and noappend_machine == "0":  # Search for a file explicitly with DISTRO and MACHINE
+                imagebases = [ image + '-' + d.getVar('DISTRO') + '-' + d.getVar('MACHINE') ]
+            elif noappend_machine == "0":  # Search for a file explicitly with MACHINE
                 imagebases = [ image + '-' + d.getVar('MACHINE') ]
             elif noappend_machine == "1":  # Search for a file explicitly without MACHINE
                 imagebases = [ image ]
diff --git a/classes-recipe/swupdate.bbclass b/classes-recipe/swupdate.bbclass
index 5390c9b314f1..f6e500947649 100644
--- a/classes-recipe/swupdate.bbclass
+++ b/classes-recipe/swupdate.bbclass
@@ -23,9 +23,10 @@ 
 #     SWUPDATE_IMAGES = "core-image-full-cmdline"
 #     SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".ext4.gz"
 #   For this example either a file core-image-full-cmdline-${MACHINE}.ext4.gz or a file
-#   core-image-full-cmdline.ext4.gz gets added the swu archive. Optionally the variable
-#   SWUPDATE_IMAGES_NOAPPEND_MACHINE allows to explicitly define if the MACHINE name
-#   must be part of the image file name or not.
+#   core-image-full-cmdline.ext4.gz gets added the swu archive. Optionally the variables
+#   SWUPDATE_IMAGES_NOAPPEND_MACHINE and SWUPDATE_IMAGES_NOAPPEND_DISTRO allow to
+#   explicitly define if the MACHINE and/or DISTRO names must be part of the image
+#   file name or not.
 # * image file name(s)
 #   Example:
 #     SWUPDATE_IMAGES = "core-image-full-cmdline.ext4.gz"