2008-08-03 Robert Millan <rmh@aybabtu.com>

* util/grub.d/00_header.in: Be platform-agnostic.  Probe for existence
        of modules instead of assuming which platform provides what.
        * util/update-grub.in: Likewise.
This commit is contained in:
robertmh 2008-08-03 16:38:40 +00:00
parent 2d52f57f10
commit 52768e37c2
3 changed files with 48 additions and 21 deletions

View File

@ -1,3 +1,9 @@
2008-08-03 Robert Millan <rmh@aybabtu.com>
* util/grub.d/00_header.in: Be platform-agnostic. Probe for existence
of modules instead of assuming which platform provides what.
* util/update-grub.in: Likewise.
2008-08-03 Robert Millan <rmh@aybabtu.com>
* kern/i386/pc/init.c (make_install_device): Check for `grub_prefix'

View File

@ -16,10 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
platform=@platform@
grub_prefix=`echo /boot/grub | sed ${transform}`
. ${libdir}/grub/update-grub_lib
@ -37,20 +39,37 @@ set default=${GRUB_DEFAULT}
set timeout=${GRUB_TIMEOUT}
EOF
case ${platform}:${GRUB_TERMINAL} in
pc:gfxterm)
case x${GRUB_TERMINAL} in
xgfxterm)
# Make the font accessible
prepare_grub_to_access_device `${grub_probe} --target=device ${GRUB_FONT_PATH}`
# Pick a video backend
video_backend=
for i in vbe ; do
if test -e ${grub_prefix}/$i.mod ; then
video_backend=$i
break
fi
done
if ! [ "${video_backend}" ] ; then
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
fi
cat << EOF
if font `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
insmod ${video_backend}
terminal gfxterm
fi
EOF
;;
*:serial)
xserial)
if ! test -e ${grub_prefix}/serial.mod ; then
echo "Serial terminal not available on this platform." >&2 ; exit 1
fi
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
echo "Warning, requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used." >&2
GRUB_SERIAL_COMMAND=serial
@ -58,7 +77,10 @@ EOF
echo "${GRUB_SERIAL_COMMAND}"
echo "terminal serial"
;;
*:*)
x)
# Just use the native terminal
;;
x*)
echo "terminal ${GRUB_TERMINAL}"
;;
esac

View File

@ -26,7 +26,6 @@ sysconfdir=@sysconfdir@
grub_prefix=`echo /boot/grub | sed ${transform}`
grub_cfg=${grub_prefix}/grub.cfg
update_grub_dir=${sysconfdir}/grub.d
platform=@platform@
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
@ -127,15 +126,15 @@ if test -f ${sysconfdir}/default/grub ; then
. ${sysconfdir}/default/grub
fi
# if ${GRUB_TERMINAL} is set, check it has a sane value. if undefined,
# fallback to our default
case ${platform}:${GRUB_TERMINAL} in
pc:) GRUB_TERMINAL=gfxterm ;;
ieee1275:) GRUB_TERMINAL=ofconsole ;;
*:) GRUB_TERMINAL=console ;;
pc:console | pc:serial | ieee1275:ofconsole | ieee1275:console | *:gfxterm)
;;
*:*) echo "Invalid terminal \"${GRUB_TERMINAL}\"" >&2 ; exit 1 ;;
case x${GRUB_TERMINAL} in
x)
# If this platform supports gfxterm, try to use it.
if test -e ${grub_prefix}/gfxterm.mod ; then
GRUB_TERMINAL=gfxterm
fi
;;
xconsole | xserial | xofconsole | xgfxterm) ;;
*) echo "Invalid terminal \"${GRUB_TERMINAL}\"" >&2 ; exit 1 ;;
esac
# check for terminals that require fonts
@ -144,16 +143,16 @@ case ${GRUB_TERMINAL} in
if path=`font_path` ; then
GRUB_FONT_PATH="${path}"
else
# fallback to console
GRUB_TERMINAL=console
# fallback to the native terminal for this platform
unset GRUB_TERMINAL
fi
;;
esac
# does our terminal support utf-8 ?
case ${platform}:${GRUB_TERMINAL} in
*:gfxterm) ;;
*:*)
case ${GRUB_TERMINAL} in
gfxterm) ;;
*)
# make sure all our children behave in conformance with ascii..
export LANG=C
;;