All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wic: Generate startup.nsh for EFI cases if none found
@ 2017-09-20 16:03 Tom Rini
  2017-09-28 15:47 ` Ed Bartosh
  0 siblings, 1 reply; 13+ messages in thread
From: Tom Rini @ 2017-09-20 16:03 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christopher Larson

In the case of non-wic images there is logic today to generate a
startup.nsh file that will be executed by EFI to run the loader that the
image contains.  In the WIC case is currently depends on that file being
generated elsewhere and placed in DEPLOY_DIR_IMAGE and only used if
present there.  This extends the logic we have today in wic to save the
name of the loader that's being placed and if no startup.nsh is provided
already generate the default kind that grub-efi/systemd-boot.bbclass
generate.

Cc: Ed Bartosh <ed.bartosh@linux.intel.com>
Cc: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 4c4f36a32f56..f4643fc233b2 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -204,13 +204,15 @@ class BootimgEFIPlugin(SourcePlugin):
                 shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
                                 "%s/grub.cfg" % cr_workdir)
                 for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]:
-                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:])
+                    loader = mod[9:]
+                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, loader)
                     exec_cmd(cp_cmd, True)
                 shutil.move("%s/grub.cfg" % cr_workdir,
                             "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir)
             elif source_params['loader'] == 'systemd-boot':
                 for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]:
-                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:])
+                    loader = mod[8:]
+                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, loader)
                     exec_cmd(cp_cmd, True)
             else:
                 raise WicError("unrecognized bootimg-efi loader: %s" %
@@ -222,6 +224,10 @@ class BootimgEFIPlugin(SourcePlugin):
         if os.path.exists(startup):
             cp_cmd = "cp %s %s/" % (startup, hdddir)
             exec_cmd(cp_cmd, True)
+        else:
+            cfg = open("%s/startup.nsh" % hdddir, "w")
+            cfg.write("fs0:EFI\\BOOT\\%s\n" % loader)
+            cfg.close()
 
         du_cmd = "du -bks %s" % hdddir
         out = exec_cmd(du_cmd)
-- 
1.9.1



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

end of thread, other threads:[~2017-09-29 13:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20 16:03 [PATCH] wic: Generate startup.nsh for EFI cases if none found Tom Rini
2017-09-28 15:47 ` Ed Bartosh
2017-09-28 17:44   ` Tom Rini
2017-09-28 17:46     ` Otavio Salvador
2017-09-28 17:49       ` Tom Rini
2017-09-28 17:57         ` Otavio Salvador
2017-09-28 17:59           ` Tom Rini
2017-09-28 18:01             ` Otavio Salvador
2017-09-28 18:04               ` Tom Rini
2017-09-29 11:27     ` Ed Bartosh
2017-09-29 12:35       ` Tom Rini
2017-09-29 13:44         ` Ed Bartosh
2017-09-29 13:50           ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.