]> git.proxmox.com Git - grub2.git/commitdiff
* util/grub-mkconfig.in: Stop setting GRUB_VIDEO_BACKEND. Make it
authorColin Watson <cjwatson@ubuntu.com>
Thu, 17 Jun 2010 15:01:17 +0000 (16:01 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Thu, 17 Jun 2010 15:01:17 +0000 (16:01 +0100)
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.

docs/grub.texi
util/grub-mkconfig.in
util/grub.d/00_header.in
util/grub.d/10_linux.in
util/grub.d/30_os-prober.in

index 9fe197da2c9cde3a81e12e0fa4d08b4795452af6..cea9f6a314710701f2e6f2a9d301755bc3367c42 100644 (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
index 836bd631808cfbbcdc2e93c0a68563b78780ab47..6bdc166c91acce7939124736ae7f2e212cf98383 100644 (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 \
index 76e0bc32dbcf954dfe4c46164a2025f4f0a72eec..8040a7c9b4116142b84e08006cbfb4a5309c8e2f 100644 (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
index b2cff628d3b5e5c21e5ba64b0e1d755a44489b7a..4b5ddb9d82e84deb18130d8597351896a03e21cf 100644 (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
index edef37e660adaeeeedae362ec3fe3ff5b498b6fd..90e2e3d9293daaa63d80247f72c5601757793a7d 100644 (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