[OE-core] [PATCH 2/4] timage_types_wic: add do_populate_bootfs task
Ed Bartosh
ed.bartosh at linux.intel.com
Wed May 10 08:05:09 UTC 2017
This task generates root partition UUID and calls efi_bootfs_populate
API of current EFI provider to populate bootfs directory with
EFI artifacts.
[YOCTO #10073]
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
meta/classes/image_types_wic.bbclass | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 4711c24..0ef587b 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -115,3 +115,39 @@ python do_rootfs_wicenv () {
addtask do_rootfs_wicenv after do_image before do_image_wic
do_rootfs_wicenv[vardeps] += "${WICVARS}"
do_rootfs_wicenv[prefuncs] = 'set_image_size'
+
+# Set variables for efi_bootfs_populate
+GRUB_CFG ?= "${WORKDIR}/grub_wic.cfg"
+SYSTEMD_BOOT_CFG ?= "${WORKDIR}/loader_wic.conf"
+GRUB_GFXSERIAL ?= "1"
+LABELS_WIC ?= "boot install"
+LABELS ?= "${LABELS_WIC}"
+
+EFI_PROVIDER ?= "grub-efi"
+EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
+inherit ${EFI_CLASS}
+
+python do_populate_bootfs() {
+ def populate_bootfs(partuuid):
+ # remove bootfs dir as it may have files from previous build
+ bootfs = os.path.join(d.getVar("WORKDIR"), 'bootfs')
+ if os.path.exists(bootfs):
+ import shutil
+ shutil.rmtree(bootfs)
+
+ d.setVar("APPEND", "root=PARTUUID=%s" % partuuid)
+ bb.build.exec_func('build_efi_cfg', d)
+
+ bb.build.exec_func('efi_bootfs_populate', d)
+
+ if d.getVar('USING_WIC'):
+ # Generate parition UUID
+ from uuid import uuid4
+ partuuid = str(uuid4())
+ d.setVar("ROOTFS_PARTUUID", partuuid)
+
+ if d.getVar("EFI_CLASS"):
+ populate_bootfs(partuuid)
+}
+
+addtask do_populate_bootfs after do_image before do_image_wic
--
2.1.4
More information about the Openembedded-core
mailing list