public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] wic: Fix non-existing initrd case
@ 2022-10-16 11:22 Jan Kiszka
  2022-10-17  7:49 ` Henning Schild
  2022-10-24 10:39 ` Anton Mikanovich
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Kiszka @ 2022-10-16 11:22 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

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

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

end of thread, other threads:[~2022-10-24 10:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-16 11:22 [PATCH] wic: Fix non-existing initrd case Jan Kiszka
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox