blob: 90badc03a0e58dd99945f73e482cc9a972571c45 [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"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012 if [ "${TARGET_ARCH}" = "x86_64" ]; then
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013 GRUB_IMAGE="grub-efi-bootx64.efi"
14 DEST_IMAGE="bootx64.efi"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -050016 install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}/${DEST_IMAGE}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060017 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018 printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050020 install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021}
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}
Brad Bishop316dfdd2018-06-25 12:45:53 -040029 cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050030 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
Patrick Williamsc0f7c042017-02-23 20:41:17 -060031 printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" > ${EFIIMGDIR}/startup.nsh
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032 if [ -f "$iso_dir/initrd" ] ; then
33 cp $iso_dir/initrd ${EFIIMGDIR}
34 fi
35}
36
37efi_hddimg_populate() {
38 efi_populate $1
39}