public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Badrikesh Prusty' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Badrikesh Prusty <badrikesh.prusty@siemens.com>
Subject: [PATCH 1/2] installer: support bundling multiple target images
Date: Sat, 13 Dec 2025 15:53:00 -0500	[thread overview]
Message-ID: <20251213205301.2209317-1-badrikesh.prusty@siemens.com> (raw)

Introduce `INSTALLER_TARGET_IMAGES` to allow bundling multiple target images
(defaulting to `INSTALLER_TARGET_IMAGE` if unset), dynamically generate
`ROOTFS_ADDITIONAL_FILES` for each target image including `.wic` and
`.wic.bmap` files, and update multiconfig task dependencies to include all
configured installer images.

The `deploy-image` script of the `isar-installer` already supports multiple
target images and allows the user to select the required image to install.

Example: To bundle multiple target images, set the following in `local.conf`:

```
INSTALLER_TARGET_IMAGES = "isar-image-base isar-image-debug isar-image-ci"
```

Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
 RECIPE-API-CHANGELOG.md                       | 13 ++++
 .../installer-add-rootfs.bbclass              | 69 +++++++++++++------
 2 files changed, 61 insertions(+), 21 deletions(-)

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 6d7c56b9..07034b83 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -919,3 +919,16 @@ The following includes were considered internal and are no longer available:
 The other original includes still exist and inherit the corresponding new
 class. However, they issue a warning to perform the recommended conversion
 because these transitional includes will eventually be dropped.
+
+### Support bundling multiple images in the installer
+
+Introduce `INSTALLER_TARGET_IMAGES` to allow bundling multiple installer
+images (defaulting to `INSTALLER_TARGET_IMAGE` if unset), dynamically
+generate `ROOTFS_ADDITIONAL_FILES` for each target image including `.wic`
+and `.wic.bmap` files, and update MC task dependencies to include all
+configured installer images.
+
+Example: To bundle multiple target images, set the following in local.conf:
+```
+INSTALLER_TARGET_IMAGES = "isar-image-base isar-image-debug isar-image-ci"
+```
diff --git a/meta-isar/classes-recipe/installer-add-rootfs.bbclass b/meta-isar/classes-recipe/installer-add-rootfs.bbclass
index 6708932c..2fa551bd 100644
--- a/meta-isar/classes-recipe/installer-add-rootfs.bbclass
+++ b/meta-isar/classes-recipe/installer-add-rootfs.bbclass
@@ -9,6 +9,7 @@ inherit rootfs-add-files
 
 INSTALLER_MC ??= "isar-installer"
 INSTALLER_TARGET_IMAGE ??= "isar-image-base"
+INSTALLER_TARGET_IMAGES ??= "${INSTALLER_TARGET_IMAGE}"
 INSTALLER_TARGET_MC ??= "installer-target"
 INSTALLER_TARGET_DISTRO ??= "${DISTRO}"
 INSTALLER_TARGET_MACHINE ??= "${MACHINE}"
@@ -19,39 +20,65 @@ IMAGE_DATA_POSTFIX ??= "wic.zst"
 IMAGE_DATA_POSTFIX:buster ??= "wic.xz"
 IMAGE_DATA_POSTFIX:bullseye ??= "wic.xz"
 
-ROOTFS_ADDITIONAL_FILES ??= "installer-target installer-target-bmap"
-
-def get_installer_source(d, suffix):
-    installer_target_image = d.getVar('INSTALLER_TARGET_IMAGE') or ""
-    if not installer_target_image:
-        return ""
+def get_installer_sources(d, suffix):
+    installer_target_images = sorted(set((d.getVar('INSTALLER_TARGET_IMAGES') or "").split()))
+    if not installer_target_images:
+        return [""]
     target_deploy_dir = d.getVar('INSTALLER_TARGET_DEPLOY_DIR_IMAGE')
-    image_data = d.getVar('IMAGE_DATA_FILE')
-    return f"{target_deploy_dir}/{image_data}.{suffix}"
+    target_distro = d.getVar('INSTALLER_TARGET_DISTRO')
+    target_machine = d.getVar('INSTALLER_TARGET_MACHINE')
+    sources = []
+    for image in installer_target_images:
+        image_data = f"{image}-{target_distro}-{target_machine}"
+        sources.append(f"{target_deploy_dir}/{image_data}.{suffix}")
+    return sources
 
