/* 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
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])
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 "*******************************************************"
]
#include <grub/symbol.h>
#include <grub/machine/boot.h>
+#if QUIET_BOOT && !defined(HYBRID_BOOT)
+#include <grub/machine/memory.h>
+#endif
/*
* defines for the code go here
/* save drive reference first thing! */
pushw %dx
+#if 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
#include <grub/symbol.h>
#include <grub/machine/boot.h>
+#if QUIET_BOOT
+#include <grub/machine/memory.h>
+#endif
/*
* defines for the code go here
#define MSG(x) movw $x, %si; call LOCAL(message)
+#if QUIET_BOOT
+#define SILENT(x) call LOCAL(check_silent); jz LOCAL(x)
+#else
+#define SILENT(x)
+#endif
+
.file "diskboot.S"
.text
/* 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
/* 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 */
/* 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)
/* go here when you need to stop the machine hard after an error condition */
LOCAL(stop): jmp LOCAL(stop)
+#if 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 "."
void __attribute__ ((noreturn))
grub_main (void)
{
+#if QUIET_BOOT
+ struct grub_term_output *term;
+#endif
+
/* First of all, initialize the machine. */
grub_machine_init ();
grub_boot_time ("After machine init.");
+#if 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 ();
grub_boot_time ("After execution of embedded config. Attempt to go to normal mode");
grub_load_normal_mode ();
+
+#if 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 ();
}
void __attribute__ ((noreturn))
grub_rescue_run (void)
{
+#if QUIET_BOOT
grub_printf ("Entering rescue mode...\n");
+#endif
while (1)
{
grub_normal_read_line_real (char **line, int cont, int nested)
{
const char *prompt;
+#if 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. */
return;
}
+#if !QUIET_BOOT
grub_normal_reader_init (nested);
+#endif
while (1)
{
/* 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
+#if QUIET_BOOT
+ __attribute__((unused))
+#endif
+ ,
void *userdata __attribute__((unused)))
{
+#if !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
int boot_entry;
grub_menu_entry_t e;
int auto_boot;
+#if QUIET_BOOT
+ int initial_timeout = grub_menu_get_timeout ();
+#endif
boot_entry = run_menu (menu, nested, &auto_boot);
if (boot_entry < 0)
if (! e)
continue; /* Menu is empty. */
- grub_cls ();
+#if 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,
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
ubuntu_recovery="@UBUNTU_RECOVERY@"
+quiet_boot="@QUIET_BOOT@"
. "$pkgdatadir/grub-mkconfig_lib"
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
if test -d /sys/firmware/efi && test -e "${linux}.efi.signed"; then
sed "s/^/$submenu_indentation/" << EOF
linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}
fi
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
- message="$(gettext_printf "Loading initial ramdisk ...")"
+ if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
+ message="$(gettext_printf "Loading initial ramdisk ...")"
+ sed "s/^/$submenu_indentation/" << EOF
+ echo '$(echo "$message" | grub_quote)'
+EOF
+ fi
initrd_path=
for i in ${initrd}; do
initrd_path="${initrd_path} ${rel_dirname}/${i}"
done
sed "s/^/$submenu_indentation/" << EOF
- echo '$(echo "$message" | grub_quote)'
initrd $(echo $initrd_path)
EOF
fi