summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com>2020-09-14 18:10:27 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-15 11:53:28 +0100
commit85574ce0cf84eaf828334dd2fafadc18909e73b5 (patch)
treeadac34bc3f5bf96805b276ead6bc46dd75230698
parenta91c7901d097da424431d66d5a5100bb1020b374 (diff)
downloadpoky-85574ce0cf84eaf828334dd2fafadc18909e73b5.tar.gz
wic/bootimg-efi: IMAGE_EFI_BOOT_FILES variable added to separate bootimg-efi and bootimg-partition
Due to recent changes in bootimg-efi to include IMAGE_BOOT_FILES, when both bootimg-partition and bootimg-efi occur in a single .wks and IMAGE_BOOT_FILES are defined, files listed in IMAGE_BOOT_FILES will be duplicated in both partition. Since IMAGE_BOOT_FILES are crucial for bootimg-partition, but optional for bootimg-efi, hence allowing bootimg-efi to have the option to ignore it. The new variable, IMAGE_EFI_BOOT_FILES, was added to help handle this issue. Its basic usage is the same as IMAGE_BOOT_FILES. Usage example: ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.ext4;rootfs.img \ This commit is also squashed with the updated testcase to cover for this change. [YOCTO #14011] (From OE-Core rev: 945339e06b273df1935cfd784f548ef57e0b7f4c) Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image_types_wic.bbclass2
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py13
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py8
3 files changed, 17 insertions, 6 deletions
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 2a1feed60d..4f888ef6e4 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -1,7 +1,7 @@
1# The WICVARS variable is used to define list of bitbake variables used in wic code 1# The WICVARS variable is used to define list of bitbake variables used in wic code
2# variables from this list is written to <image>.env file 2# variables from this list is written to <image>.env file
3WICVARS ?= "\ 3WICVARS ?= "\
4 BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_BOOT_FILES \ 4 BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_EFI_BOOT_FILES IMAGE_BOOT_FILES \
5 IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \ 5 IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \
6 ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS \ 6 ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS \
7 KERNEL_IMAGETYPE MACHINE INITRAMFS_IMAGE INITRAMFS_IMAGE_BUNDLE INITRAMFS_LINK_NAME APPEND \ 7 KERNEL_IMAGETYPE MACHINE INITRAMFS_IMAGE INITRAMFS_IMAGE_BUNDLE INITRAMFS_LINK_NAME APPEND \
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index e6b23c6888..714637ec1e 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -235,6 +235,17 @@ class Wic(WicTestCase):
235 runCmd(cmd) 235 runCmd(cmd)
236 self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct"))) 236 self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct")))
237 237
238 def test_efi_bootpart(self):
239 """Test creation of efi-bootpart image"""
240 cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir
241 kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal')
242 self.append_config('IMAGE_EFI_BOOT_FILES = "%s;kernel"\n' % kimgtype)
243 runCmd(cmd)
244 sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
245 images = glob(self.resultdir + "mkefidisk-*.direct")
246 result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))
247 self.assertIn("kernel",result.output)
248
238 def test_sdimage_bootpart(self): 249 def test_sdimage_bootpart(self):
239 """Test creation of sdimage-bootpart image""" 250 """Test creation of sdimage-bootpart image"""
240 cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir 251 cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir
@@ -689,7 +700,7 @@ class Wic2(WicTestCase):
689 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES', 700 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES',
690 'INITRD', 'INITRD_LIVE', 'ISODIR','INITRAMFS_IMAGE', 701 'INITRD', 'INITRD_LIVE', 'ISODIR','INITRAMFS_IMAGE',
691 'INITRAMFS_IMAGE_BUNDLE', 'INITRAMFS_LINK_NAME', 702 'INITRAMFS_IMAGE_BUNDLE', 'INITRAMFS_LINK_NAME',
692 'APPEND')) 703 'APPEND', 'IMAGE_EFI_BOOT_FILES'))
693 with open(path) as envfile: 704 with open(path) as envfile:
694 content = dict(line.split("=", 1) for line in envfile) 705 content = dict(line.split("=", 1) for line in envfile)
695 # test if variables used by wic present in the .env file 706 # 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 14c1723577..cdc72543c2 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -212,8 +212,8 @@ class BootimgEFIPlugin(SourcePlugin):
212 except KeyError: 212 except KeyError:
213 raise WicError("bootimg-efi requires a loader, none specified") 213 raise WicError("bootimg-efi requires a loader, none specified")
214 214
215 if get_bitbake_var("IMAGE_BOOT_FILES") is None: 215 if get_bitbake_var("IMAGE_EFI_BOOT_FILES") is None:
216 logger.debug('No boot files defined in IMAGE_BOOT_FILES') 216 logger.debug('No boot files defined in IMAGE_EFI_BOOT_FILES')
217 else: 217 else:
218 boot_files = None 218 boot_files = None
219 for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)): 219 for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)):
@@ -222,7 +222,7 @@ class BootimgEFIPlugin(SourcePlugin):
222 else: 222 else:
223 var = "" 223 var = ""
224 224
225 boot_files = get_bitbake_var("IMAGE_BOOT_FILES" + var) 225 boot_files = get_bitbake_var("IMAGE_EFI_BOOT_FILES" + var)
226 if boot_files: 226 if boot_files:
227 break 227 break
228 228
@@ -292,7 +292,7 @@ class BootimgEFIPlugin(SourcePlugin):
292 (staging_kernel_dir, kernel, hdddir, kernel) 292 (staging_kernel_dir, kernel, hdddir, kernel)
293 exec_cmd(install_cmd) 293 exec_cmd(install_cmd)
294 294
295 if get_bitbake_var("IMAGE_BOOT_FILES"): 295 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
296 for src_path, dst_path in cls.install_task: 296 for src_path, dst_path in cls.install_task:
297 install_cmd = "install -m 0644 -D %s %s" \ 297 install_cmd = "install -m 0644 -D %s %s" \
298 % (os.path.join(kernel_dir, src_path), 298 % (os.path.join(kernel_dir, src_path),