* util/grub-mkconfig.in: Stop setting GRUB_VIDEO_BACKEND. Make it

available as a user override instead.  Replace the gfxterm backend
check with a check that ${GRUB_PREFIX}/video.lst is non-empty.
* util/grub.d/00_header.in (load_video): New generated function.
Call it before loading gfxterm rather than loading
${GRUB_VIDEO_BACKEND}.
* util/grub.d/10_linux.in (linux_entry): Call load_video.
* util/grub.d/30_os-prober.in (osx_entry): Likewise.
* docs/grub.texi (Simple configuration): Document
GRUB_VIDEO_BACKEND.
This commit is contained in:
Colin Watson 2010-06-17 16:01:17 +01:00
parent d49703d151
commit e4311a9f0f
5 changed files with 35 additions and 17 deletions

View file

@ -934,6 +934,16 @@ Disable the generation of recovery mode menu entries for Linux.
@item GRUB_DISABLE_NETBSD_RECOVERY
Disable the generation of recovery mode menu entries for NetBSD.
@item GRUB_VIDEO_BACKEND
If graphical video support is required, either because the @samp{gfxterm}
graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
then @command{grub-mkconfig} will normally load all available GRUB video
drivers and use the one most appropriate for your hardware. If you need to
override this for some reason, then you can set this option.
After @command{grub-install} has been run, the available video drivers are
listed in @file{/boot/grub/video.lst}.
@item GRUB_GFXMODE
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
you can only use modes which your graphics card supports via VESA BIOS

View file

@ -181,10 +181,7 @@ for x in ${GRUB_TERMINAL_OUTPUT}; do
GRUB_TERMINAL_OUTPUT=
break;
fi
# FIXME: this should do something smarter than just loading first
# video backend.
GRUB_VIDEO_BACKEND=$(head -n 1 ${GRUB_PREFIX}/video.lst || true)
if [ -z "${GRUB_VIDEO_BACKEND}" ] ; then
if [ ! -s "${GRUB_PREFIX}/video.lst" ] ; then
if [ "x$termoutdefault" != "x1" ]; then
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
fi
@ -242,7 +239,6 @@ export GRUB_DEVICE \
GRUB_FS \
GRUB_FONT_PATH \
GRUB_PRELOAD_MODULES \
GRUB_VIDEO_BACKEND \
GRUB_PREFIX
# These are optional, user-defined variables.
@ -265,6 +261,7 @@ export GRUB_DEFAULT \
GRUB_DISABLE_LINUX_UUID \
GRUB_DISABLE_LINUX_RECOVERY \
GRUB_DISABLE_NETBSD_RECOVERY \
GRUB_VIDEO_BACKEND \
GRUB_GFXMODE \
GRUB_BACKGROUND \
GRUB_THEME \

View file

@ -74,6 +74,24 @@ function savedefault {
save_env saved_entry
fi
}
function load_video {
EOF
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
cat <<EOF
insmod ${GRUB_VIDEO_BACKEND}
EOF
else
# Insert all available backends; GRUB will use the most appropriate.
for backend in $(cat "${GRUB_PREFIX}/video.lst"); do
cat <<EOF
insmod ${backend}
EOF
done
fi
cat <<EOF
}
EOF
serial=0;
@ -106,8 +124,8 @@ if [ "x$gfxterm" = x1 ]; then
cat << EOF
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
set gfxmode=${GRUB_GFXMODE}
load_video
insmod gfxterm
insmod ${GRUB_VIDEO_BACKEND}
EOF
if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
&& is_path_readable_by_grub "$GRUB_THEME"; then

View file

@ -66,6 +66,9 @@ linux_entry ()
# Use ELILO's generic "efifb" when it's known to be available.
# FIXME: We need an interface to select vesafb in case efifb can't be used.
if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
cat << EOF
load_video
EOF
if grep -qx "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null \
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-${version} 2> /dev/null; then
cat << EOF
@ -78,16 +81,6 @@ EOF
EOF
fi
# Load video drivers, which may be needed to allow the loader to program
# modes for the kernel.
# TODO: Other kernels may need the same mode programming, especially on
# EFI. Should we move this somewhere more generic?
for module in $(cat ${GRUB_PREFIX}/video.lst); do
cat << EOF
insmod $module
EOF
done
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi

View file

@ -44,7 +44,7 @@ EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
cat << EOF
insmod ${GRUB_VIDEO_BACKEND}
load_video
set do_resume=0
if [ /var/vm/sleepimage -nt10 / ]; then
if xnu_resume /var/vm/sleepimage; then