public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Gourav Singh' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com, jan.kiszka@siemens.com,
	felix.moessbauer@siemens.com,
	Gourav Singh <gouravsingh@siemens.com>
Subject: [PATCH v4] wic/plugins: gate root= with rootdev check for efi, pcbios and partition
Date: Thu, 28 May 2026 12:08:12 +0530	[thread overview]
Message-ID: <20260528063812.2024923-1-gouravsingh@siemens.com> (raw)

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.

             reply	other threads:[~2026-05-28  6:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  6:38 'Gourav Singh' via isar-users [this message]
2026-05-28  6:59 ` 'Jan Kiszka' via isar-users

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=20260528063812.2024923-1-gouravsingh@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=gouravsingh@siemens.com \
    --cc=jan.kiszka@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