-def get_installer_destination(d, suffix):
-    installer_target_image = d.getVar('INSTALLER_TARGET_IMAGE') or ""
-    if not installer_target_image:
-        return "/install/keep"
-    image_data = d.getVar('IMAGE_DATA_FILE')
-    return f"/install/{image_data}.{suffix}"
+def get_installer_destinations(d, suffix):
+    installer_target_images = sorted(set((d.getVar('INSTALLER_TARGET_IMAGES') or "").split()))
+    if not installer_target_images:
+        return ["/install/keep"]
+    target_distro = d.getVar('INSTALLER_TARGET_DISTRO')
+    target_machine = d.getVar('INSTALLER_TARGET_MACHINE')
+    dests = []
+    for image in installer_target_images:
+        image_data = f"{image}-{target_distro}-{target_machine}"
+        dests.append(f"/install/{image_data}.{suffix}")
+    return dests
 
 def get_mc_depends(d, task):
-    installer_target_image = d.getVar('INSTALLER_TARGET_IMAGE') or ""
-    if not installer_target_image:
+    installer_target_images = sorted(set((d.getVar('INSTALLER_TARGET_IMAGES') or "").split()))
+    if not installer_target_images:
         return ""
     installer_mc = d.getVar('INSTALLER_MC') or ""
     installer_target_mc = d.getVar('INSTALLER_TARGET_MC') or ""
-    return f"mc:{installer_mc}:{installer_target_mc}:{installer_target_image}:{task}"
+    deps = []
+    for image in installer_target_images:
+        deps.append(f"mc:{installer_mc}:{installer_target_mc}:{image}:{task}")
+    return " ".join(deps)
 
 def get_image_type(suffix):
     image_type = suffix.split(".")[0]
     return f"{image_type}"
 
-ROOTFS_ADDITIONAL_FILE_installer-target[source] = "${@ get_installer_source(d, d.getVar('IMAGE_DATA_POSTFIX'))}"
-ROOTFS_ADDITIONAL_FILE_installer-target[destination] = "${@ get_installer_destination(d, d.getVar('IMAGE_DATA_POSTFIX'))}"
-ROOTFS_ADDITIONAL_FILE_installer-target-bmap[source] = "${@ get_installer_source(d, "wic.bmap")}"
-ROOTFS_ADDITIONAL_FILE_installer-target-bmap[destination] = "${@ get_installer_destination(d, "wic.bmap")}"
+python() {
+    entries = []
+
+    def add_entries(postfix, suffix):
+        sources = get_installer_sources(d, suffix)
+        dests = get_installer_destinations(d, suffix)
+
+        for idx, (src, dst) in enumerate(zip(sources, dests)):
+            name = f"installer-target-{idx}{postfix}"
+            var = f"ROOTFS_ADDITIONAL_FILE_{name}"
+            entries.append(name)
+            d.setVarFlag(var, "source", src)
+            d.setVarFlag(var, "destination", dst)
+
+    add_entries("", d.getVar("IMAGE_DATA_POSTFIX"))
+    add_entries("-bmap", "wic.bmap")
+
+    d.setVar("ROOTFS_ADDITIONAL_FILES", " ".join(entries))
+}
 
 INSTALLER_TARGET_TASK ??="do_image_${@ get_image_type(d.getVar('IMAGE_DATA_POSTFIX'))}"
 do_rootfs_install[mcdepends] += "${@ get_mc_depends(d, d.getVar('INSTALLER_TARGET_TASK'))}"
-- 
2.47.3

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251213205301.2209317-1-badrikesh.prusty%40siemens.com.

             reply	other threads:[~2025-12-13 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-13 20:53 'Badrikesh Prusty' via isar-users [this message]
2025-12-13 20:53 ` [PATCH 2/2] installer: exclude .wic.bmap files from image selection menu 'Badrikesh Prusty' via isar-users
2025-12-17 12:57 ` [PATCH 1/2] installer: support bundling multiple target images Anton Mikanovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251213205301.2209317-1-badrikesh.prusty@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=badrikesh.prusty@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox