public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH] wic: Fix non-existing initrd case
Date: Sun, 16 Oct 2022 13:22:52 +0200	[thread overview]
Message-ID: <d27978b5-4b9e-4ef2-5cb6-587a4ad1b034@siemens.com> (raw)

From: Jan Kiszka <jan.kiszka@siemens.com>

An initrd is optional, and most callers of isar_get_filenames are taking
this into acount already. Adjust the last one and stop bailing out from
the helper if there is no initrd file.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/scripts/lib/wic/plugins/isarpluginbase.py            | 2 +-
 .../scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/scripts/lib/wic/plugins/isarpluginbase.py b/meta/scripts/lib/wic/plugins/isarpluginbase.py
index 68af2208..99e552e0 100644
--- a/meta/scripts/lib/wic/plugins/isarpluginbase.py
+++ b/meta/scripts/lib/wic/plugins/isarpluginbase.py
@@ -36,6 +36,6 @@ def isar_get_filenames(rootfs_dir):
     if not os.path.isfile(os.path.join(rootfs_dir, "boot", kernel)):
         raise WicError("kernel %s not found" % (os.path.join(rootfs_dir, "boot", kernel)))
     if not os.path.isfile(os.path.join(rootfs_dir, "boot", initrd)):
-        raise WicError("initrd %s not found" % (os.path.join(rootfs_dir, "boot", initrd)))
+        initrd = None
 
     return kernel, initrd
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 7fb0f2a8..43f4bec4 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -141,9 +141,11 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
             syslinux_conf += "APPEND label=boot root=%s %s\n" % \
                              (creator.rootdev, bootloader.append)
 
-            # we are using an initrd, smuggle it in
-            syslinux_conf = syslinux_conf.replace(" root=%s " % (creator.rootdev),
-                                                  " root=%s initrd=%s " % (creator.rootdev, initrd))
+            # 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))
 
         logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg",
                      cr_workdir)
-- 
2.35.3

             reply	other threads:[~2022-10-16 11:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 11:22 Jan Kiszka [this message]
2022-10-17  7:49 ` Henning Schild
2022-10-17  7:55   ` Jan Kiszka
2022-10-17  7:58     ` Jan Kiszka
2022-10-17  8:05     ` Henning Schild
2022-10-24 10:39 ` 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=d27978b5-4b9e-4ef2-5cb6-587a4ad1b034@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=henning.schild@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