Created
May 9, 2017 13:02
-
-
Save bartosh/58feab853b3269d12e4be59cf6009934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass | |
index df7fe18..bacbeb4 100644 | |
--- a/meta/classes/grub-efi.bbclass | |
+++ b/meta/classes/grub-efi.bbclass | |
@@ -71,6 +71,12 @@ efi_hddimg_populate() { | |
efi_populate $1 | |
} | |
+efi_bootfs_populate() { | |
+ bootfs_dir="${WORKDIR}/bootfs" | |
+ efi_populate $bootfs_dir | |
+ cp --dereference ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} $bootfs_dir/vmlinuz | |
+} | |
+ | |
python build_efi_cfg() { | |
import sys | |
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass | |
index 4711c24..94545a8 100644 | |
--- a/meta/classes/image_types_wic.bbclass | |
+++ b/meta/classes/image_types_wic.bbclass | |
@@ -66,6 +66,14 @@ python do_write_wks_template () { | |
python () { | |
if d.getVar('USING_WIC'): | |
+ | |
+ # generate partition uuid to use in bootloader config | |
+ # and in kickstart file | |
+ from uuid import uuid4 | |
+ d.setVar('ROOTFS_PARTUUID', str(uuid4())) | |
+ | |
+ bb.build.addtask('do_bootfs_populate', 'do_image_wic', None, d) | |
+ | |
wks_file_u = d.getVar('WKS_FULL_PATH', False) | |
wks_file = d.expand(wks_file_u) | |
base, ext = os.path.splitext(wks_file) | |
@@ -115,3 +123,32 @@ 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' | |
+ | |
+# | |
+# Populate bootfs with EFI artifacts | |
+# | |
+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_bootfs_populate() { | |
+ if d.getVar('USING_WIC') and d.getVar("EFI_CLASS"): | |
+ # 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) | |
+ | |
+ # generate bootloader config | |
+ d.setVar("APPEND", "root=PARTUUID=%s" % d.getVar('ROOTFS_PARTUUID')) | |
+ bb.build.exec_func('build_efi_cfg', d) | |
+ | |
+ # populate EFI artifacts into ${WORKDIR}/bootfs | |
+ bb.build.exec_func('efi_bootfs_populate', d) | |
+} | |
diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass | |
index 4e69a2c..7e842af 100644 | |
--- a/meta/classes/systemd-boot.bbclass | |
+++ b/meta/classes/systemd-boot.bbclass | |
@@ -62,6 +62,12 @@ efi_hddimg_populate() { | |
efi_populate $1 | |
} | |
+efi_bootfs_populate() { | |
+ bootfs_dir="${WORKDIR}/bootfs" | |
+ efi_populate $bootfs_dir | |
+ cp --dereference ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} $bootfs_dir/vmlinuz | |
+} | |
+ | |
python build_efi_cfg() { | |
s = d.getVar("S") | |
labels = d.getVar('LABELS') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment