Support a configuration option to insert a delay before
starting the image to give the operator a chance to capture
diagnostic messages.

Signed-off-by: Earl Chew <earl_c...@yahoo.com>
---
 configure.ac | 15 +++++++++++++++
 main.c       |  3 +++
 2 files changed, 18 insertions(+)

diff --git a/configure.ac b/configure.ac
index b000603..1738968 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,20 @@ AC_ARG_WITH([env-backend],
 
 AC_SUBST([env_api_file], [${ENV_API_FILE}])
 
+AC_ARG_WITH([boot-delay],
+           AS_HELP_STRING([--with-boot-delay=INT],
+                          [specify the additional boot delay in seconds, 
defaults to 3]),
+           [
+               ENV_BOOT_DELAY=${withval:-3}
+               AS_IF([test "${ENV_BOOT_DELAY}" -lt "0"],
+                     [
+                       AC_MSG_ERROR([Invalid boot delay.])
+                     ])
+           ],
+           [ ENV_BOOT_DELAY=0 ])
+
+AC_DEFINE_UNQUOTED([ENV_BOOT_DELAY], [${ENV_BOOT_DELAY}], [Additional boot 
delay])
+
 AC_ARG_WITH([num-config-parts],
            AS_HELP_STRING([--with-num-config-parts=INT],
                           [specify the number of used config partitions, 
defaults to 2]),
@@ -248,4 +262,5 @@ AC_MSG_RESULT([
        environment backend:     ${ENV_API_FILE}.c
        number of config parts:  ${ENV_NUM_CONFIG_PARTS}
        reserved for uservars:   ${ENV_MEM_USERVARS} bytes
+       boot delay:              ${ENV_BOOT_DELAY} seconds
 ])
diff --git a/main.c b/main.c
index 0ff121a..52d65c0 100644
--- a/main.c
+++ b/main.c
@@ -214,5 +214,8 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, 
EFI_SYSTEM_TABLE *system_table)
        INFO(L"Starting %s with watchdog set to %d seconds ...\n",
             bg_loader_params.payload_path, bg_loader_params.timeout);
 
+       for (UINTN delay = ENV_BOOT_DELAY; delay; --delay)
+               BS->Stall(1000 * 1000);
+
        return BS->StartImage(payload_handle, NULL, NULL);
 }
-- 
2.39.1

-- 
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/20240208162302.1502896-1-earl_chew%40yahoo.com.

Reply via email to