From 2b1f58b70c6b6c11b00cdaeca7edb502111a8fc8 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 13 Nov 2013 00:29:14 +0000 Subject: [PATCH] Set vt.handoff=7 for smooth handoff to kernel graphical mode. --- configure.ac | 11 ++++ debian/changelog | 1 + debian/patches/series | 1 + debian/patches/vt_handoff.patch | 90 +++++++++++++++++++++++++++++++++ debian/rules | 3 +- util/grub.d/10_linux.in | 28 +++++++++- 6 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 debian/patches/vt_handoff.patch diff --git a/configure.ac b/configure.ac index 51dbe3867..e9ceef72d 100644 --- a/configure.ac +++ b/configure.ac @@ -1109,6 +1109,17 @@ else fi AC_SUBST([GFXPAYLOAD_DYNAMIC]) +AC_ARG_ENABLE([vt-handoff], + [AS_HELP_STRING([--enable-vt-handoff], + [use Linux vt.handoff option for flicker-free booting (default=no)])], + [], [enable_vt_handoff=no]) +if test x"$enable_vt_handoff" = xyes ; then + VT_HANDOFF=1 +else + VT_HANDOFF=0 +fi +AC_SUBST([VT_HANDOFF]) + LIBS="" AC_SUBST([FONT_SOURCE]) diff --git a/debian/changelog b/debian/changelog index b580d761e..47c2bbbaf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,7 @@ grub2 (2.00-20) UNRELEASED; urgency=low + Show the boot menu if the previous boot failed. + Set GRUB_GFXPAYLOAD_LINUX=keep unless it's known to be unsupported on the current hardware. + + Set vt.handoff=7 for smooth handoff to kernel graphical mode. -- Colin Watson Mon, 07 Oct 2013 09:48:53 +0100 diff --git a/debian/patches/series b/debian/patches/series index 196c83314..9e812a0c2 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -59,3 +59,4 @@ probe_dmraid.patch install_efi_ubuntu_flavours.patch quick_boot.patch gfxpayload_dynamic.patch +vt_handoff.patch diff --git a/debian/patches/vt_handoff.patch b/debian/patches/vt_handoff.patch new file mode 100644 index 000000000..189fe543a --- /dev/null +++ b/debian/patches/vt_handoff.patch @@ -0,0 +1,90 @@ +Description: Add configure option to use vt.handoff=7 + This is used for non-recovery Linux entries only; it enables flicker-free + booting if gfxpayload=keep is in use and a suitable kernel is present. +Author: Colin Watson +Author: Andy Whitcroft +Forwarded: not-needed +Last-Update: 2013-11-13 + +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -1109,6 +1109,17 @@ + fi + AC_SUBST([GFXPAYLOAD_DYNAMIC]) + ++AC_ARG_ENABLE([vt-handoff], ++ [AS_HELP_STRING([--enable-vt-handoff], ++ [use Linux vt.handoff option for flicker-free booting (default=no)])], ++ [], [enable_vt_handoff=no]) ++if test x"$enable_vt_handoff" = xyes ; then ++ VT_HANDOFF=1 ++else ++ VT_HANDOFF=0 ++fi ++AC_SUBST([VT_HANDOFF]) ++ + LIBS="" + + AC_SUBST([FONT_SOURCE]) +Index: b/util/grub.d/10_linux.in +=================================================================== +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -23,6 +23,7 @@ + quiet_boot="@QUIET_BOOT@" + quick_boot="@QUICK_BOOT@" + gfxpayload_dynamic="@GFXPAYLOAD_DYNAMIC@" ++vt_handoff="@VT_HANDOFF@" + + . "@datadir@/@PACKAGE@/grub-mkconfig_lib" + +@@ -88,6 +89,14 @@ + + title_correction_code= + ++if [ "$vt_handoff" = 1 ]; then ++ for word in $GRUB_CMDLINE_LINUX_DEFAULT; do ++ if [ "$word" = splash ]; then ++ GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \$vt_handoff" ++ fi ++ done ++fi ++ + linux_entry () + { + os="$1" +@@ -132,7 +141,7 @@ + fi + fi + if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 1 ]; then +- echo " set gfxpayload=\$linux_gfx_mode" | sed "s/^/$submenu_indentation/" ++ echo " gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/" + fi + + echo " insmod gzio" | sed "s/^/$submenu_indentation/" +@@ -205,6 +214,23 @@ + boot_device_id= + title_correction_code= + ++cat << 'EOF' ++function gfxmode { ++ set gfxpayload="${1}" ++EOF ++if [ "$vt_handoff" = 1 ]; then ++ cat << 'EOF' ++ if [ "${1}" = "keep" ]; then ++ set vt_handoff=vt.handoff=7 ++ else ++ set vt_handoff= ++ fi ++EOF ++fi ++cat << EOF ++} ++EOF ++ + # 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 ] || [ "$gfxpayload_dynamic" = 0 ]; then diff --git a/debian/rules b/debian/rules index 8f6355371..dd7c100e9 100755 --- a/debian/rules +++ b/debian/rules @@ -57,7 +57,8 @@ DEFAULT_CMDLINE := quiet splash confflags += \ --enable-quiet-boot \ --enable-quick-boot \ - --enable-gfxpayload-dynamic + --enable-gfxpayload-dynamic \ + --enable-vt-handoff substvars := \ -Vlsb-base-depends="lsb-base (>= 3.0-6)" \ -Vgfxpayload-depends="grub-gfxpayload-lists [any-i386 any-amd64]" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index c04bda5de..1e5b73277 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -23,6 +23,7 @@ datarootdir="@datarootdir@" quiet_boot="@QUIET_BOOT@" quick_boot="@QUICK_BOOT@" gfxpayload_dynamic="@GFXPAYLOAD_DYNAMIC@" +vt_handoff="@VT_HANDOFF@" . "@datadir@/@PACKAGE@/grub-mkconfig_lib" @@ -88,6 +89,14 @@ esac title_correction_code= +if [ "$vt_handoff" = 1 ]; then + for word in $GRUB_CMDLINE_LINUX_DEFAULT; do + if [ "$word" = splash ]; then + GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \$vt_handoff" + fi + done +fi + linux_entry () { os="$1" @@ -132,7 +141,7 @@ linux_entry () fi fi if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 1 ]; then - echo " set gfxpayload=\$linux_gfx_mode" | sed "s/^/$submenu_indentation/" + echo " gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/" fi echo " insmod gzio" | sed "s/^/$submenu_indentation/" @@ -205,6 +214,23 @@ prepare_root_cache= boot_device_id= title_correction_code= +cat << 'EOF' +function gfxmode { + set gfxpayload="${1}" +EOF +if [ "$vt_handoff" = 1 ]; then + cat << 'EOF' + if [ "${1}" = "keep" ]; then + set vt_handoff=vt.handoff=7 + else + set vt_handoff= + fi +EOF +fi +cat << EOF +} +EOF + # 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 ] || [ "$gfxpayload_dynamic" = 0 ]; then