[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [SeaBIOS PATCH v2] boot: support strict boot and make i
From: |
Kevin O'Connor |
Subject: |
Re: [Qemu-devel] [SeaBIOS PATCH v2] boot: support strict boot and make it configurable |
Date: |
Tue, 8 Jan 2013 23:00:42 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Dec 26, 2012 at 08:55:40AM +0800, Amos Kong wrote:
> Current seabios will try to boot from selected devices first,
> if they are all failed, seabios will also try to boot from
> un-selected devices.
>
> For example:
> @ qemu-kvm -boot order=n,menu=on ...
>
> Guest will boot from network first, if it's failed, guest will try to
> boot from other un-selected devices (floppy, cdrom, disk) one by one.
>
> We need to make it configurable, seabios user can config it by a rom
> file('etc/boot-strict'). 'strict boot' means only boot from user
> selected devices.
>
> I added some comments in this patch to explain why we can judge if
> device is selected or not by DEFAULT_PRIO(9999). I also added 'selected'
> flag in struct bootentry_s and struct bev_s to make it clearer.
>
> If this patch is accepted, I will add a boot option (-boot strict=on)
> for qemu.
I think it would be simpler to use the existing bootorder file instead
of introducing a new "boot-strict" file. Something like the below
(untested).
-Kevin
diff --git a/src/boot.c b/src/boot.c
index c67cc7f..56843e3 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -291,6 +291,7 @@ static struct bootentry_s *BootList;
#define IPL_TYPE_CBFS 0x20
#define IPL_TYPE_BEV 0x80
#define IPL_TYPE_BCV 0x81
+#define IPL_TYPE_HALT 0xf0
static void
bootentry_add(int type, int prio, u32 data, const char *desc)
@@ -488,6 +489,10 @@ boot_prep(void)
interactive_bootmenu();
wait_threads();
+ int haltprio = find_prio("HALT");
+ if (haltprio >= 0)
+ bootentry_add(IPL_TYPE_HALT, haltprio, 0, "HALT");
+
// Map drives and populate BEV list
struct bootentry_s *pos = BootList;
while (pos) {
@@ -672,6 +677,9 @@ do_boot(int seq_nr)
case IPL_TYPE_BEV:
boot_rom(ie->vector);
break;
+ case IPL_TYPE_HALT:
+ boot_fail();
+ break;
}
// Boot failed: invoke the boot recovery function
- Re: [Qemu-devel] [SeaBIOS PATCH v2] boot: support strict boot and make it configurable,
Kevin O'Connor <=