remove ieee1275/grub-install and adapt grub-install for ieee1275
This commit is contained in:
parent
9494ef9aaf
commit
8111f933ec
3 changed files with 80 additions and 283 deletions
|
@ -41,6 +41,7 @@ grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
|||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
|
||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||
rootdir=
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
modules=
|
||||
|
@ -52,6 +53,11 @@ recheck=no
|
|||
debug=no
|
||||
debug_image=
|
||||
|
||||
update_nvram=yes
|
||||
|
||||
ofpathname=`which ofpathname`
|
||||
nvsetenv=`which nvsetenv`
|
||||
|
||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
||||
disk_module=biosdisk
|
||||
elif [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
||||
|
@ -63,8 +69,16 @@ fi
|
|||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
if test "x$install_device" = x && test "${target_cpu}-${platform}" != "mips-yeeloong" && test "${target_cpu}-${platform}" != "i386-ieee1275" && test "${target_cpu}-${platform}" != "powerpc-ieee1275"; then
|
||||
cat <<EOF
|
||||
Usage: $self [OPTION] install_device
|
||||
EOF
|
||||
else
|
||||
cat <<EOF
|
||||
Usage: $self [OPTION] [install_device]
|
||||
EOF
|
||||
fi
|
||||
cat <<EOF
|
||||
Install GRUB on your drive.
|
||||
|
||||
-h, --help print this message and exit
|
||||
|
@ -74,6 +88,7 @@ Install GRUB on your drive.
|
|||
instead of the root directory
|
||||
--grub-setup=FILE use FILE as grub-setup
|
||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||
--grub-mkrelpath=FILE use FILE as grub-mkrelpath
|
||||
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
|
||||
--grub-probe=FILE use FILE as grub-probe
|
||||
--no-floppy do not probe any floppy drive
|
||||
|
@ -85,6 +100,11 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
|||
--disk-module=MODULE disk module to use
|
||||
EOF
|
||||
fi
|
||||
if [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ] ; then
|
||||
cat <<EOF
|
||||
--no-nvram don't update the boot-device NVRAM variable
|
||||
EOF
|
||||
fi
|
||||
if [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
|
||||
cat <<EOF
|
||||
--font=FILE font file to use
|
||||
|
@ -154,6 +174,11 @@ do
|
|||
--grub-mkimage=*)
|
||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||
|
||||
--grub-mkrelpath)
|
||||
grub_mkrelpath=`argument $option "$@"`; shift;;
|
||||
--grub-mkimage=*)
|
||||
grub_mkrelpath=`echo "$option" | sed 's/--grub-mkrelpath=//'` ;;
|
||||
|
||||
--grub-mkdevicemap)
|
||||
grub_mkdevicemap=`argument $option "$@"`; shift;;
|
||||
--grub-mkdevicemap=*)
|
||||
|
@ -178,6 +203,9 @@ do
|
|||
disk_module=`echo "$option" | sed 's/--disk-module=//'`
|
||||
fi ;;
|
||||
|
||||
--no-nvram)
|
||||
update_nvram=no ;;
|
||||
|
||||
# This is an undocumented feature...
|
||||
--debug)
|
||||
debug=yes ;;
|
||||
|
@ -207,7 +235,7 @@ done
|
|||
# for make_system_path_relative_to_its_root()
|
||||
. ${libdir}/grub/grub-mkconfig_lib
|
||||
|
||||
if test "x$install_device" = x && test "${target_cpu}-${platform}" != "mips-yeeloong"; then
|
||||
if test "x$install_device" = x && test "${target_cpu}-${platform}" != "mips-yeeloong" && test "${target_cpu}-${platform}" != "i386-ieee1275" && test "${target_cpu}-${platform}" != "powerpc-ieee1275"; then
|
||||
echo "install_device not specified." 1>&2
|
||||
usage
|
||||
exit 1
|
||||
|
@ -405,19 +433,61 @@ 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;
|
||||
i386-coreboot) mkimage_target=i386-coreboot ;;
|
||||
i386-multiboot) mkimage_target=i386-multiboot ;;
|
||||
i386-qemu) mkimage_target=i386-multiboot ;;
|
||||
i386-ieee1275) mkimage_target=i386-ieee1275 ;;
|
||||
powerpc-ieee1275) mkimage_target=powerpc-ieee1275 ;;
|
||||
*) echo "Unknown platform"; exit 1 ;;
|
||||
esac
|
||||
|
||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
||||
$grub_mkimage ${config_opt} -O ${mkimage_target} --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
||||
$grub_mkimage ${config_opt} -O ${mkimage_target} --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
||||
|
||||
# Copy to traditional location for compatibility
|
||||
if [ "${target_cpu}-${platform}" = "mips-yeeloong" ]; then
|
||||
cp ${grubdir}/core.img /boot/grub.elf
|
||||
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
||||
cp ${grubdir}/core.img /boot/grub
|
||||
fi
|
||||
|
||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
||||
# Now perform the installation.
|
||||
$grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} --device-map=${device_map} \
|
||||
${install_device} || exit 1
|
||||
elif [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
|
||||
$grub_mkimage ${config_opt} -f ${font} -d ${pkglibdir} -O ${mkimage_target} --output=/boot/grub.elf --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
||||
else
|
||||
$grub_mkimage -O ${mkimage_target} ${config_opt} -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
||||
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
||||
if [ x"$update_nvram" = xyes ]; then
|
||||
set $ofpathname dummy
|
||||
if test -f "$1"; then
|
||||
:
|
||||
else
|
||||
echo "$1: Not found." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
set $nvsetenv dummy
|
||||
if test -f "$1"; then
|
||||
:
|
||||
else
|
||||
echo "$1: Not found." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# Get the Open Firmware device tree path translation.
|
||||
dev=`echo $grub_device | sed -e 's/\/dev\///' -e 's/[0-9]\+//'`
|
||||
partno=`echo $grub_device | sed -e 's/.*[^0-9]\([0-9]\+\)$/\1/'`
|
||||
ofpath=`$ofpathname $dev` || {
|
||||
echo "Couldn't find Open Firmware device tree path for $dev."
|
||||
echo "You will have to set boot-device manually."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Point boot-device at the new grub install
|
||||
boot_device="$ofpath:$partno,"`grub-mkrelpath ${grubdir}/core.img | sed 's,/,\\,g'`
|
||||
"$nvsetenv" boot-device "$boot_device" || {
|
||||
echo "$nvsetenv failed."
|
||||
echo "You will have to set boot-device manually. At the Open Firmware prompt, type:"
|
||||
echo " setenv boot-device $boot_device"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Installation finished. No error reported."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue