blob: 90badc03a0e58dd99945f73e482cc9a972571c45 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001inherit grub-efi-cfg
2
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
10 GRUB_IMAGE="grub-efi-bootia32.efi"
11 DEST_IMAGE="bootia32.efi"
12 if [ "${TARGET_ARCH}" = "x86_64" ]; then
13 GRUB_IMAGE="grub-efi-bootx64.efi"
14 DEST_IMAGE="bootx64.efi"
15 fi
16 install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}/${DEST_IMAGE}
17 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
18 printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh
19
20 install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
21}
22
23efi_iso_populate() {
24 iso_dir=$1
25 efi_populate $iso_dir
26 # Build a EFI directory to create efi.img
27 mkdir -p ${EFIIMGDIR}/${EFIDIR}
28 cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
29 cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
30 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
31 printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" > ${EFIIMGDIR}/startup.nsh
32 if [ -f "$iso_dir/initrd" ] ; then
33 cp $iso_dir/initrd ${EFIIMGDIR}
34 fi
35}
36
37efi_hddimg_populate() {
38 efi_populate $1
39}