isar-installer: add mdadm support and filter out RAID member disks

Message ID 20251016033421.1172746-1-kasturi.shekar@siemens.com
State Accepted, archived
Headers show
Series isar-installer: add mdadm support and filter out RAID member disks | expand

Commit Message

Kasturi Shekar Oct. 16, 2025, 3:34 a.m. UTC
The installer now conditionally includes the `mdadm` package,
based on the presence of the `raid` feature in `MACHINE_FEATURES`
Additionally, the device selection dialog is updated to exclude
physical disks that are members of a RAID volume.

Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
---
 .../images/isar-image-installer.bb             |  2 ++
 .../files/usr/bin/deploy-image-wic.sh          | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

Comments

Zhihang Wei Oct. 24, 2025, 3:57 p.m. UTC | #1
Applied to next, thanks.

Best regards,
Zhihang

On 10/16/25 05:34, 'Kasturi Shekar' via isar-users wrote:
> The installer now conditionally includes the `mdadm` package,
> based on the presence of the `raid` feature in `MACHINE_FEATURES`
> Additionally, the device selection dialog is updated to exclude
> physical disks that are members of a RAID volume.
>
> Signed-off-by: Kasturi Shekar <kasturi.shekar@siemens.com>
> ---
>   .../images/isar-image-installer.bb             |  2 ++
>   .../files/usr/bin/deploy-image-wic.sh          | 18 ++++++++++++++++++
>   2 files changed, 20 insertions(+)
>
> diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
> index db379f5d..300591ab 100644
> --- a/meta-isar/recipes-core/images/isar-image-installer.bb
> +++ b/meta-isar/recipes-core/images/isar-image-installer.bb
> @@ -26,3 +26,5 @@ IMAGER_INSTALL:wic:append = " ${SYSTEMD_BOOTLOADER_INSTALL}"
>   IMAGE_INSTALL += "deploy-image-service"
>   
>   IMAGE_INSTALL:remove = "expand-on-first-boot"
> +
> +IMAGE_PREINSTALL:append = "${@ bb.utils.contains('MACHINE_FEATURES', 'raid', ' mdadm', '', d) }"
> diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> index 333762f1..778370b1 100755
> --- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> +++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
> @@ -60,6 +60,24 @@ if ! $installer_unattended; then
>       devices="$devices $mmc_devices"
>   
>       for device in $devices; do
> +        is_raid_member=0
> +
> +        if [ -d "/sys/block/$device/holders" ] && [ ! -d "/sys/block/$device/md" ]; then
> +            for holder_path in /sys/block/$device/holders/*; do
> +                holder_name=$(basename "$holder_path")
> +                case "$holder_name" in
> +                    md[0-9]*)
> +                        is_raid_member=1
> +                        break
> +                        ;;
> +                esac
> +            done
> +        fi
> +
> +        if [ "$is_raid_member" -eq 1 ]; then
> +            continue # Skip RAID member disks
> +        fi
> +
>           case $device in
>               loop*)
>                   # skip loop device

Patch

diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index db379f5d..300591ab 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -26,3 +26,5 @@  IMAGER_INSTALL:wic:append = " ${SYSTEMD_BOOTLOADER_INSTALL}"
 IMAGE_INSTALL += "deploy-image-service"
 
 IMAGE_INSTALL:remove = "expand-on-first-boot"
+
+IMAGE_PREINSTALL:append = "${@ bb.utils.contains('MACHINE_FEATURES', 'raid', ' mdadm', '', d) }"
diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
index 333762f1..778370b1 100755
--- a/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
+++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh
@@ -60,6 +60,24 @@  if ! $installer_unattended; then
     devices="$devices $mmc_devices"
 
     for device in $devices; do
+        is_raid_member=0
+
+        if [ -d "/sys/block/$device/holders" ] && [ ! -d "/sys/block/$device/md" ]; then
+            for holder_path in /sys/block/$device/holders/*; do
+                holder_name=$(basename "$holder_path")
+                case "$holder_name" in
+                    md[0-9]*)
+                        is_raid_member=1
+                        break
+                        ;;
+                esac
+            done
+        fi
+
+        if [ "$is_raid_member" -eq 1 ]; then
+            continue # Skip RAID member disks
+        fi
+
         case $device in
             loop*)
                 # skip loop device