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] isar-installer: Allow multiple INSTALLER_TARGET_DEVICE for NVMe/SATA
Date: Thu, 17 Apr 2025 12:57:24 +0530	[thread overview]
Message-ID: <20250417072724.4910-1-badrikesh.prusty@siemens.com> (raw)

From: badrikesh prusty <badrikesh.prusty@siemens.com>

Older devices typically use SATA SSDs/HDDs (often as /dev/sda), but NVMe drives
are increasingly common in newer devices (often as /dev/nvme0n1). Thus, we need
to build separate isar-image-installer with updated INSTALLER_TARGET_DEVICE for
both storage types.
With these changes, INSTALLER_TARGET_DEVICE can now accept multiple devices
specified as comma or colon separated values (e.g. /dev/sda,/dev/nvme0n1).
The provided devices will be checked to ensure they are block devices and not
the boot device, preventing the isar-image-installer on a USB drive (often
assigned /dev/sda when NVMe is the default storage) from installing the image
to the same device it's booted from.

Signed-off-by: badrikesh prusty <badrikesh.prusty@siemens.com>
---
 kas/image/Kconfig                                         | 4 ++--
 .../files/usr/lib/deploy-image-wic/handle-config.sh       | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/kas/image/Kconfig b/kas/image/Kconfig
index d602c369..8193efc5 100644
--- a/kas/image/Kconfig
+++ b/kas/image/Kconfig
@@ -87,9 +87,9 @@ config INSTALLER_TARGET_DEVICE
 	string "Target device to deploy"
 	default "/dev/sda"
 	help
-	  Device to deploy the image onto.
+          Deploy image to this target device. Accepts comma/colon-separated multiple devices; installs on the first available.
 	  Leave this empty to get prompted during installation
-	  Examples: /dev/sda, /dev/nvme0n1
+	  Examples: /dev/sda, /dev/nvme0n1, /dev/sda:/dev/nvme0n1
 
 choice
 	prompt "Overwrite handling"
diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh b/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh
index af37150e..26b2966e 100644
--- a/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh
@@ -31,6 +31,14 @@ for x in $(cat /proc/cmdline); do
         ;;
         installer.target.dev=*)
             installer_target_dev=${x#installer.target.dev=}
+            installer_target_dev_list=$(echo "$installer_target_dev" | sed 's/[,:]/ /g')
+            boot_device=$(lsblk -no PKNAME,MOUNTPOINT | grep -E '/boot| /$' | awk '{print "/dev/"$1}' | uniq)
+            for dev in ${installer_target_dev_list}; do
+                if [ -b "${dev}" ] && [ "${dev}" != "${boot_device}" ]; then
+                    installer_target_dev=${dev}
+                    break
+                fi
+            done
             installer_unattended=true
         ;;
         installer.target.overwrite*)
-- 
2.39.5

-- 
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/20250417072724.4910-1-badrikesh.prusty%40siemens.com.

                 reply	other threads:[~2025-04-17  7:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250417072724.4910-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