fi
case "${target_cpu}-${platform}" in
- i386-pc) mkimage_target=i386-pc ;;
sparc64-ieee1275) mkimage_target=sparc64-ieee1275-raw ;;
mips-yeeloong) mkimage_target=mipsel-yeeloong-elf ;;
- *) mkimage_target=i386-coreboot;
+ *) mkimage_target="${target_cpu}-${platform}" ;;
esac
+case "${target_cpu}-${platform}" in
+ i386-efi | x86_64-efi) imgext=efi ;;
+ mips-yeeloong | i386-coreboot | i386-multiboot | i386-ieee1275 \
+ | powerpc-ieee1275) imgext=elf ;;
+ *) imgext=img ;;
+esac
+
+
+$grub_mkimage ${config_opt} -O ${mkimage_target} --output=${grubdir}/core.${imgext} --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
+
+# Backward-compatibility kludges
+if [ "${target_cpu}-${platform}" = "mips-yeeloong" ]; then
+ cp ${grubdir}/core.${imgext} /boot/grub.elf
+elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
+ cp ${grubdir}/core.${imgext} /boot/grub/grub
+elif [ "${target_cpu}-${platform}" = "i386-efi" ] || [ "${target_cpu}-${platform}" = "x86_64-efi" ]; then
+ $grub_mkimage ${config_opt} -O ${mkimage_target} --output=${grubdir}/grub.efi --prefix="" $modules || exit 1
+fi
+
# Verify readability of a few critical files
- for file in grubenv core.${imgext} normal.mod ; do
-for file in grubenv normal.mod ; do
++for file in grubenv normal.mod core.${imgext} ; do
if is_path_readable_by_grub ${grubdir}/${file} ${grub_device} ${relative_grubdir}/${file} ; then : ; else
echo "GRUB is unable to read ${grubdir}/${file}" >&2
exit 1