Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | inherit grub-efi-cfg |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | |
| 3 | efi_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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 10 | GRUB_IMAGE="grub-efi-bootia32.efi" |
| 11 | DEST_IMAGE="bootia32.efi" |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 12 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 23 | install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}/${DEST_IMAGE} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 24 | EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 27 | install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | efi_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 Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 36 | cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR} |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 37 | EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 38 | printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" > ${EFIIMGDIR}/startup.nsh |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | if [ -f "$iso_dir/initrd" ] ; then |
| 40 | cp $iso_dir/initrd ${EFIIMGDIR} |
| 41 | fi |
| 42 | } |
| 43 | |
| 44 | efi_hddimg_populate() { |
| 45 | efi_populate $1 |
| 46 | } |