summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins
diff options
context:
space:
mode:
authorAnuj Mittal <anuj.mittal@intel.com>2018-06-01 13:18:18 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-04 15:15:00 +0100
commit5d9d5b869d506aaa6c908146569dc6603163225b (patch)
treed0a97e3139fc29d57f27100953b6aab2cb6d86b9 /scripts/lib/wic/plugins
parentccd8044f3382c72b66c6845062adb52413185cbf (diff)
downloadpoky-5d9d5b869d506aaa6c908146569dc6603163225b.tar.gz
wic/bootimg-efi.py: recognize initrd when using grub
Make sure that we're able to use the initrd value specified in the wks file when using grub-efi bootloader with bootimg-efi wic plugin. Fixes [YOCTO #12689] (From OE-Core rev: f1d5bb1f21e11714357aff4ae7e52421e3756c5a) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index beb74d7a71..0eb86a079f 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -45,7 +45,7 @@ class BootimgEFIPlugin(SourcePlugin):
45 name = 'bootimg-efi' 45 name = 'bootimg-efi'
46 46
47 @classmethod 47 @classmethod
48 def do_configure_grubefi(cls, creator, cr_workdir): 48 def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params):
49 """ 49 """
50 Create loader-specific (grub-efi) config 50 Create loader-specific (grub-efi) config
51 """ 51 """
@@ -62,6 +62,18 @@ class BootimgEFIPlugin(SourcePlugin):
62 raise WicError("configfile is specified but failed to " 62 raise WicError("configfile is specified but failed to "
63 "get it from %s." % configfile) 63 "get it from %s." % configfile)
64 64
65 initrd = source_params.get('initrd')
66
67 if initrd:
68 bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
69 if not bootimg_dir:
70 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
71
72 cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir)
73 exec_cmd(cp_cmd, True)
74 else:
75 logger.debug("Ignoring missing initrd")
76
65 if not custom_cfg: 77 if not custom_cfg:
66 # Create grub configuration using parameters from wks file 78 # Create grub configuration using parameters from wks file
67 bootloader = creator.ks.bootloader 79 bootloader = creator.ks.bootloader
@@ -76,6 +88,10 @@ class BootimgEFIPlugin(SourcePlugin):
76 88
77 grubefi_conf += "linux %s root=%s rootwait %s\n" \ 89 grubefi_conf += "linux %s root=%s rootwait %s\n" \
78 % (kernel, creator.rootdev, bootloader.append) 90 % (kernel, creator.rootdev, bootloader.append)
91
92 if initrd:
93 grubefi_conf += "initrd /%s\n" % initrd
94
79 grubefi_conf += "}\n" 95 grubefi_conf += "}\n"
80 96
81 logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg", 97 logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg",
@@ -167,7 +183,7 @@ class BootimgEFIPlugin(SourcePlugin):
167 183
168 try: 184 try:
169 if source_params['loader'] == 'grub-efi': 185 if source_params['loader'] == 'grub-efi':
170 cls.do_configure_grubefi(creator, cr_workdir) 186 cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params)
171 elif source_params['loader'] == 'systemd-boot': 187 elif source_params['loader'] == 'systemd-boot':
172 cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) 188 cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params)
173 else: 189 else: