From 6f4d06897bb746f64e6ec6c2d6d67aba5ff93416 Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Mon, 20 May 2019 13:18:48 +0200 Subject: Split grub_efi class override Split the class override into generic changes and Secure Boot specific (efi_populate). This allows us to override the secureboot parts only if the efi-secure-boot distro feature is enabled. Change-Id: I68ab1a9eae2ffceecd057506ef493b4388ff5343 Signed-off-by: Adrian Dudau --- classes/override_grub-efi.inc | 28 ---------------------------- classes/override_grub-efi_secureboot.inc | 27 +++++++++++++++++++++++++++ images/enea-nfv-access-host-common.inc | 1 + 3 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 classes/override_grub-efi_secureboot.inc diff --git a/classes/override_grub-efi.inc b/classes/override_grub-efi.inc index fb1958d..4c2ae64 100644 --- a/classes/override_grub-efi.inc +++ b/classes/override_grub-efi.inc @@ -87,31 +87,3 @@ python build_efi_cfg() { cfgfile.close() } - -efi_populate() { - # DEST must be the root of the image so that EFIDIR is not - # nested under a top level directory. - DEST=$1 - - install -d ${DEST}${EFIDIR} - - GRUB_IMAGE="grub-efi-bootia32.efi" - DEST_IMAGE="bootia32.efi" - if [ "${TARGET_ARCH}" = "x86_64" ]; then - GRUB_IMAGE="grub-efi-bootx64.efi" - DEST_IMAGE="bootx64.efi" - fi - - #Install EFI binaries - install -m 0644 ${IMAGE_ROOTFS}/boot/efi${EFIDIR}/*.* ${DEST}${EFIDIR} - - #Install kernel and initramfs sig - install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}.p7b ${DEST}/vmlinuz.p7b - install -m 0644 ${INITRD_LIVE}.p7b ${DEST}/initrd.p7b - - EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') - printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh - - install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg - -} diff --git a/classes/override_grub-efi_secureboot.inc b/classes/override_grub-efi_secureboot.inc new file mode 100644 index 0000000..a33c1a8 --- /dev/null +++ b/classes/override_grub-efi_secureboot.inc @@ -0,0 +1,27 @@ +efi_populate() { + # DEST must be the root of the image so that EFIDIR is not + # nested under a top level directory. + DEST=$1 + + install -d ${DEST}${EFIDIR} + + GRUB_IMAGE="grub-efi-bootia32.efi" + DEST_IMAGE="bootia32.efi" + if [ "${TARGET_ARCH}" = "x86_64" ]; then + GRUB_IMAGE="grub-efi-bootx64.efi" + DEST_IMAGE="bootx64.efi" + fi + + #Install EFI binaries + install -m 0644 ${IMAGE_ROOTFS}/boot/efi${EFIDIR}/*.* ${DEST}${EFIDIR} + + #Install kernel and initramfs sig + install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}.p7b ${DEST}/vmlinuz.p7b + install -m 0644 ${INITRD_LIVE}.p7b ${DEST}/initrd.p7b + + EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') + printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh + + install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg + +} diff --git a/images/enea-nfv-access-host-common.inc b/images/enea-nfv-access-host-common.inc index e552168..77b873a 100644 --- a/images/enea-nfv-access-host-common.inc +++ b/images/enea-nfv-access-host-common.inc @@ -4,6 +4,7 @@ REQUIRE_FILES = " \ " REQUIRE_FILES_append_df-efi-secure-boot = " \ classes/override_image_types_ostree.inc \ + classes/override_grub-efi_secureboot.inc \ images/secure-boot.inc \ " -- cgit v1.2.3-54-g00ecf