Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:hellcp:flickerfree-boot
grub2
grub2-maybe_quiet.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grub2-maybe_quiet.patch of Package grub2
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 index 7517fc4..d3ca0a1 100644 --- a/configure.ac +++ b/configure.ac @@ -1904,6 +1904,17 @@ fi AC_SUBST([LIBZFS]) AC_SUBST([LIBNVPAIR]) +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]) @@ -2166,5 +2177,10 @@ echo "With stack smashing protector: Yes" else echo "With stack smashing protector: No" 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 index 2bd0b2d..451c8be 100644 --- 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 index c1addc0..c6fd50b 100644 --- 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 @@ -267,15 +267,25 @@ 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 #ifndef GRUB_MACHINE_PCBIOS /* Init verifiers API. */ @@ -316,5 +326,12 @@ 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 index dcd7d44..03826cf 100644 --- 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 index c4ebe9e..f690a3f 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -407,6 +407,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. */ @@ -459,7 +468,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 index c2943c6..338f5a5 100644 --- 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 @@ -20,6 +20,7 @@ prefix="@prefix@" exec_prefix="@exec_prefix@" datarootdir="@datarootdir@" +quiet_boot="@QUIET_BOOT@" . "$pkgdatadir/grub-mkconfig_lib" @@ -177,13 +178,21 @@ fi message="$(gettext_printf "Loading Linux %s ..." ${version})" if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' + if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then + sed "s/^/$submenu_indentation/" << EOF + echo '$(echo "$message" | grub_quote)' +EOF + fi + sed "s/^/$submenu_indentation/" << EOF linuxefi ${rel_dirname}/${basename} ${root_device} ${args} EOF else - sed "s/^/$submenu_indentation/" << EOF + if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then + sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' +EOF + fi + sed "s/^/$submenu_indentation/" << EOF linux ${rel_dirname}/${basename} ${root_device} ${args} EOF fi @@ -195,8 +204,12 @@ initrd_path="${initrd_path} ${rel_dirname}/${i}" done if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then + if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then + sed "s/^/$submenu_indentation/" << EOF + echo '$(echo "$message" | grub_quote)' +EOF + fi sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' initrdefi $(echo $initrd_path) EOF else diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -20,6 +20,7 @@ prefix="@prefix@" exec_prefix="@exec_prefix@" datarootdir="@datarootdir@" +quiet_boot="@QUIET_BOOT@" grub_lang=`echo $LANG | cut -d . -f 1` export TEXTDOMAIN=@PACKAGE@ @@ -239,11 +240,15 @@ fi fi - cat << EOF + if [ x"$quiet_boot" = x0 ]; then + cat << EOF if [ "\${grub_platform}" = "efi" ]; then echo "Please press 't' to show the boot menu on this console" fi +EOF + fi + cat << EOF set gfxmode=${GRUB_GFXMODE} load_video insmod gfxterm
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor