public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] isar-installer: Allow multiple INSTALLER_TARGET_DEVICE for NVMe/SATA
@ 2025-04-17  7:27 'Badrikesh Prusty' via isar-users
  0 siblings, 0 replies; only message in thread
From: 'Badrikesh Prusty' via isar-users @ 2025-04-17  7:27 UTC (permalink / raw)
  To: isar-users; +Cc: badrikesh prusty

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-17  7:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-17  7:27 [PATCH] isar-installer: Allow multiple INSTALLER_TARGET_DEVICE for NVMe/SATA 'Badrikesh Prusty' via isar-users

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox