[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
Sat May 12 16:01:49 CEST 2012


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.)

That said, making it a config option is trivial.

-Kevin


diff --git a/src/boot.c b/src/boot.c
index 8cc94b0..b5b3360 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -617,6 +617,26 @@ 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);
+    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 (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)
@@ -625,10 +645,7 @@ do_boot(u16 seq_nr)
         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();
+        boot_fail();
     }
 
     // Boot the given BEV type.



More information about the SeaBIOS mailing list