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