summaryrefslogtreecommitdiffstats
path: root/debian/patches/vt-handoff.patch
blob: 153c58d41e33bdfe77b79808e05e1cbc354bafbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From 4336395ce7d82827b466a0088e1b08d42ef24ae8 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 13 Jan 2014 12:13:30 +0000
Subject: 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: Andy Whitcroft <apw@canonical.com>
Forwarded: not-needed
Last-Update: 2013-12-25

Patch-Name: vt-handoff.patch
---
 configure.ac            | 11 +++++++++++
 util/grub.d/10_linux.in | 28 +++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 947fd529f..e11df6bc5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1948,6 +1948,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/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index d46d7852b..64204c216 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -24,6 +24,7 @@ ubuntu_recovery="@UBUNTU_RECOVERY@"
 quiet_boot="@QUIET_BOOT@"
 quick_boot="@QUICK_BOOT@"
 gfxpayload_dynamic="@GFXPAYLOAD_DYNAMIC@"
+vt_handoff="@VT_HANDOFF@"
 
 . "$pkgdatadir/grub-mkconfig_lib"
 
@@ -104,6 +105,14 @@ if [ "$ubuntu_recovery" = 1 ]; then
     GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY nomodeset"
 fi
 
+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"
@@ -149,7 +158,7 @@ linux_entry ()
   fi
   if ([ "$ubuntu_recovery" = 0 ] || [ x$type != xrecovery ]) && \
      ([ "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/"
@@ -228,6 +237,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