diff options
author | ozgursarier | 2017-11-12 16:40:31 +0300 |
---|---|---|
committer | ozgursarier | 2017-11-12 16:40:31 +0300 |
commit | 34d117402eaf3d2e1b63b98156e7faa853183b48 (patch) | |
tree | 3c6fbe121301a1320b4a33cafbcd1d66e1db21dc | |
download | aur-34d117402eaf3d2e1b63b98156e7faa853183b48.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 80 | ||||
-rw-r--r-- | 01-intel-ucode.patch | 52 | ||||
-rw-r--r-- | 02-10_linux-detect-archlinux-initramfs.patch | 44 | ||||
-rw-r--r-- | 03-add-GRUB_COLOR_variables.patch | 32 | ||||
-rw-r--r-- | 04-ext4_feature_encrypt.patch | 143 | ||||
-rw-r--r-- | 05-gettext_quiet.patch | 30 | ||||
-rw-r--r-- | 06-sleep_shift.patch | 95 | ||||
-rw-r--r-- | 07-maybe_quiet.patch | 370 | ||||
-rw-r--r-- | 08-quick_boot.patch | 358 | ||||
-rw-r--r-- | PKGBUILD | 377 | ||||
-rw-r--r-- | grub.install | 15 | ||||
-rw-r--r-- | grub.silent | 55 |
12 files changed, 1651 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..872f7467632b --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,80 @@ +# Generated by mksrcinfo v8 +# Sun Nov 12 13:35:37 UTC 2017 +pkgbase = grub-silent + pkgdesc = GNU GRand Unified Bootloader (2) [without welcome and kernel messages] + pkgver = 2.02 + pkgrel = 1 + url = https://www.gnu.org/software/grub/ + install = grub.install + arch = x86_64 + arch = i686 + license = GPL3 + makedepends = git + makedepends = rsync + makedepends = xz + makedepends = freetype2 + makedepends = ttf-dejavu + makedepends = python + makedepends = autogen + makedepends = texinfo + makedepends = help2man + makedepends = gettext + makedepends = device-mapper + makedepends = fuse2 + depends = sh + depends = xz + depends = gettext + depends = device-mapper + optdepends = freetype2: For grub-mkfont usage + optdepends = fuse2: For grub-mount usage + optdepends = dosfstools: For grub-mkrescue FAT FS and EFI support + optdepends = efibootmgr: For grub-install EFI support + optdepends = libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue + optdepends = os-prober: To detect other OSes when generating grub.cfg in BIOS systems + optdepends = mtools: For grub-mkrescue FAT FS support + provides = grub + provides = grub-common + provides = grub-bios + provides = grub-emu + provides = grub-efi- + conflicts = grub + conflicts = grub-common + conflicts = grub-bios + conflicts = grub-emu + conflicts = grub-efi- + conflicts = grub-legacy + conflicts = grub-git + replaces = grub + replaces = grub-common + replaces = grub-bios + replaces = grub-emu + replaces = grub-efi- + options = !makeflags + backup = etc/grub.d/40_custom + source = https://ftp.gnu.org/gnu/grub/grub-2.02.tar.xz + source = https://git.savannah.nongnu.org/cgit/grub-extras.git/snapshot/grub-extras-f2a079441939eee7251bf141986cdd78946e1d20.tar.gz + source = https://ftp.gnu.org/gnu/unifont/unifont-10.0.06/unifont-10.0.06.bdf.gz + source = 01-intel-ucode.patch + source = 02-10_linux-detect-archlinux-initramfs.patch + source = 03-add-GRUB_COLOR_variables.patch + source = 04-ext4_feature_encrypt.patch + source = 05-gettext_quiet.patch + source = 06-sleep_shift.patch + source = 07-maybe_quiet.patch + source = 08-quick_boot.patch + source = grub.silent + sha256sums = 810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f + sha256sums = 2844601914cea6b1231eca0104853a93c4d67a5209933a0766f1475953300646 + sha256sums = 0d81571fc519573057b7641d26a31ead55cc0b02a931589fb346a3a534c3dcc1 + sha256sums = 37adb95049f6cdcbdbf60ed6b6440c5be99a4cd307a0f96c3c3837b6c2e07f3c + sha256sums = b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3 + sha256sums = a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29 + sha256sums = 82b9e3fc8547c496cd28f39e75d8224d83c40481df3bfa33ae8169f7c7861362 + sha256sums = 39d7843dfe1e10ead912a81be370813b8621794a7967b3cc5e4d4188b5bf7264 + sha256sums = 4b189e00a8c97ec09903e9588e02fc78b4bb114ee4822fcce13811aca00c8884 + sha256sums = b7489c7facc4fb3dad4426c9c00079b64908640a2bec2409e22194daa3f72af4 + sha256sums = 057f076ddca241d92a094bc05828e3eb18d3439bf4d2f3d8ca8fa1c51b5b1b2b + sha256sums = 96f3826225ee0e7a874406b73f4bb417fc1b16e5d63dd5eabde356c51833898e + +pkgname = grub-silent + diff --git a/01-intel-ucode.patch b/01-intel-ucode.patch new file mode 100644 index 000000000000..98d8de82d0c0 --- /dev/null +++ b/01-intel-ucode.patch @@ -0,0 +1,52 @@ +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index de9044c..f5d3e78 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -133,13 +133,15 @@ linux_entry () + echo '$(echo "$message" | grub_quote)' + linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} + EOF +- if test -n "${initrd}" ; then ++ if test -n "${initrd}" -o -n "${initrd_extra}" ; then + # TRANSLATORS: ramdisk isn't identifier. Should be translated. + message="$(gettext_printf "Loading initial ramdisk ...")" +- sed "s/^/$submenu_indentation/" << EOF +- echo '$(echo "$message" | grub_quote)' +- initrd ${rel_dirname}/${initrd} +-EOF ++ printf ' %s\n' "echo '$(echo "$message" | grub_quote)'" | sed "s/^/$submenu_indentation/" ++ printf ' %s ' 'initrd' | sed "s/^/$submenu_indentation/" ++ for i in ${initrd_extra} ${initrd}; do ++ printf ' %s/%s' "${rel_dirname}" "${i}" ++ done ++ printf '\n' + fi + sed "s/^/$submenu_indentation/" << EOF + } +@@ -202,6 +204,12 @@ while [ "x$list" != "x" ] ; do + break + fi + done ++ initrd_extra= ++ for i in intel-ucode.img; do ++ if test -e "${dirname}/${i}" ; then ++ initrd_extra="${initrd_extra} ${i}" ++ fi ++ done + + config= + for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do +@@ -216,8 +224,8 @@ while [ "x$list" != "x" ] ; do + initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` + fi + +- if test -n "${initrd}" ; then +- gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 ++ if test -n "${initrd}" -o -n "${initrd_extra}" ; then ++ gettext_printf "Found initrd image(s) in %s:%s\n" "${dirname}" "${initrd_extra} ${initrd}" >&2 + elif test -z "${initramfs}" ; then + # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's + # no initrd or builtin initramfs, it can't work here. +-- +2.9.2 + diff --git a/02-10_linux-detect-archlinux-initramfs.patch b/02-10_linux-detect-archlinux-initramfs.patch new file mode 100644 index 000000000000..5cbd19f51ca9 --- /dev/null +++ b/02-10_linux-detect-archlinux-initramfs.patch @@ -0,0 +1,44 @@ +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index f5d3e78..ef59c8c 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -83,6 +83,8 @@ linux_entry () + case $type in + recovery) + title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;; ++ fallback) ++ title="$(gettext_printf "%s, with Linux %s (fallback initramfs)" "${os}" "${version}")" ;; + *) + title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;; + esac +@@ -186,7 +188,7 @@ while [ "x$list" != "x" ] ; do + basename=`basename $linux` + dirname=`dirname $linux` + rel_dirname=`make_system_path_relative_to_its_root $dirname` +- version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` ++ version=`echo $basename | sed -e "s,vmlinuz-,,g"` + alt_version=`echo $version | sed -e "s,\.old$,,g"` + linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + +@@ -248,6 +250,18 @@ while [ "x$list" != "x" ] ; do + + linux_entry "${OS}" "${version}" advanced \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++ ++ if test -e "${dirname}/initramfs-${version}-fallback.img" ; then ++ initrd="initramfs-${version}-fallback.img" ++ ++ if test -n "${initrd}" ; then ++ gettext_printf "Found fallback initrd image(s) in %s:%s\n" "${dirname}" "${initrd_extra} ${initrd}" >&2 ++ fi ++ ++ linux_entry "${OS}" "${version}" fallback \ ++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++ fi ++ + if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then + linux_entry "${OS}" "${version}" recovery \ + "single ${GRUB_CMDLINE_LINUX}" +-- +2.9.2 + diff --git a/03-add-GRUB_COLOR_variables.patch b/03-add-GRUB_COLOR_variables.patch new file mode 100644 index 000000000000..c113a81d5754 --- /dev/null +++ b/03-add-GRUB_COLOR_variables.patch @@ -0,0 +1,32 @@ +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index 3390ba9..c416489 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -218,6 +218,8 @@ export GRUB_DEFAULT \ + GRUB_THEME \ + GRUB_GFXPAYLOAD_LINUX \ + GRUB_DISABLE_OS_PROBER \ ++ GRUB_COLOR_NORMAL \ ++ GRUB_COLOR_HIGHLIGHT \ + GRUB_INIT_TUNE \ + GRUB_SAVEDEFAULT \ + GRUB_ENABLE_CRYPTODISK \ +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index d2e7252..8259f45 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -125,6 +125,14 @@ cat <<EOF + + EOF + ++if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then ++ cat << EOF ++set menu_color_normal=$GRUB_COLOR_NORMAL ++set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT ++ ++EOF ++fi ++ + serial=0; + gfxterm=0; + for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do diff --git a/04-ext4_feature_encrypt.patch b/04-ext4_feature_encrypt.patch new file mode 100644 index 000000000000..65b9b9f69a16 --- /dev/null +++ b/04-ext4_feature_encrypt.patch @@ -0,0 +1,143 @@ +From 47a39db1b92abd0030b6be6c3a809bd9e4f39def Mon Sep 17 00:00:00 2001 +From: Eric Biggers <ebiggers@google.com> +Date: Thu, 29 Jun 2017 13:27:49 +0000 +Subject: Allow GRUB to mount ext2/3/4 filesystems that have the encryption + feature. + +On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set. +For a regular file, this means its contents are encrypted; for a +directory, this means the filenames in its directory entries are +encrypted; and for a symlink, this means its target is encrypted. Since +GRUB cannot decrypt encrypted contents or filenames, just issue an error +if it would need to do so. This is sufficient to allow unencrypted boot +files to co-exist with encrypted files elsewhere on the filesystem. + +(Note that encrypted regular files and symlinks will not normally be +encountered outside an encrypted directory; however, it's possible via +hard links, so they still need to be handled.) + +Tested by booting from an ext4 /boot partition on which I had run +'tune2fs -O encrypt'. I also verified that the expected error messages +are printed when trying to access encrypted directories, files, and +symlinks from the GRUB command line. Also ran 'sudo ./grub-fs-tester +ext4_encrypt'; note that this requires e2fsprogs v1.43+ and Linux v4.1+. + +Signed-off-by: Eric Biggers <ebiggers@google.com> + +Origin: upstream, https://git.savannah.gnu.org/cgit/grub.git/commit/?id=734668238fcc0ef691a080839e04f33854fa133a +Bug-Debian: https://bugs.debian.org/840204 +Last-Update: 2017-07-06 + +Patch-Name: ext4_feature_encrypt.patch +--- + grub-core/fs/ext2.c | 23 ++++++++++++++++++++++- + tests/ext234_test.in | 1 + + tests/util/grub-fs-tester.in | 10 ++++++++++ + 3 files changed, 33 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index cdce63bcc..b8ad75a0f 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -102,6 +102,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 + #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 + #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 ++#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 + + /* The set of back-incompatible features this driver DOES support. Add (OR) + * flags here as the related features are implemented into the driver. */ +@@ -109,7 +110,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + | EXT4_FEATURE_INCOMPAT_EXTENTS \ + | EXT4_FEATURE_INCOMPAT_FLEX_BG \ + | EXT2_FEATURE_INCOMPAT_META_BG \ +- | EXT4_FEATURE_INCOMPAT_64BIT) ++ | EXT4_FEATURE_INCOMPAT_64BIT \ ++ | EXT4_FEATURE_INCOMPAT_ENCRYPT) + /* List of rationales for the ignored "incompatible" features: + * needs_recovery: Not really back-incompatible - was added as such to forbid + * ext2 drivers from mounting an ext3 volume with a dirty +@@ -138,6 +140,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define EXT3_JOURNAL_FLAG_DELETED 4 + #define EXT3_JOURNAL_FLAG_LAST_TAG 8 + ++#define EXT4_ENCRYPT_FLAG 0x800 + #define EXT4_EXTENTS_FLAG 0x80000 + + /* The ext2 superblock. */ +@@ -706,6 +709,12 @@ grub_ext2_read_symlink (grub_fshelp_node_t node) + grub_ext2_read_inode (diro->data, diro->ino, &diro->inode); + if (grub_errno) + return 0; ++ ++ if (diro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) ++ { ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "symlink is encrypted"); ++ return 0; ++ } + } + + symlink = grub_malloc (grub_le_to_cpu32 (diro->inode.size) + 1); +@@ -749,6 +758,12 @@ grub_ext2_iterate_dir (grub_fshelp_node_t dir, + return 0; + } + ++ if (diro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) ++ { ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "directory is encrypted"); ++ return 0; ++ } ++ + /* Search the file. */ + while (fpos < grub_le_to_cpu32 (diro->inode.size)) + { +@@ -859,6 +874,12 @@ grub_ext2_open (struct grub_file *file, const char *name) + goto fail; + } + ++ if (fdiro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) ++ { ++ err = grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "file is encrypted"); ++ goto fail; ++ } ++ + grub_memcpy (data->inode, &fdiro->inode, sizeof (struct grub_ext2_inode)); + grub_free (fdiro); + +diff --git a/tests/ext234_test.in b/tests/ext234_test.in +index c986960a8..5f4553607 100644 +--- a/tests/ext234_test.in ++++ b/tests/ext234_test.in +@@ -30,3 +30,4 @@ fi + "@builddir@/grub-fs-tester" ext3 + "@builddir@/grub-fs-tester" ext4 + "@builddir@/grub-fs-tester" ext4_metabg ++"@builddir@/grub-fs-tester" ext4_encrypt +diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in +index 2337771a1..5219aa8b4 100644 +--- a/tests/util/grub-fs-tester.in ++++ b/tests/util/grub-fs-tester.in +@@ -135,6 +135,12 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + # Could go further but what's the point? + MAXBLKSIZE=$((65536*1024)) + ;; ++ xext4_encrypt) ++ # OS LIMITATION: Linux currently only allows the 'encrypt' feature ++ # in combination with block_size = PAGE_SIZE (4096 bytes on x86). ++ MINBLKSIZE=$(getconf PAGE_SIZE) ++ MAXBLKSIZE=$MINBLKSIZE ++ ;; + xext*) + MINBLKSIZE=1024 + if [ $MINBLKSIZE -lt $SECSIZE ]; then +@@ -766,6 +772,10 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + + MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext4" -O meta_bg,^resize_inode -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" + MOUNTFS=ext4 + ;; ++ xext4_encrypt) ++ MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.ext4" -O encrypt -b $BLKSIZE -L "$FSLABEL" -q "${MOUNTDEVICE}" ++ MOUNTFS=ext4 ++ ;; + xext*) + MKE2FS_DEVICE_SECTSIZE=$SECSIZE "mkfs.$fs" -b $BLKSIZE -L "$FSLABEL" -q "${LODEVICES[0]}" ;; + xxfs) diff --git a/05-gettext_quiet.patch b/05-gettext_quiet.patch new file mode 100644 index 000000000000..162b01afd439 --- /dev/null +++ b/05-gettext_quiet.patch @@ -0,0 +1,30 @@ +From 56c88e431207238935aee7d7245a458ddb21e3d2 Mon Sep 17 00:00:00 2001 +From: Colin Watson <cjwatson@ubuntu.com> +Date: Mon, 13 Jan 2014 12:13:02 +0000 +Subject: Silence error messages when translations are unavailable + +Bug: https://savannah.gnu.org/bugs/?35880 +Forwarded: https://savannah.gnu.org/bugs/?35880 +Last-Update: 2013-11-14 + +Patch-Name: gettext_quiet.patch +--- + grub-core/gettext/gettext.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c +index 4880cefe3..3098e8918 100644 +--- a/grub-core/gettext/gettext.c ++++ b/grub-core/gettext/gettext.c +@@ -427,6 +427,11 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx, + if (locale[0] == 'e' && locale[1] == 'n' + && (locale[2] == '\0' || locale[2] == '_')) + grub_errno = err = GRUB_ERR_NONE; ++ ++ /* If no translations are available, fall back to untranslated text. */ ++ if (err == GRUB_ERR_FILE_NOT_FOUND) ++ grub_errno = err = GRUB_ERR_NONE; ++ + return err; + } + diff --git a/06-sleep_shift.patch b/06-sleep_shift.patch new file mode 100644 index 000000000000..973cb8702207 --- /dev/null +++ b/06-sleep_shift.patch @@ -0,0 +1,95 @@ +From 6d92ce5e4248eec87c831734bff72581721a1026 Mon Sep 17 00:00:00 2001 +From: Colin Watson <cjwatson@ubuntu.com> +Date: Mon, 13 Jan 2014 12:13:23 +0000 +Subject: Allow Shift to interrupt 'sleep --interruptible' + +Upstream would like to consider this at more length. See +http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00718.html, and +the rest of the thread for context. + +Forwarded: http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00694.html +Last-Update: 2013-12-04 + +Patch-Name: sleep_shift.patch +--- + grub-core/commands/sleep.c | 27 ++++++++++++++++++++++++++- + grub-core/normal/menu.c | 19 +++++++++++++++++++ + 2 files changed, 45 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/sleep.c b/grub-core/commands/sleep.c +index e77e7900f..3906b1410 100644 +--- a/grub-core/commands/sleep.c ++++ b/grub-core/commands/sleep.c +@@ -46,6 +46,31 @@ do_print (int n) + grub_refresh (); + } + ++static int ++grub_check_keyboard (void) ++{ ++ int mods = 0; ++ grub_term_input_t term; ++ ++ if (grub_term_poll_usb) ++ grub_term_poll_usb (0); ++ ++ FOR_ACTIVE_TERM_INPUTS(term) ++ { ++ if (term->getkeystatus) ++ mods |= term->getkeystatus (term); ++ } ++ ++ if (mods >= 0 && ++ (mods & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) != 0) ++ return 1; ++ ++ if (grub_getkey_noblock () == GRUB_TERM_ESC) ++ return 1; ++ ++ return 0; ++} ++ + /* Based on grub_millisleep() from kern/generic/millisleep.c. */ + static int + grub_interruptible_millisleep (grub_uint32_t ms) +@@ -55,7 +80,7 @@ grub_interruptible_millisleep (grub_uint32_t ms) + start = grub_get_time_ms (); + + while (grub_get_time_ms () - start < ms) +- if (grub_getkey_noblock () == GRUB_TERM_ESC) ++ if (grub_check_keyboard ()) + return 1; + + return 0; +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index 719e2fb1c..9d0ad4c95 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -615,8 +615,27 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) + saved_time = grub_get_time_ms (); + while (1) + { ++ int mods = 0; ++ grub_term_input_t term; + int key; + ++ if (grub_term_poll_usb) ++ grub_term_poll_usb (0); ++ ++ FOR_ACTIVE_TERM_INPUTS(term) ++ { ++ if (term->getkeystatus) ++ mods |= term->getkeystatus (term); ++ } ++ ++ if (mods >= 0 && ++ (mods & (GRUB_TERM_STATUS_LSHIFT ++ | GRUB_TERM_STATUS_RSHIFT)) != 0) ++ { ++ timeout = -1; ++ break; ++ } ++ + key = grub_getkey_noblock (); + if (key != GRUB_TERM_NO_KEY) + { diff --git a/07-maybe_quiet.patch b/07-maybe_quiet.patch new file mode 100644 index 000000000000..59bd82237f93 --- /dev/null +++ b/07-maybe_quiet.patch @@ -0,0 +1,370 @@ +From ec5b5793aa6befcc44bb8328a26ff34e24979b59 Mon Sep 17 00:00:00 2001 +From: Colin Watson <cjwatson@ubuntu.com> +Date: Mon, 13 Jan 2014 12:13:26 +0000 +Subject: Add configure option to reduce visual clutter at boot time + +If this option is enabled, then do all of the following: + +Don't display introductory message about line editing unless we're +actually offering a shell prompt. (This is believed to be a workaround +for a different bug. We'll go with this for now, but will drop this in +favour of a better fix upstream if somebody figures out what that is.) + +Don't clear the screen just before booting if we never drew the menu in +the first place. + +Remove verbose messages printed before reading configuration. In some +ways this is awkward because it makes debugging harder, but it's a +requirement for a smooth-looking boot process; we may be able to do +better in future. Upstream doesn't want this, though. + +Disable the cursor as well, for similar reasons of tidiness. + +Suppress kernel/initrd progress messages, except in recovery mode. + +Suppress "GRUB loading" message unless Shift is held down. Upstream +doesn't want this, as it makes debugging harder. Ubuntu wants it to +provide a cleaner boot experience. + +Bug-Ubuntu: https://bugs.launchpad.net/bugs/386922 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/861048 +Forwarded: (partial) http://lists.gnu.org/archive/html/grub-devel/2009-09/msg00056.html +Last-Update: 2014-01-03 + +Patch-Name: maybe_quiet.patch +--- + config.h.in | 2 ++ + configure.ac | 16 ++++++++++++++++ + grub-core/boot/i386/pc/boot.S | 11 +++++++++++ + grub-core/boot/i386/pc/diskboot.S | 26 ++++++++++++++++++++++++++ + grub-core/kern/main.c | 17 +++++++++++++++++ + grub-core/kern/rescue_reader.c | 2 ++ + grub-core/normal/main.c | 11 +++++++++++ + grub-core/normal/menu.c | 17 +++++++++++++++-- + util/grub.d/10_linux.in | 15 +++++++++++---- + 9 files changed, 111 insertions(+), 6 deletions(-) + +diff --git a/config.h.in b/config.h.in +index 9e8f991..d2c4ce8 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -12,6 +12,8 @@ + /* Define to 1 to enable disk cache statistics. */ + #define DISK_CACHE_STATS @DISK_CACHE_STATS@ + #define BOOT_TIME_STATS @BOOT_TIME_STATS@ ++/* Define to 1 to make GRUB quieter at boot time. */ ++#define QUIET_BOOT @QUIET_BOOT@ + + /* We don't need those. */ + #define MINILZO_CFG_SKIP_LZO_PTR 1 +diff --git a/configure.ac b/configure.ac +--- a/configure.ac ++++ b/configure.ac +@@ -1797,6 +1797,17 @@ else + fi + AC_SUBST([UBUNTU_RECOVERY]) + ++AC_ARG_ENABLE([quiet-boot], ++ [AS_HELP_STRING([--enable-quiet-boot], ++ [emit fewer messages at boot time (default=no)])], ++ [], [enable_quiet_boot=no]) ++if test x"$enable_quiet_boot" = xyes ; then ++ QUIET_BOOT=1 ++else ++ QUIET_BOOT=0 ++fi ++AC_SUBST([QUIET_BOOT]) ++ + LIBS="" + + AC_SUBST([FONT_SOURCE]) +@@ -2048,5 +2059,10 @@ echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excus + else + echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)" + fi ++if [ x"$enable_quiet_boot" = xyes ]; then ++echo With quiet boot: Yes ++else ++echo With quiet boot: No ++fi + echo "*******************************************************" + ] +diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S +--- a/grub-core/boot/i386/pc/boot.S ++++ b/grub-core/boot/i386/pc/boot.S +@@ -19,6 +19,9 @@ + + #include <grub/symbol.h> + #include <grub/machine/boot.h> ++#if defined(QUIET_BOOT) && !defined(HYBRID_BOOT) ++#include <grub/machine/memory.h> ++#endif + + /* + * defines for the code go here +@@ -249,9 +252,17 @@ real_start: + /* save drive reference first thing! */ + pushw %dx + ++#if defined(QUIET_BOOT) && !defined(HYBRID_BOOT) ++ /* is either shift key held down? */ ++ movw $(GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR + 0x17), %bx ++ testb $3, (%bx) ++ jz 2f ++#endif ++ + /* print a notification message on the screen */ + MSG(notification_string) + ++2: + /* set %si to the disk address packet */ + movw $disk_address_packet, %si + +diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S +--- a/grub-core/boot/i386/pc/diskboot.S ++++ b/grub-core/boot/i386/pc/diskboot.S +@@ -18,6 +18,9 @@ + + #include <grub/symbol.h> + #include <grub/machine/boot.h> ++#ifdef QUIET_BOOT ++#include <grub/machine/memory.h> ++#endif + + /* + * defines for the code go here +@@ -25,6 +28,12 @@ + + #define MSG(x) movw $x, %si; call LOCAL(message) + ++#ifdef QUIET_BOOT ++#define SILENT(x) call LOCAL(check_silent); jz LOCAL(x) ++#else ++#define SILENT(x) ++#endif ++ + .file "diskboot.S" + + .text +@@ -50,11 +59,14 @@ _start: + /* save drive reference first thing! */ + pushw %dx + ++ SILENT(after_notification_string) ++ + /* print a notification message on the screen */ + pushw %si + MSG(notification_string) + popw %si + ++LOCAL(after_notification_string): + /* this sets up for the first run through "bootloop" */ + movw $LOCAL(firstlist), %di + +@@ -279,7 +291,10 @@ LOCAL(copy_buffer): + /* restore addressing regs and print a dot with correct DS + (MSG modifies SI, which is saved, and unused AX and BX) */ + popw %ds ++ SILENT(after_notification_step) + MSG(notification_step) ++ ++LOCAL(after_notification_step): + popa + + /* check if finished with this dataset */ +@@ -295,8 +310,11 @@ LOCAL(copy_buffer): + /* END OF MAIN LOOP */ + + LOCAL(bootit): ++ SILENT(after_notification_done) + /* print a newline */ + MSG(notification_done) ++ ++LOCAL(after_notification_done): + popw %dx /* this makes sure %dl is our "boot" drive */ + ljmp $0, $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) + +@@ -320,6 +338,14 @@ LOCAL(general_error): + /* go here when you need to stop the machine hard after an error condition */ + LOCAL(stop): jmp LOCAL(stop) + ++#ifdef QUIET_BOOT ++LOCAL(check_silent): ++ /* is either shift key held down? */ ++ movw $(GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR + 0x17), %bx ++ testb $3, (%bx) ++ ret ++#endif ++ + notification_string: .asciz "loading" + + notification_step: .asciz "." +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -264,15 +264,25 @@ reclaim_module_space (void) + void __attribute__ ((noreturn)) + grub_main (void) + { ++#ifdef QUIET_BOOT ++ struct grub_term_output *term; ++#endif ++ + /* First of all, initialize the machine. */ + grub_machine_init (); + + grub_boot_time ("After machine init."); + ++#ifdef QUIET_BOOT ++ /* Disable the cursor until we need it. */ ++ FOR_ACTIVE_TERM_OUTPUTS(term) ++ grub_term_setcursor (term, 0); ++#else + /* Hello. */ + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("Welcome to GRUB!\n\n"); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); ++#endif + + grub_load_config (); + +@@ -308,5 +318,12 @@ grub_main (void) + grub_boot_time ("After execution of embedded config. Attempt to go to normal mode"); + + grub_load_normal_mode (); ++ ++#ifdef QUIET_BOOT ++ /* If we have to enter rescue mode, enable the cursor again. */ ++ FOR_ACTIVE_TERM_OUTPUTS(term) ++ grub_term_setcursor (term, 1); ++#endif ++ + grub_rescue_run (); + } +diff --git a/grub-core/kern/rescue_reader.c b/grub-core/kern/rescue_reader.c +--- a/grub-core/kern/rescue_reader.c ++++ b/grub-core/kern/rescue_reader.c +@@ -78,7 +78,9 @@ grub_rescue_read_line (char **line, int cont, + void __attribute__ ((noreturn)) + grub_rescue_run (void) + { ++#ifdef QUIET_BOOT + grub_printf ("Entering rescue mode...\n"); ++#endif + + while (1) + { +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -389,6 +389,15 @@ static grub_err_t + grub_normal_read_line_real (char **line, int cont, int nested) + { + const char *prompt; ++#ifdef QUIET_BOOT ++ static int displayed_intro; ++ ++ if (! displayed_intro) ++ { ++ grub_normal_reader_init (nested); ++ displayed_intro = 1; ++ } ++#endif + + if (cont) + /* TRANSLATORS: it's command line prompt. */ +@@ -441,7 +450,9 @@ grub_cmdline_run (int nested, int force_auth) + return; + } + ++#ifndef QUIET_BOOT + grub_normal_reader_init (nested); ++#endif + + while (1) + { +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -826,12 +826,18 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) + + /* Callback invoked immediately before a menu entry is executed. */ + static void +-notify_booting (grub_menu_entry_t entry, ++notify_booting (grub_menu_entry_t entry ++#ifdef QUIET_BOOT ++ __attribute__((unused)) ++#endif ++ , + void *userdata __attribute__((unused))) + { ++#ifndef QUIET_BOOT + grub_printf (" "); + grub_printf_ (N_("Booting `%s'"), entry->title); + grub_printf ("\n\n"); ++#endif + } + + /* Callback invoked when a default menu entry executed because of a timeout +@@ -879,6 +885,9 @@ show_menu (grub_menu_t menu, int nested, int autobooted) + int boot_entry; + grub_menu_entry_t e; + int auto_boot; ++#ifdef QUIET_BOOT ++ int initial_timeout = grub_menu_get_timeout (); ++#endif + + boot_entry = run_menu (menu, nested, &auto_boot); + if (boot_entry < 0) +@@ -888,7 +897,11 @@ show_menu (grub_menu_t menu, int nested, int autobooted) + if (! e) + continue; /* Menu is empty. */ + +- grub_cls (); ++#ifdef QUIET_BOOT ++ /* Only clear the screen if we drew the menu in the first place. */ ++ if (initial_timeout != 0) ++#endif ++ grub_cls (); + + if (auto_boot) + grub_menu_execute_with_fallback (menu, e, autobooted, +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -21,5 +21,6 @@ prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" ++quiet_boot="@QUIET_BOOT@" + + . "$pkgdatadir/grub-mkconfig_lib" + +@@ -148,9 +149,13 @@ linux_entry () + fi + printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" + fi +- message="$(gettext_printf "Loading Linux %s ..." ${version})" +- sed "s/^/$submenu_indentation/" << EOF ++ if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then ++ message="$(gettext_printf "Loading Linux %s ..." ${version})" ++ sed "s/^/$submenu_indentation/" << EOF + echo '$(echo "$message" | grub_quote)' ++EOF ++ fi ++ sed "s/^/$submenu_indentation/" << EOF + linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} rw ${args} + EOF + if test -n "${initrd}" -o -n "${initrd_extra}" ; then +@@ -163,8 +168,10 @@ EOF + EOF + if test -n "${initrd}" -o -n "${initrd_extra}" ; then + # TRANSLATORS: ramdisk isn't identifier. Should be translated. +- message="$(gettext_printf "Loading initial ramdisk ...")" +- printf ' %s\n' "echo '$(echo "$message" | grub_quote)'" | sed "s/^/$submenu_indentation/" ++ if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then ++ message="$(gettext_printf "Loading initial ramdisk ...")" ++ printf ' %s\n' "echo '$(echo "$message" | grub_quote)'" | sed "s/^/$submenu_indentation/" ++ fi + printf ' %s ' 'initrd' | sed "s/^/$submenu_indentation/" + for i in ${initrd_extra} ${initrd}; do + printf ' %s/%s' "${rel_dirname}" "${i}" diff --git a/08-quick_boot.patch b/08-quick_boot.patch new file mode 100644 index 000000000000..075f9ea9bcde --- /dev/null +++ b/08-quick_boot.patch @@ -0,0 +1,358 @@ +From db2c839f0201d67aace730049d6704006beccf4c Mon Sep 17 00:00:00 2001 +From: Colin Watson <cjwatson@ubuntu.com> +Date: Mon, 13 Jan 2014 12:13:28 +0000 +Subject: Add configure option to bypass boot menu if possible + +If other operating systems are installed, then automatically unhide the +menu. Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus if +available to check whether Shift is pressed. If it is, show the menu, +otherwise boot immediately. If keystatus is not available, then fall +back to a short delay interruptible with Escape. + +This may or may not remain Ubuntu-specific, although it's not obviously +wanted upstream. It implements a requirement of +https://wiki.ubuntu.com/DesktopExperienceTeam/KarmicBootExperienceDesignSpec#Bootloader. + +If the previous boot failed (defined as failing to get to the end of one +of the normal runlevels), then show the boot menu regardless. + +Author: Richard Laager <rlaager@wiktel.com> +Author: Robie Basak <robie.basak@ubuntu.com> +Forwarded: no +Last-Update: 2015-09-04 + +Patch-Name: quick_boot.patch +--- + configure.ac | 11 +++++++ + docs/grub.texi | 14 +++++++++ + grub-core/normal/menu.c | 24 ++++++++++++++ + util/grub-mkconfig.in | 3 +- + util/grub.d/00_header.in | 77 ++++++++++++++++++++++++++++++++++++++------- + util/grub.d/10_linux.in | 4 +++ + util/grub.d/30_os-prober.in | 21 +++++++++++++ + 7 files changed, 141 insertions(+), 13 deletions(-) + +diff --git a/configure.ac b/configure.ac +index dd2fbd01c..e508f9c43 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1841,6 +1841,17 @@ else + fi + AC_SUBST([QUIET_BOOT]) + ++AC_ARG_ENABLE([quick-boot], ++ [AS_HELP_STRING([--enable-quick-boot], ++ [bypass boot menu if possible (default=no)])], ++ [], [enable_quick_boot=no]) ++if test x"$enable_quick_boot" = xyes ; then ++ QUICK_BOOT=1 ++else ++ QUICK_BOOT=0 ++fi ++AC_SUBST([QUICK_BOOT]) ++ + LIBS="" + + AC_SUBST([FONT_SOURCE]) +diff --git a/docs/grub.texi b/docs/grub.texi +index e935af33e..5b2a7bbb2 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -1490,6 +1490,20 @@ This option may be set to a list of GRUB module names separated by spaces. + Each module will be loaded as early as possible, at the start of + @file{grub.cfg}. + ++@item GRUB_RECORDFAIL_TIMEOUT ++If this option is set, it overrides the default recordfail setting. A ++setting of -1 causes GRUB to wait for user input indefinitely. However, a ++false positive in the recordfail mechanism may occur if power is lost during ++boot before boot success is recorded in userspace. The default setting is ++30, which causes GRUB to wait for user input for thirty seconds before ++continuing. This default allows interactive users the opportunity to switch ++to a different, working kernel, while avoiding a false positive causing the ++boot to block indefinitely on headless and appliance systems where access to ++a console is restricted or limited. ++ ++This option is only effective when GRUB was configured with the ++@option{--enable-quick-boot} option. ++ + @end table + + The following options are still accepted for compatibility with existing +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index 1f3447ad3..906a480a2 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -604,6 +604,30 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) + static struct grub_term_coordinate *pos; + int entry = -1; + ++ if (timeout == 0) ++ { ++ /* If modifier key statuses can't be detected without a delay, ++ then a hidden timeout of zero cannot be interrupted in any way, ++ which is not very helpful. Bump it to three seconds in this ++ case to give the user a fighting chance. */ ++ grub_term_input_t term; ++ int nterms = 0; ++ int mods_detectable = 1; ++ ++ FOR_ACTIVE_TERM_INPUTS(term) ++ { ++ if (!term->getkeystatus) ++ { ++ mods_detectable = 0; ++ break; ++ } ++ else ++ nterms++; ++ } ++ if (!mods_detectable || !nterms) ++ timeout = 3; ++ } ++ + if (timeout_style == TIMEOUT_STYLE_COUNTDOWN && timeout) + { + pos = grub_term_save_pos (); +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index b4f0011b5..fac560464 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -239,7 +239,8 @@ export GRUB_DEFAULT \ + GRUB_ENABLE_CRYPTODISK \ + GRUB_BADRAM \ + GRUB_OS_PROBER_SKIP_LIST \ +- GRUB_DISABLE_SUBMENU ++ GRUB_DISABLE_SUBMENU \ ++ GRUB_RECORDFAIL_TIMEOUT + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index 93a90233e..674a76140 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -21,6 +21,8 @@ prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" + grub_lang=`echo $LANG | cut -d . -f 1` ++grubdir="`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`" ++quick_boot="@QUICK_BOOT@" + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" +@@ -44,6 +46,7 @@ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT + + cat << EOF + if [ -s \$prefix/grubenv ]; then ++ set have_grubenv=true + load_env + fi + EOF +@@ -96,7 +99,50 @@ function savedefault { + save_env saved_entry + fi + } ++EOF ++ ++if [ "$quick_boot" = 1 ]; then ++ cat <<EOF ++function recordfail { ++ set recordfail=1 ++EOF ++ ++ check_writable () { ++ abstractions="$(grub-probe --target=abstraction "${grubdir}")" ++ for abstraction in $abstractions; do ++ case "$abstraction" in ++ diskfilter | lvm) ++ cat <<EOF ++ # GRUB lacks write support for $abstraction, so recordfail support is disabled. ++EOF ++ return ++ ;; ++ esac ++ done ++ ++ FS="$(grub-probe --target=fs "${grubdir}")" ++ case "$FS" in ++ btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs | zfs) ++ cat <<EOF ++ # GRUB lacks write support for $FS, so recordfail support is disabled. ++EOF ++ return ++ ;; ++ esac ++ ++ cat <<EOF ++ if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi ++EOF ++ } ++ ++ check_writable + ++ cat <<EOF ++} ++EOF ++fi ++ ++cat <<EOF + function load_video { + EOF + if [ -n "${GRUB_VIDEO_BACKEND}" ]; then +@@ -282,10 +328,16 @@ fi + + make_timeout () + { ++ cat << EOF ++if [ "\${recordfail}" = 1 ] ; then ++ set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30} ++else ++EOF + if [ "x${3}" != "x" ] ; then + timeout="${2}" + style="${3}" +- elif [ "x${1}" != "x" ] && [ "x${1}" != "x0" ] ; then ++ elif [ "x${1}" != "x" ] && \ ++ ([ "$quick_boot" = 1 ] || [ "x${1}" != "x0" ]) ; then + # Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme. + timeout="${1}" + if [ "x${2}" != "x0" ] ; then +@@ -304,26 +356,27 @@ make_timeout () + style="menu" + fi + cat << EOF +-if [ x\$feature_timeout_style = xy ] ; then +- set timeout_style=${style} +- set timeout=${timeout} ++ if [ x\$feature_timeout_style = xy ] ; then ++ set timeout_style=${style} ++ set timeout=${timeout} + EOF + if [ "x${style}" = "xmenu" ] ; then + cat << EOF +-# Fallback normal timeout code in case the timeout_style feature is +-# unavailable. +-else +- set timeout=${timeout} ++ # Fallback normal timeout code in case the timeout_style feature is ++ # unavailable. ++ else ++ set timeout=${timeout} + EOF + else + cat << EOF +-# Fallback hidden-timeout code in case the timeout_style feature is +-# unavailable. +-elif sleep${verbose} --interruptible ${timeout} ; then +- set timeout=0 ++ # Fallback hidden-timeout code in case the timeout_style feature is ++ # unavailable. ++ elif sleep${verbose} --interruptible ${timeout} ; then ++ set timeout=0 + EOF + fi + cat << EOF ++ fi + fi + EOF + } +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 67d57ecfd..0f8a16837 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -22,6 +22,7 @@ exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" + ubuntu_recovery="@UBUNTU_RECOVERY@" + quiet_boot="@QUIET_BOOT@" ++quick_boot="@QUICK_BOOT@" + + . "$pkgdatadir/grub-mkconfig_lib" + +@@ -119,6 +120,9 @@ linux_entry () + else + echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" + fi ++ if [ "$quick_boot" = 1 ]; then ++ echo " recordfail" | sed "s/^/$submenu_indentation/" ++ fi + if [ x$type != xrecovery ] ; then + save_default_entry | grub_add_tab + fi +diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in +index 271044f59..da5f28876 100644 +--- a/util/grub.d/30_os-prober.in ++++ b/util/grub.d/30_os-prober.in +@@ -20,12 +20,26 @@ set -e + prefix="@prefix@" + exec_prefix="@exec_prefix@" + datarootdir="@datarootdir@" ++quick_boot="@QUICK_BOOT@" + + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + + . "$pkgdatadir/grub-mkconfig_lib" + ++found_other_os= ++ ++adjust_timeout () { ++ if [ "$quick_boot" = 1 ] && [ "x${found_other_os}" != "x" ]; then ++ cat << EOF ++set timeout_style=menu ++if [ "\${timeout}" = 0 ]; then ++ set timeout=10 ++fi ++EOF ++ fi ++} ++ + if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then + exit 0 + fi +@@ -42,6 +56,7 @@ if [ -z "${OSPROBED}" ] ; then + fi + + osx_entry() { ++ found_other_os=1 + if [ x$2 = x32 ]; then + # TRANSLATORS: it refers to kernel architecture (32-bit) + bitstr="$(gettext "(32-bit)")" +@@ -165,6 +180,7 @@ for OS in ${OSPROBED} ; do + ;; + esac + ++ found_other_os=1 + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" + cat << EOF + menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' { +@@ -195,6 +211,7 @@ EOF + ;; + efi) + ++ found_other_os=1 + EFIPATH=${DEVICE#*@} + DEVICE=${DEVICE%@*} + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" +@@ -243,6 +260,7 @@ EOF + [ "${prepare_boot_cache}" ] || continue + fi + ++ found_other_os=1 + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" + recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true + counter=1 +@@ -311,6 +329,7 @@ EOF + fi + ;; + hurd) ++ found_other_os=1 + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" + cat << EOF + menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' { +@@ -353,3 +372,5 @@ EOF + ;; + esac + done ++ ++adjust_timeout diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..881da88c33ff --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,377 @@ +# Maintainer : Özgür Sarıer <echo b3pndXJzYXJpZXIxMDExNjAxMTE1QGdtYWlsLmNvbQo= | base64 -d> +# Derived from official Arch Lnux grub package +# Maintainer : Christian Hesse <mail@eworm.de> +# Maintainer : Ronald van Haren <ronald.archlinux.org> +# Contributor: Tobias Powalowski <tpowa@archlinux.org> +# Contributor: Keshav Amburay <(the ddoott ridikulus ddoott rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)> + +## "1" to enable IA32-EFI build in Arch x86_64, "0" to disable +_IA32_EFI_IN_ARCH_X64="1" + +## "1" to enable EMU build, "0" to disable +_GRUB_EMU_BUILD="0" + +_GRUB_EXTRAS_COMMIT="f2a079441939eee7251bf141986cdd78946e1d20" + +_UNIFONT_VER="10.0.06" + +[[ "${CARCH}" == "x86_64" ]] && _EFI_ARCH="x86_64" +[[ "${CARCH}" == "i686" ]] && _EFI_ARCH="i386" + +[[ "${CARCH}" == "x86_64" ]] && _EMU_ARCH="x86_64" +[[ "${CARCH}" == "i686" ]] && _EMU_ARCH="i386" + +pkgname="grub-silent" +pkgdesc="GNU GRand Unified Bootloader (2) [without welcome and kernel messages]" +pkgver=2.02 +pkgrel=1 +url="https://www.gnu.org/software/grub/" +arch=('x86_64' 'i686') +license=('GPL3') +backup=('etc/grub.d/40_custom') +install="${pkgname%-*}.install" +options=('!makeflags') + +conflicts=('grub' 'grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-legacy' 'grub-git') +replaces=('grub' 'grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}") +provides=('grub' 'grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}") + +makedepends=('git' 'rsync' 'xz' 'freetype2' 'ttf-dejavu' 'python' 'autogen' + 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse2') +depends=('sh' 'xz' 'gettext' 'device-mapper') +optdepends=('freetype2: For grub-mkfont usage' + 'fuse2: For grub-mount usage' + 'dosfstools: For grub-mkrescue FAT FS and EFI support' + 'efibootmgr: For grub-install EFI support' + 'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue' + 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems' + 'mtools: For grub-mkrescue FAT FS support') + +if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then + makedepends+=('libusbx' 'sdl') + optdepends+=('libusbx: For grub-emu USB support' + 'sdl: For grub-emu SDL support') +fi + +source=("https://ftp.gnu.org/gnu/${pkgname%-*}/${pkgname%-*}-${pkgver}.tar.xz" + "https://git.savannah.nongnu.org/cgit/grub-extras.git/snapshot/grub-extras-${_GRUB_EXTRAS_COMMIT}.tar.gz" + "https://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz" + '01-intel-ucode.patch' + '02-10_linux-detect-archlinux-initramfs.patch' + '03-add-GRUB_COLOR_variables.patch' + '04-ext4_feature_encrypt.patch' + '05-gettext_quiet.patch' + '06-sleep_shift.patch' + '07-maybe_quiet.patch' + '08-quick_boot.patch' + 'grub.silent') + +sha256sums=('810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f' + '2844601914cea6b1231eca0104853a93c4d67a5209933a0766f1475953300646' + '0d81571fc519573057b7641d26a31ead55cc0b02a931589fb346a3a534c3dcc1' + '37adb95049f6cdcbdbf60ed6b6440c5be99a4cd307a0f96c3c3837b6c2e07f3c' + 'b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3' + 'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29' + '82b9e3fc8547c496cd28f39e75d8224d83c40481df3bfa33ae8169f7c7861362' + '39d7843dfe1e10ead912a81be370813b8621794a7967b3cc5e4d4188b5bf7264' + '4b189e00a8c97ec09903e9588e02fc78b4bb114ee4822fcce13811aca00c8884' + 'b7489c7facc4fb3dad4426c9c00079b64908640a2bec2409e22194daa3f72af4' + '057f076ddca241d92a094bc05828e3eb18d3439bf4d2f3d8ca8fa1c51b5b1b2b' + '96f3826225ee0e7a874406b73f4bb417fc1b16e5d63dd5eabde356c51833898e') + +prepare() { + cd "${srcdir}/grub-${pkgver}/" + + msg "Patch to load Intel microcode" + patch -Np1 -i "${srcdir}/01-intel-ucode.patch" + echo + + msg "Patch to detect of Arch Linux initramfs images by grub-mkconfig" + patch -Np1 -i "${srcdir}/02-10_linux-detect-archlinux-initramfs.patch" + echo + + msg "Patch to enable GRUB_COLOR_* variables in grub-mkconfig" + ## Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html + patch -Np1 -i "${srcdir}/03-add-GRUB_COLOR_variables.patch" + echo + + msg "Patch to allow GRUB to mount ext2/3/4 filesystems that have the encryption feature" + patch -Np1 -i "${srcdir}/04-ext4_feature_encrypt.patch" + echo + + msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme" + sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac" + + msg "Fix mkinitcpio 'rw' FS#36275" + sed 's| ro | rw |g' -i "util/grub.d/10_linux.in" + + msg "Fix OS naming FS#33393" + sed 's|GNU/Linux|Linux|' -i "util/grub.d/10_linux.in" + + msg "Appling Ubuntu patches for making GRUB silent" + patch -Np1 -i "${srcdir}/05-gettext_quiet.patch" + patch -Np1 -i "${srcdir}/06-sleep_shift.patch" + patch -Np1 -i "${srcdir}/07-maybe_quiet.patch" + patch -Np1 -i "${srcdir}/08-quick_boot.patch" + echo + + msg "Pull in latest language files" + ./linguas.sh + echo + + msg "Remove not working langs which need LC_ALL=C.UTF-8" + sed -e 's#en@cyrillic en@greek##g' -i "po/LINGUAS" + + msg "Avoid problem with unifont during compile of grub" + # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847 + cp "${srcdir}/unifont-${_UNIFONT_VER}.bdf" "unifont.bdf" +} + +_build_grub-common_and_bios() { + msg "Set ARCH dependent variables for bios build" + if [[ "${CARCH}" == 'x86_64' ]]; then + _EFIEMU="--enable-efiemu" + else + _EFIEMU="--disable-efiemu" + fi + + msg "Copy the source for building the bios part" + cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub-${pkgver}-bios" + cd "${srcdir}/grub-${pkgver}-bios/" + + msg "Add the grub-extra sources for bios build" + install -d "${srcdir}/grub-${pkgver}-bios/grub-extras" + cp -r "${srcdir}/grub-extras-${_GRUB_EXTRAS_COMMIT}/915resolution" \ + "${srcdir}/grub-${pkgver}-bios/grub-extras/915resolution" + export GRUB_CONTRIB="${srcdir}/grub-${pkgver}-bios/grub-extras/" + + msg "Unset all compiler FLAGS for bios build" + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + msg "Run autogen.sh for bios build" + ./autogen.sh + echo + + msg "Run ./configure for bios build" + ./configure \ + --with-platform="pc" \ + --target="i386" \ + "${_EFIEMU}" \ + --enable-mm-debug \ + --enable-nls \ + --enable-device-mapper \ + --enable-cache-stats \ + --enable-boot-time \ + --enable-grub-mkfont \ + --enable-grub-mount \ + --prefix="/usr" \ + --bindir="/usr/bin" \ + --sbindir="/usr/bin" \ + --mandir="/usr/share/man" \ + --infodir="/usr/share/info" \ + --datarootdir="/usr/share" \ + --sysconfdir="/etc" \ + --program-prefix="" \ + --with-bootdir="/boot" \ + --with-grubdir="grub" \ + --enable-quiet-boot \ + --enable-quick-boot \ + --disable-silent-rules \ + --disable-werror + echo + + msg "Run make for bios build" + make + echo +} + +_build_grub-efi() { + msg "Copy the source for building the ${_EFI_ARCH} efi part" + cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub-${pkgver}-efi-${_EFI_ARCH}" + cd "${srcdir}/grub-${pkgver}-efi-${_EFI_ARCH}/" + + msg "Unset all compiler FLAGS for ${_EFI_ARCH} efi build" + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + msg "Run autogen.sh for ${_EFI_ARCH} efi build" + ./autogen.sh + echo + + msg "Run ./configure for ${_EFI_ARCH} efi build" + ./configure \ + --with-platform="efi" \ + --target="${_EFI_ARCH}" \ + --disable-efiemu \ + --enable-mm-debug \ + --enable-nls \ + --enable-device-mapper \ + --enable-cache-stats \ + --enable-boot-time \ + --enable-grub-mkfont \ + --enable-grub-mount \ + --prefix="/usr" \ + --bindir="/usr/bin" \ + --sbindir="/usr/bin" \ + --mandir="/usr/share/man" \ + --infodir="/usr/share/info" \ + --datarootdir="/usr/share" \ + --sysconfdir="/etc" \ + --program-prefix="" \ + --with-bootdir="/boot" \ + --with-grubdir="grub" \ + --enable-quiet-boot \ + --enable-quick-boot \ + --disable-silent-rules \ + --disable-werror + echo + + msg "Run make for ${_EFI_ARCH} efi build" + make + echo +} + +_build_grub-emu() { + msg "Copy the source for building the emu part" + cp -r "${srcdir}/grub-${pkgver}/" "${srcdir}/grub-${pkgver}-emu/" + cd "${srcdir}/grub-${pkgver}-emu/" + + msg "Unset all compiler FLAGS for emu build" + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset MAKEFLAGS + + msg "Run autogen.sh for emu build" + ./autogen.sh + echo + + msg "Run ./configure for emu build" + ./configure \ + --with-platform="emu" \ + --target="${_EMU_ARCH}" \ + --enable-mm-debug \ + --enable-nls \ + --enable-device-mapper \ + --enable-cache-stats \ + --enable-grub-mkfont \ + --enable-grub-mount \ + --enable-grub-emu-usb=no \ + --enable-grub-emu-sdl=no \ + --disable-grub-emu-pci \ + --prefix="/usr" \ + --bindir="/usr/bin" \ + --sbindir="/usr/bin" \ + --mandir="/usr/share/man" \ + --infodir="/usr/share/info" \ + --datarootdir="/usr/share" \ + --sysconfdir="/etc" \ + --program-prefix="" \ + --with-bootdir="/boot" \ + --with-grubdir="grub" \ + --enable-quiet-boot \ + --enable-quick-boot \ + --disable-silent-rules \ + --disable-werror + echo + + msg "Run make for emu build" + make + echo +} + +build() { + cd "${srcdir}/grub-${pkgver}/" + + msg "Build grub bios stuff" + _build_grub-common_and_bios + echo + + msg "Build grub ${_EFI_ARCH} efi stuff" + _build_grub-efi + echo + + if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then + msg "Build grub i386 efi stuff" + _EFI_ARCH="i386" _build_grub-efi + echo + fi + + if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then + msg "Build grub emu stuff" + _build_grub-emu + echo + fi +} + +_package_grub-common_and_bios() { + cd "${srcdir}/grub-${pkgver}-bios/" + + msg "Run make install for bios build" + make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install + echo + + msg "Remove gdb debugging related files for bios build" + rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.module || true + rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.image || true + rm -f "${pkgdir}/usr/lib/grub/i386-pc"/{kernel.exec,gdb_grub,gmodule.pl} || true + +# msg "Install a sample file for /etc/default/grub " + install -D -m0644 "${srcdir}/grub.silent" "${pkgdir}/etc/default/grub.silent" +} + +_package_grub-efi() { + cd "${srcdir}/grub-${pkgver}-efi-${_EFI_ARCH}/" + + msg "Run make install for ${_EFI_ARCH} efi build" + make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install + echo + + msg "Remove gdb debugging related files for ${_EFI_ARCH} efi build" + rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.module || true + rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.image || true + rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/{kernel.exec,gdb_grub,gmodule.pl} || true +} + +_package_grub-emu() { + cd "${srcdir}/grub-${pkgver}-emu/" + + msg "Run make install for emu build" + make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install + echo + + msg "Remove gdb debugging related files for emu build" + rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.module || true + rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.image || true + rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/{kernel.exec,gdb_grub,gmodule.pl} || true +} + +package() { + cd "${srcdir}/grub-${pkgver}/" + + msg "Package grub ${_EFI_ARCH} efi stuff" + _package_grub-efi + + if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then + msg "Package grub i386 efi stuff" + _EFI_ARCH="i386" _package_grub-efi + echo + fi + + if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then + msg "Package grub emu stuff" + _package_grub-emu + echo + fi + + msg "Package grub bios stuff" + _package_grub-common_and_bios +} diff --git a/grub.install b/grub.install new file mode 100644 index 000000000000..59dc2dd45006 --- /dev/null +++ b/grub.install @@ -0,0 +1,15 @@ +post_install() { + printf "\e[37;1m\e[44;1m%s\e[0m\n" "\ +- Please reinstall GRUB first: + # grub-install --target=i386-pc --boot-directory=/your/boot/partition /dev/sdx + +- Then; look at \"/etc/default/grub.silent\" sample file + and make necessary changes to \"/etc/default/grub\". + +- Lastly, regenerate the GRUB config file: + # grub-mkconfig -o /your/boot/partition/grub/grub.cfg" +} + +post_upgrade() { + post_install +} diff --git a/grub.silent b/grub.silent new file mode 100644 index 000000000000..b0b629208fb4 --- /dev/null +++ b/grub.silent @@ -0,0 +1,55 @@ +# GRUB boot loader configuration + +GRUB_DEFAULT=0 +GRUB_TIMEOUT=0 +GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT +GRUB_DISTRIBUTOR="Arch" +GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 vga=current rd.systemd.show_status=false rd.udev.log-priority=3" +GRUB_CMDLINE_LINUX="" + +# Preload both GPT and MBR modules so that they are not missed +GRUB_PRELOAD_MODULES="part_gpt part_msdos" + +# Uncomment to enable booting from LUKS encrypted devices +#GRUB_ENABLE_CRYPTODISK=y + +# Uncomment to enable Hidden Menu, and optionally hide the timeout count +#GRUB_HIDDEN_TIMEOUT=0 +#GRUB_HIDDEN_TIMEOUT_QUIET=true + +# Uncomment to use basic console +GRUB_TERMINAL_INPUT=console + +# Uncomment to disable graphical terminal +#GRUB_TERMINAL_OUTPUT=console + +# The resolution used on graphical terminal +# note that you can use only modes which your graphic card supports via VBE +# you can see them in real GRUB with the command `vbeinfo' +GRUB_GFXMODE=auto + +# Uncomment to allow the kernel use the same resolution used by grub +GRUB_GFXPAYLOAD_LINUX=keep + +# Uncomment if you want GRUB to pass to the Linux kernel the old parameter +# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx" +#GRUB_DISABLE_LINUX_UUID=true + +# Uncomment to disable generation of recovery mode menu entries +GRUB_DISABLE_RECOVERY=true + +# Uncomment and set to the desired menu colors. Used by normal and wallpaper +# modes only. Entries specified as foreground/background. +#GRUB_COLOR_NORMAL="light-blue/black" +#GRUB_COLOR_HIGHLIGHT="light-cyan/blue" + +# Uncomment one of them for the gfx desired, a image background or a gfxtheme +#GRUB_BACKGROUND="/path/to/wallpaper" +#GRUB_THEME="/path/to/gfxtheme" + +# Uncomment to get a beep at GRUB start +#GRUB_INIT_TUNE="480 440 1" + +# Uncomment to make GRUB remember the last selection. This requires to +# set 'GRUB_DEFAULT=saved' above. +#GRUB_SAVEDEFAULT="true" |