[SeaBIOS] [coreboot] seabios feature request : reboot VM or retry boot devices when no valid boot disk is found
Kevin O'Connor
kevin at koconnor.net
Sun May 13 15:54:06 CEST 2012
On Sun, May 13, 2012 at 01:02:10PM +0300, Gleb Natapov wrote:
> On Sat, May 12, 2012 at 10:01:49AM -0400, Kevin O'Connor wrote:
> > On Sat, May 12, 2012 at 03:04:52AM +0200, Peter Stuge wrote:
> > > Kevin O'Connor wrote:
> > > > +// Unable to find bootable device - warn user and eventually retry.
> > > > +static void
> > > > +boot_fail(void)
> > > > +{
> > > > + printf("No bootable device.\n");
> > > > + // Wait for 60 seconds and then reboot.
> > > > + u32 end = calc_future_timer(60*1000);
> > >
> > > I'd suggest printf("No bootable device found. Retrying in 5 seconds...\n");
> > > and lowering the timeout.
> >
> > I'd only do this if the timeout was large - indeed I think 60 seconds
> > is a little on the low side. (Not being able to boot is almost always
> > an error - it should be fixed not covered up.)
> >
> Agree. For VM use it's better to notify management about it.
>
> > That said, making it a config option is trivial.
> >
> The patch below does not allow to disable the behaviour (short of setting
> ridiculously long timeout). Lets make 0 timeout to mean never timeout
> and make it a default.
How about -1 to indicate no reboot. Also, I think a 60 second reboot
is a good default. Maurits indicated his off-the-shelf BIOS did this,
and I can see where it would be useful. (I've run into cases where a
USB device didn't spin up in time and there was no indication it was
present - if this were to happen in a datacenter environment, it would
be a real pain to have to go find the machine.)
-Kevin
--- a/src/boot.c
+++ b/src/boot.c
@@ -617,6 +617,29 @@ boot_rom(u32 vector)
call_boot_entry(so, 0);
}
+// Unable to find bootable device - warn user and eventually retry.
+static void
+boot_fail(void)
+{
+ u32 retrytime = romfile_loadint("etc/boot-fail-wait", 60*1000);
+ if (retrytime == (u32)-1)
+ printf("No bootable device.\n");
+ else
+ printf("No bootable device. Retrying in %d seconds.\n", retrytime/1000);
+ // Wait for 'retrytime' milliseconds and then reboot.
+ u32 end = calc_future_timer(retrytime);
+ for (;;) {
+ if (retrytime != (u32)-1 && check_timer(end))
+ break;
+ wait_irq();
+ }
+ printf("Rebooting.\n");
+ struct bregs br;
+ memset(&br, 0, sizeof(br));
+ br.code = SEGOFF(SEG_BIOS, (u32)reset_vector);
+ call16big(&br);
+}
+
// Determine next boot method and attempt a boot using it.
static void
do_boot(u16 seq_nr)
@@ -624,12 +647,8 @@ do_boot(u16 seq_nr)
if (! CONFIG_BOOT)
panic("Boot support not compiled in.\n");
- if (seq_nr >= BEVCount) {
- printf("No bootable device.\n");
- // Loop with irqs enabled - this allows ctrl+alt+delete to work.
- for (;;)
- wait_irq();
- }
+ if (seq_nr >= BEVCount)
+ boot_fail();
// Boot the given BEV type.
struct bev_s *ie = &BEV[seq_nr];
More information about the SeaBIOS
mailing list