aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/source/bootimg-efi.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2016-07-12 16:50:03 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-31 14:13:29 +0000
commit1c8acea91e775b1b6f8b25e774aaba3e790fc59b (patch)
tree6dfb65e067b9407f89b9bfce969ac72d1faed554 /scripts/lib/wic/plugins/source/bootimg-efi.py
parentb3ed3a79852f85651c8fa192a8118f9904e88ef8 (diff)
downloadopenembedded-core-contrib-1c8acea91e775b1b6f8b25e774aaba3e790fc59b.tar.gz
wic: Look for image artifacts in a common location
Rather than have each image type look for artifacts in image-specific locations, move towards having them look for artifacts in a common location, in this case DEPLOY_DIR_IMAGE Use the existing deploy.bbclass to have the bootloaders put their binaries in DEPLOY_DIR_IMAGE and then wic will find them and place them in the image Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-efi.py')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py39
1 files changed, 29 insertions, 10 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 305e910d6a..74a1557f91 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -42,7 +42,7 @@ class BootimgEFIPlugin(SourcePlugin):
name = 'bootimg-efi'
@classmethod
- def do_configure_grubefi(cls, hdddir, creator, cr_workdir):
+ def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params):
"""
Create loader-specific (grub-efi) config
"""
@@ -82,7 +82,7 @@ class BootimgEFIPlugin(SourcePlugin):
cfg.close()
@classmethod
- def do_configure_systemdboot(cls, hdddir, creator, cr_workdir):
+ def do_configure_systemdboot(cls, hdddir, creator, cr_workdir, source_params):
"""
Create loader-specific systemd-boot/gummiboot config
"""
@@ -98,6 +98,19 @@ class BootimgEFIPlugin(SourcePlugin):
loader_conf += "default boot\n"
loader_conf += "timeout %d\n" % bootloader.timeout
+ initrd = source_params.get('initrd')
+
+ if initrd:
+ # obviously we need to have a common common deploy var
+ bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+ if not bootimg_dir:
+ msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
+
+ cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir)
+ exec_cmd(cp_cmd, True)
+ else:
+ msger.debug("Ignoring missing initrd")
+
msger.debug("Writing systemd-boot config %s/hdd/boot/loader/loader.conf" \
% cr_workdir)
cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w")
@@ -127,6 +140,9 @@ class BootimgEFIPlugin(SourcePlugin):
boot_conf += "options LABEL=Boot root=%s %s\n" % \
(creator.rootdev, bootloader.append)
+ if initrd:
+ boot_conf += "initrd /%s\n" % initrd
+
msger.debug("Writing systemd-boot config %s/hdd/boot/loader/entries/boot.conf" \
% cr_workdir)
cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w")
@@ -148,9 +164,9 @@ class BootimgEFIPlugin(SourcePlugin):
try:
if source_params['loader'] == 'grub-efi':
- cls.do_configure_grubefi(hdddir, creator, cr_workdir)
+ cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params)
elif source_params['loader'] == 'systemd-boot':
- cls.do_configure_systemdboot(hdddir, creator, cr_workdir)
+ cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params)
else:
msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader'])
except KeyError:
@@ -167,9 +183,9 @@ class BootimgEFIPlugin(SourcePlugin):
In this case, prepare content for an EFI (grub) boot partition.
"""
if not bootimg_dir:
- bootimg_dir = get_bitbake_var("HDDDIR")
+ bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
if not bootimg_dir:
- msger.error("Couldn't find HDDDIR, exiting\n")
+ msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
# just so the result notes display it
creator.set_bootimg_dir(bootimg_dir)
@@ -181,17 +197,20 @@ class BootimgEFIPlugin(SourcePlugin):
(staging_kernel_dir, hdddir)
exec_cmd(install_cmd)
+
try:
if source_params['loader'] == 'grub-efi':
shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
"%s/grub.cfg" % cr_workdir)
- cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir)
- exec_cmd(cp_cmd, True)
+ for mod in [x for x in os.listdir(bootimg_dir) if x.startswith("grub-efi-")]:
+ cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (bootimg_dir, mod, hdddir, mod[9:])
+ 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':
- cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir)
- exec_cmd(cp_cmd, True)
+ for mod in [x for x in os.listdir(bootimg_dir) if x.startswith("systemd-")]:
+ cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (bootimg_dir, mod, hdddir, mod[8:])
+ exec_cmd(cp_cmd, True)
else:
msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader'])
except KeyError: