From: Dmitri Toubelis <[email protected]> This patch allows booting an image without arming watchdog timer whwn "watchdog=0" parameter is passed to the to the module.
This covers the use case when availability of a hardware driver is unknown ahead of time and can only be established upon first boot. The code that runs on the first boot can then identify if supported hardware watchdog is available and the required driver is present in the kernel and either update boot configuration re-arming the timer or issuing a warning unsupported hardware. This also allows for booting images in virtual environments. Allow "watchdog" be equal "0" Move bypass switch to efi_main Signed-off-by: Dmitri Toubelis <[email protected]> --- main.c | 11 ++++++++--- tools/bg_setenv.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index b71f811..64d93b8 100644 --- a/main.c +++ b/main.c @@ -157,9 +157,14 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) EFI_OUT_OF_RESOURCES); } - status = scan_devices(loaded_image, bg_loader_params.timeout); - if (EFI_ERROR(status)) { - error_exit(L"Could not probe watchdog.", status); + if (bg_loader_params.timeout == 0) { + Print(L"Watchdog is disabled.\n"); + return EFI_SUCCESS; + } else { + status = scan_devices(loaded_image, bg_loader_params.timeout); + if (EFI_ERROR(status)) { + error_exit(L"Could not probe watchdog.", status); + } } /* Load and start image */ diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c index b397aca..37f50ce 100644 --- a/tools/bg_setenv.c +++ b/tools/bg_setenv.c @@ -338,7 +338,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) break; case 'w': i = parse_int(arg); - if (errno || i == 0) { + if (errno || i < 0) { fprintf(stderr, "Invalid watchdog timeout specified.\n"); return 1; -- 2.7.4 -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/1517491460-10672-1-git-send-email-dmitri%40toubelis.org. For more options, visit https://groups.google.com/d/optout.
