From 4ad3130c20bfb4eac7c1fd4eedb7d10e49c364c9 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin-Solenikov Date: Wed, 18 Sep 2019 16:12:47 +0300 Subject: live-vm-common.bbclass: provide efi population functions for live images Define common functions for populating EFI directories in live image by reusing common code from grub-efi and systemd-boot bbclasses. (From OE-Core rev: 3728899a0cd543793db258da0976362b4bde7133) Signed-off-by: Dmitry Eremin-Solenikov Signed-off-by: Richard Purdie --- meta/classes/live-vm-common.bbclass | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'meta/classes/live-vm-common.bbclass') diff --git a/meta/classes/live-vm-common.bbclass b/meta/classes/live-vm-common.bbclass index 68105d9b84..74e7074a53 100644 --- a/meta/classes/live-vm-common.bbclass +++ b/meta/classes/live-vm-common.bbclass @@ -29,6 +29,39 @@ def pcbios(d): PCBIOS = "${@pcbios(d)}" PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS') == '1']}" +# efi_populate_common DEST BOOTLOADER +efi_populate_common() { + # 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} + + install -m 0644 ${DEPLOY_DIR_IMAGE}/$2-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE} + EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') + printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh +} + +efi_iso_populate() { + iso_dir=$1 + efi_populate $iso_dir + # Build a EFI directory to create efi.img + mkdir -p ${EFIIMGDIR}/${EFIDIR} + cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR} + cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR} + + EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') + printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${EFIIMGDIR}/startup.nsh + + if [ -f "$iso_dir/initrd" ] ; then + cp $iso_dir/initrd ${EFIIMGDIR} + fi +} + +efi_hddimg_populate() { + efi_populate $1 +} + inherit ${EFI_CLASS} inherit ${PCBIOS_CLASS} -- cgit v1.2.3-54-g00ecf