[gnome-continuous-yocto/gnomeostree-3.28-rocko: 4377/8267] wic: Look for image artifacts in a common location
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 4377/8267] wic: Look for image artifacts in a common location
- Date: Sun, 17 Dec 2017 01:57:05 +0000 (UTC)
commit 66d08e0fdad5deb0d5228a0fadb1a1ef5d0142cc
Author: Tom Zanussi <tom zanussi linux intel com>
Date: Tue Jul 12 16:50:03 2016 -0500
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
(From OE-Core rev: 1c8acea91e775b1b6f8b25e774aaba3e790fc59b)
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>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
meta/lib/oeqa/selftest/wic.py | 4 +-
scripts/lib/wic/plugins/source/bootimg-efi.py | 39 +++++++++++++++-----
.../lib/wic/plugins/source/isoimage-isohybrid.py | 18 +++++++--
3 files changed, 45 insertions(+), 16 deletions(-)
---
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index ebbb280..da68e25 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -372,8 +372,8 @@ class Wic(oeSelfTest):
wicvars = set(get_bb_var('WICVARS', image).split())
# filter out optional variables
- wicvars = wicvars.difference(('IMAGE_BOOT_FILES', 'INITRD',
- 'INITRD_LIVE', 'ISODIR'))
+ wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES',
+ 'INITRD', 'INITRD_LIVE', 'ISODIR'))
with open(path) as envfile:
content = dict(line.split("=", 1) for line in envfile)
# test if variables used by wic present in the .env file
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 305e910..74a1557 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:
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index a637ce5..b54a229 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -249,6 +249,7 @@ class IsoImagePlugin(SourcePlugin):
part.rootfs_dir = rootfs_dir
# Prepare rootfs.img
+ hdd_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
img_iso_dir = get_bitbake_var("ISODIR")
rootfs_img = "%s/rootfs.img" % img_iso_dir
if not os.path.isfile(rootfs_img):
@@ -278,10 +279,19 @@ class IsoImagePlugin(SourcePlugin):
if os.path.isfile(part.source_file):
os.remove(part.source_file)
- # Prepare initial ramdisk
- initrd = "%s/initrd" % img_iso_dir
- if not os.path.isfile(initrd):
- initrd = cls._build_initramfs_path(rootfs_dir, cr_workdir)
+ # Support using a different initrd other than default
+ if source_params.get('initrd'):
+ initrd = source_params['initrd']
+ if not hdd_dir:
+ msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
+ cp_cmd = "cp %s/%s %s" % (hdd_dir, initrd, cr_workdir)
+ else:
+ # Prepare initial ramdisk
+ initrd = "%s/initrd" % hdd_dir
+ if not os.path.isfile(initrd):
+ initrd = "%s/initrd" % img_iso_dir
+ if not os.path.isfile(initrd):
+ initrd = cls._build_initramfs_path(rootfs_dir, cr_workdir)
install_cmd = "install -m 0644 %s %s/initrd" \
% (initrd, isodir)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]