Implemented as compile-time switch, enabling silent boot
suppresses informational messages by EFI Boot Guard so
that, e.g., EFI splash screens are not overwritten.
Warning and error messages will still be printed.

Signed-off-by: Christian Storm <christian.st...@siemens.com>
---
 configure.ac    | 10 ++++++++++
 include/utils.h |  4 ++++
 main.c          |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/configure.ac b/configure.ac
index b000603..bbd6ffb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -190,6 +190,15 @@ AC_ARG_ENABLE([bootloader],
     AS_HELP_STRING([--disable-bootloader], [Compile the bootloader disabled, 
only make the tools]),
        , [enable_bootloader="yes"])
 
+AC_ARG_ENABLE([silent-boot],
+    AS_HELP_STRING([--enable-silent-boot], [Do not output informational 
messages while booting]),
+       [silent_boot="yes"], [silent_boot="no"]
+)
+
+if test "x$silent_boot" != "xno"; then
+    AC_DEFINE([SILENT_BOOT], [] , [Silent Boot])
+fi
+
 dnl pkg-config
 PKG_PROG_PKG_CONFIG()
 if test "x$PKG_CONFIG" = "xno"; then
@@ -236,6 +245,7 @@ AC_MSG_RESULT([
        machine type:            $MACHINE_TYPE_NAME
 
        build efi bootloader:    ${enable_bootloader}
+       silent boot:             ${silent_boot}
        enable shell completion: ${enable_completion}
 
        prefix:                  ${prefix}
diff --git a/include/utils.h b/include/utils.h
index 084796e..bb9efda 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -54,5 +54,9 @@ VOID PrintC(const UINT8 color, const CHAR16 *fmt, ...);
                PrintC(EFI_LIGHTGRAY, fmt, ##__VA_ARGS__);                     \
        } while (0)
 
+#if !defined(SILENT_BOOT)
 #define INFO(fmt, ...)                                                         
\
        PrintC(EFI_LIGHTGRAY, fmt, ##__VA_ARGS__)
+#else
+#define INFO(fmt, ...) do { } while (0)
+#endif
diff --git a/main.c b/main.c
index 0ff121a..0776eb0 100644
--- a/main.c
+++ b/main.c
@@ -122,8 +122,10 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, 
EFI_SYSTEM_TABLE *system_table)
        this_image = image_handle;
        InitializeLib(this_image, system_table);
 
+       #if !defined(SILENT_BOOT)
        (VOID) ST->ConOut->ClearScreen(ST->ConOut);
        PrintC(EFI_CYAN, L"EFI Boot Guard %s\n", L"" EFIBOOTGUARD_VERSION);
+       #endif
 
        status = BS->OpenProtocol(this_image, &LoadedImageProtocol,
                                  (VOID **)&loaded_image, this_image, NULL,
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to efibootguard-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/90615A6D-4E2B-4120-B1D1-1ACD421DB689%40siemens.com.

Reply via email to