From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsnpD-0001hO-TL for qemu-devel@nongnu.org; Wed, 09 Jan 2013 00:03:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsnpC-0005Ci-DZ for qemu-devel@nongnu.org; Wed, 09 Jan 2013 00:03:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsnpC-0005Cb-4g for qemu-devel@nongnu.org; Wed, 09 Jan 2013 00:03:38 -0500 Date: Wed, 9 Jan 2013 13:03:37 +0800 From: Amos Kong Message-ID: <20130109050337.GB1760@t430s.nay.redhat.com> References: <20121225103701.GA6688@t430s.redhat.com> <1356483340-12962-1-git-send-email-akong@redhat.com> <20130109040042.GC26614@morn.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130109040042.GC26614@morn.localdomain> Subject: Re: [Qemu-devel] [SeaBIOS PATCH v2] boot: support strict boot and make it configurable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin O'Connor Cc: alex.williamson@redhat.com, seabios@seabios.org, dallan@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com On Tue, Jan 08, 2013 at 11:00:42PM -0500, Kevin O'Connor wrote: > 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). Thanks for your patch. It's good. I thought you suggest me to add a new type, and bootentry_add unselected devices to HALT type. I did a simple test, patch works. I will re-post this patch and change qemu code to use this new type. Amos > -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