grub-install for yeeloong
This commit is contained in:
parent
d114e89ca8
commit
546d060783
2 changed files with 27 additions and 7 deletions
|
@ -47,3 +47,7 @@ mmap_mod_SOURCES = mmap/mmap.c mmap/mips/yeeloong/uppermem.c
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
sbin_SCRIPTS += grub-install
|
||||||
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,11 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||||
target_cpu=@target_cpu@
|
target_cpu=@target_cpu@
|
||||||
platform=@platform@
|
platform=@platform@
|
||||||
|
font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
|
||||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||||
|
|
||||||
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
|
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
|
||||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
|
||||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||||
else
|
else
|
||||||
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
|
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
|
||||||
|
@ -79,6 +80,11 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
--disk-module=MODULE disk module to use
|
--disk-module=MODULE disk module to use
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
if [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
|
||||||
|
cat <<EOF
|
||||||
|
--font=FILE font file to use
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
|
@ -103,6 +109,8 @@ for option in "$@"; do
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
--modules=*)
|
--modules=*)
|
||||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
|
--font=*)
|
||||||
|
font=`echo "$option" | sed 's/--font=//'` ;;
|
||||||
--root-directory=*)
|
--root-directory=*)
|
||||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||||
--grub-setup=*)
|
--grub-setup=*)
|
||||||
|
@ -144,7 +152,7 @@ done
|
||||||
# for make_system_path_relative_to_its_root()
|
# for make_system_path_relative_to_its_root()
|
||||||
. ${libdir}/grub/grub-mkconfig_lib
|
. ${libdir}/grub/grub-mkconfig_lib
|
||||||
|
|
||||||
if test "x$install_device" = x; then
|
if test "x$install_device" = x && test "${target_cpu}-${platform}" != "mips-yeeloong"; then
|
||||||
echo "install_device not specified." 1>&2
|
echo "install_device not specified." 1>&2
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -274,21 +282,27 @@ partmap_module=`$grub_probe --target=partmap --device ${grub_device} 2> /dev/nul
|
||||||
# Device abstraction module, if any (lvm, raid).
|
# Device abstraction module, if any (lvm, raid).
|
||||||
devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
|
devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
|
||||||
|
|
||||||
|
if [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
|
||||||
|
modules="sm712 gfxterm at_keyboard $modules"
|
||||||
|
fi
|
||||||
|
|
||||||
# The order in this list is critical. Be careful when modifying it.
|
# The order in this list is critical. Be careful when modifying it.
|
||||||
modules="$modules $disk_module"
|
modules="$modules $disk_module"
|
||||||
modules="$modules $fs_module $partmap_module $devabstraction_module"
|
modules="$modules $fs_module $partmap_module $devabstraction_module"
|
||||||
|
|
||||||
prefix_drive=
|
prefix_drive=
|
||||||
if [ "x${devabstraction_module}" = "x" ] ; then
|
if [ "x${devabstraction_module}" = "x" ] ; then
|
||||||
|
if [ x"${install_device}" != x ]; then
|
||||||
if echo "${install_device}" | grep -qx "(.*)" ; then
|
if echo "${install_device}" | grep -qx "(.*)" ; then
|
||||||
install_drive="${install_device}"
|
install_drive="${install_device}"
|
||||||
else
|
else
|
||||||
install_drive="`$grub_probe --target=drive --device ${install_device}`"
|
install_drive="`$grub_probe --target=drive --device ${install_device}`"
|
||||||
fi
|
fi
|
||||||
|
install_drive="`echo ${install_drive} | sed -e s/,[0-9]*[a-z]*//g`"
|
||||||
|
fi
|
||||||
grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
|
grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
|
||||||
|
|
||||||
# Strip partition number
|
# Strip partition number
|
||||||
install_drive="`echo ${install_drive} | sed -e s/,[0-9]*[a-z]*//g`"
|
|
||||||
grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*[a-z]*//g`"
|
grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*[a-z]*//g`"
|
||||||
if [ "$disk_module" = ata ] ; then
|
if [ "$disk_module" = ata ] ; then
|
||||||
# generic method (used on coreboot and ata mod)
|
# generic method (used on coreboot and ata mod)
|
||||||
|
@ -323,6 +337,8 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
||||||
# Now perform the installation.
|
# Now perform the installation.
|
||||||
$grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} --device-map=${device_map} \
|
$grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} --device-map=${device_map} \
|
||||||
${install_device} || exit 1
|
${install_device} || exit 1
|
||||||
|
elif [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
|
||||||
|
$grub_mkimage -f ${font} -d ${pkglibdir} -O elf --output=/boot/grub.elf --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
||||||
else
|
else
|
||||||
$grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
$grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue