public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v4] wic/plugins: gate root= with rootdev check for efi, pcbios and partition
@ 2026-05-28  6:38 'Gourav Singh' via isar-users
  2026-05-28  6:59 ` 'Jan Kiszka' via isar-users
  0 siblings, 1 reply; 2+ messages in thread
From: 'Gourav Singh' via isar-users @ 2026-05-28  6:38 UTC (permalink / raw)
  To: isar-users; +Cc: cedric.hombourger, jan.kiszka, felix.moessbauer, Gourav Singh

Checks for creator.rootdev (or cr.rootdev) being None were missing
and would cause the kernel command line to contain "root=None". When
using the Discoverable Partitions Specification, no root= parameter
should appear on the kernel command line, as root=None is not valid.

This fix mirrors the same change applied to the upstream wic plugins:
https://lists.yoctoproject.org/g/yocto-patches/topic/wic_patch_v2_wic_plugins/119493445

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
Signed-off-by: Gourav Singh <gouravsingh@siemens.com>
---
 .../wic/plugins/source/bootimg-efi-isar.py    |  7 ++++---
 .../wic/plugins/source/bootimg-pcbios-isar.py | 20 ++++++++++++++-----
 scripts/lib/wic/plugins/source/bootimg-efi.py |  7 ++++---
 .../wic/plugins/source/bootimg-partition.py   | 11 ++++++++--
 .../lib/wic/plugins/source/bootimg-pcbios.py  | 10 ++++++++--
 5 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index 6bc78d42..28b6af63 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -104,7 +104,7 @@ class BootimgEFIPlugin(SourcePlugin):
                         (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))

             label = source_params.get('label')
-            label_conf = "root=%s" % creator.rootdev
+            label_conf = "root=%s" % creator.rootdev if creator.rootdev else ""
             if label:
                 label_conf = "LABEL=%s" % label

@@ -201,7 +201,8 @@ class BootimgEFIPlugin(SourcePlugin):
             boot_conf += "linux /%s\n" % kernel

             label = source_params.get('label')
-            label_conf = "LABEL=Boot root=%s" % creator.rootdev
+            label_conf = "LABEL=Boot"
+            label_conf += (" root=%s" % creator.rootdev) if creator.rootdev else ""
             if label:
                 label_conf = "LABEL=%s" % label

@@ -366,7 +367,7 @@ class BootimgEFIPlugin(SourcePlugin):

             with tempfile.TemporaryDirectory() as tmp_dir:
                 label = source_params.get('label')
-                label_conf = "root=%s" % creator.rootdev
+                label_conf = "root=%s" % creator.rootdev if creator.rootdev else ""
                 if label:
                     label_conf = "LABEL=%s" % label

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
index d5040b72..bb126df8 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -140,14 +140,24 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):

             syslinux_conf += "KERNEL " + kernel + "\n"

-            syslinux_conf += "APPEND label=boot root=%s %s\n" % \
-                             (creator.rootdev, bootloader.append)
+            parts = ["label=boot"]
+            if creator.rootdev:
+                parts.append("root=%s" % creator.rootdev)
+            if bootloader.append:
+                parts.append(bootloader.append)
+
+            syslinux_conf += "APPEND %s\n" % " ".join(parts)

             # if we are using an initrd, smuggle it in
             if initrd:
-                syslinux_conf = syslinux_conf.replace(
-                    " root=%s " % (creator.rootdev),
-                    " root=%s initrd=%s " % (creator.rootdev, initrd))
+                if creator.rootdev:
+                    syslinux_conf = syslinux_conf.replace(
+                            "root=%s" % creator.rootdev,
+                            "root=%s initrd=%s" % (creator.rootdev, initrd))
+                else:
+                    syslinux_conf = syslinux_conf.replace(
+                            " label=boot ",
+                            " label=boot initrd=%s " % initrd)

         logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg",
                      cr_workdir)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 13a9cddf..c18a1e71 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -95,7 +95,7 @@ class BootimgEFIPlugin(SourcePlugin):
                         (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))

             label = source_params.get('label')
-            label_conf = "root=%s" % creator.rootdev
+            label_conf = "root=%s" % creator.rootdev if creator.rootdev else ""
             if label:
                 label_conf = "LABEL=%s" % label

@@ -180,7 +180,8 @@ class BootimgEFIPlugin(SourcePlugin):
             boot_conf += "linux /%s\n" % kernel

             label = source_params.get('label')
-            label_conf = "LABEL=Boot root=%s" % creator.rootdev
+            label_conf = "LABEL=Boot"
+            label_conf += (" root=%s" % creator.rootdev) if creator.rootdev else ""
             if label:
                 label_conf = "LABEL=%s" % label

@@ -316,7 +317,7 @@ class BootimgEFIPlugin(SourcePlugin):

             with tempfile.TemporaryDirectory() as tmp_dir:
                 label = source_params.get('label')
-                label_conf = "root=%s" % creator.rootdev
+                label_conf = "root=%s" % creator.rootdev if creator.rootdev else ""
                 if label:
                     label_conf = "LABEL=%s" % label

diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 94183174..ebddcb90 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -153,8 +153,15 @@ class BootimgPartitionPlugin(SourcePlugin):
             if has_dtb:
                 extlinux_conf += "   fdtdir %s\n" % fdt_dir
             bootloader = cr.ks.bootloader
-            extlinux_conf += "append root=%s rootwait %s\n" \
-                             % (cr.rootdev, bootloader.append if bootloader.append else '')
+
+            # Check if rootdev exists
+            parts = ["rootwait"]
+            if cr.rootdev:
+                parts.insert(0, "root=%s" % cr.rootdev)
+            if bootloader.append:
+                parts.append(bootloader.append)
+
+            extlinux_conf += "append %s\n" % " ".join(parts)

         install_cmd = "install -d %s/extlinux/" % hdddir
         exec_cmd(install_cmd)
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index a207a835..5d5d5c23 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -125,8 +125,14 @@ class BootimgPcbiosPlugin(SourcePlugin):
             kernel = "/" + get_bitbake_var("KERNEL_IMAGETYPE")
             syslinux_conf += "KERNEL " + kernel + "\n"

-            syslinux_conf += "APPEND label=boot root=%s %s\n" % \
-                             (creator.rootdev, bootloader.append)
+            # Check if rootdev exists
+            parts = ["label=boot"]
+            if creator.rootdev:
+                parts.append("root=%s" % creator.rootdev)
+            if bootloader.append:
+                parts.append(bootloader.append)
+
+            syslinux_conf += "APPEND %s\n" % " ".join(parts)

         logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg",
                      cr_workdir)
--
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/20260528063812.2024923-1-gouravsingh%40siemens.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-28  6:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-28  6:38 [PATCH v4] wic/plugins: gate root= with rootdev check for efi, pcbios and partition 'Gourav Singh' via isar-users
2026-05-28  6:59 ` 'Jan Kiszka' 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