blob: ec692f1646f3411b1e79ee25a49f610ed602eaf8 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001inherit grub-efi-cfg
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002
3efi_populate() {
4 # DEST must be the root of the image so that EFIDIR is not
5 # nested under a top level directory.
6 DEST=$1
7
8 install -d ${DEST}${EFIDIR}
9
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010 GRUB_IMAGE="grub-efi-bootia32.efi"
11 DEST_IMAGE="bootia32.efi"
Brad Bishop96ff1982019-08-19 13:50:42 -040012 if [ -n "${MLPREFIX}" ]; then
13 if [ "${TARGET_ARCH_MULTILIB_ORIGINAL}" = "x86_64" ]; then
14 GRUB_IMAGE="grub-efi-bootx64.efi"
15 DEST_IMAGE="bootx64.efi"
16 fi
17 else
18 if [ "${TARGET_ARCH}" = "x86_64" ]; then
19 GRUB_IMAGE="grub-efi-bootx64.efi"
20 DEST_IMAGE="bootx64.efi"
21 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023 install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}/${DEST_IMAGE}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060024 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050027 install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028}
29
30efi_iso_populate() {
31 iso_dir=$1
32 efi_populate $iso_dir
33 # Build a EFI directory to create efi.img
34 mkdir -p ${EFIIMGDIR}/${EFIDIR}
35 cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
Brad Bishop316dfdd2018-06-25 12:45:53 -040036 cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050037 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
Patrick Williamsc0f7c042017-02-23 20:41:17 -060038 printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" > ${EFIIMGDIR}/startup.nsh
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039 if [ -f "$iso_dir/initrd" ] ; then
40 cp $iso_dir/initrd ${EFIIMGDIR}
41 fi
42}
43
44efi_hddimg_populate() {
45 efi_populate $1
46}