From: badrikesh prusty <
badrikes...@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 <
badrikes...@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