pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
-grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+ grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+else
+ grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
+fi
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
rootdir=
grub_probe="${grub_probe} --device-map=${device_map}"
# Check if GRUB is installed.
-set $grub_setup dummy
-if test -f "$1"; then
- :
-else
- echo "$1: Not found." 1>&2
- exit 1
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+ set $grub_setup dummy
+ if test -f "$1"; then
+ :
+ else
+ echo "$1: Not found." 1>&2
+ exit 1
+ fi
fi
set $grub_mkimage dummy
rm -f $file || exit 1
fi
done
-for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ${pkglibdir}/*.img; do
+for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
cp -f $file ${grubdir} || exit 1
done
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+ for file in ${pkglibdir}/*.img; do
+ cp -f $file ${grubdir} || exit 1
+ done
+fi
# Write device to a variable so we don't have to traverse /dev every time.
grub_device=`$grub_probe --target=device ${grubdir}`
devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
# The order in this list is critical. Be careful when modifying it.
-modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module"
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+ modules="$modules biosdisk"
+else
+ modules="$modules ata"
+fi
+modules="$modules $fs_module $partmap_module $devabstraction_module"
prefix_drive=
if [ "x${devabstraction_module}" = "x" ] ; then
# Strip partition number
install_drive="`echo ${install_drive} | sed -e s/,[0-9]*//g`"
grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*//g`"
- if [ "x${grub_drive}" != "x${install_drive}" ] ; then
+ if [ "${target_cpu}-${platform}" != "i386-pc" ] ; then
+ # generic method (used on coreboot)
+ uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
+ if [ "x${uuid}" = "x" ] ; then
+ echo "UUID needed on this platform, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
+ exit 1
+ fi
+ prefix_drive="(UUID=${uuid})"
+ modules="$modules fs_uuid"
+ elif [ "x${grub_drive}" != "x${install_drive}" ] ; then
uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
if [ "x${uuid}" = "x" ] ; then
echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
relative_grubdir=/
fi
-$grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
+if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
+ $grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
-# Now perform the installation.
-$grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
- ${install_device} || exit 1
+ # Now perform the installation.
+ $grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
+ ${install_device} || exit 1
+else
+ $grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
+fi
# Prompt the user to check if the device map is correct.
echo "Installation finished. No error reported."