public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Q. Gylstorff" <Quirin.Gylstorff@siemens.com>
To: isar-users@googlegroups.com
Cc: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Subject: [PATCH v2] wic/rootfs-u-boot: Allow to set root with source_params
Date: Tue,  3 Aug 2021 13:06:08 +0200	[thread overview]
Message-ID: <20210803110608.29342-1-Quirin.Gylstorff@siemens.com> (raw)

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

If the root device needs to be modified during boot it needs
to be set as source parameter in the wic file similar to efi
boot.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---

Changes V2:
 - remove autoformatted code

 meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
index 15acb57..0b4f9ee 100644
--- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
+++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
@@ -60,6 +60,13 @@ class RootfsUBootPlugin(RootfsPlugin):
                                (rootfs_dir, image_rootfs_dir))
             real_rootfs_dir = image_rootfs_dir
 
+        root_dev = cr.rootdev
+        if not root_dev:
+            root_dev = source_params.get("root", None)
+            if not root_dev:
+                raise WicError("root not defined, exiting.")
+            root_dev = root_dev.replace(":", "=")
+
         u_boot_script = os.path.join(real_rootfs_dir,
                                      "etc/default/u-boot-script")
         if not os.path.exists(u_boot_script):
@@ -70,7 +77,7 @@ class RootfsUBootPlugin(RootfsPlugin):
             cfg.write('# Generated by wic, rootfs-u-boot plugin\n')
             cfg.write('ROOT_PARTITION="%d"\n' % part.realnum)
             cfg.write('KERNEL_ARGS="root=%s %s"\n' % \
-                (cr.rootdev, cr.ks.bootloader.append or ""))
+                (root_dev, cr.ks.bootloader.append or ""))
             no_initrd = source_params.get('no_initrd') or ''
             cfg.write('NO_INITRD="%s"\n' % no_initrd)
             overlays = source_params.get('overlays') or ''
-- 
2.20.1


             reply	other threads:[~2021-08-03 11:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 11:06 Q. Gylstorff [this message]
2021-08-11 13:44 ` Anton Mikanovich
2021-08-11 14:43   ` Jan Kiszka
2021-08-11 15:42     ` Anton Mikanovich

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=20210803110608.29342-1-Quirin.Gylstorff@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=isar-users@googlegroups.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