Good catch. It has a bug and it doesn't work with watchdog=0 (there 
shouldn't be return statement in the if clause). Testing it now. Will send 
update shortly.

On Thursday, February 1, 2018 at 9:06:03 AM UTC-5, Jan Kiszka wrote:
>
> On 2018-02-01 14:24, [email protected] <javascript:> wrote: 
> > From: Dmitri Toubelis <[email protected] <javascript:>> 
> > 
> > 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] 
> <javascript:>> 
> > --- 
> >  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; 
>
> WAIT! This code wasn't tested... ;) 
>
> Jan 
>
> > +        } 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; 
> > 
>
> -- 
> Siemens AG, Corporate Technology, CT RDA IOT SES-DE 
> Corporate Competence Center Embedded Linux 
>

-- 
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/c3dd099b-daef-4fb7-8c9a-4a08814cf8a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to