qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin O'Connor <kevin@koconnor.net>
To: Amos Kong <akong@redhat.com>
Cc: alex.williamson@redhat.com, seabios@seabios.org,
	dallan@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com
Subject: Re: [Qemu-devel] [SeaBIOS PATCH v2] boot: support strict boot and make it configurable
Date: Tue, 8 Jan 2013 23:00:42 -0500	[thread overview]
Message-ID: <20130109040042.GC26614@morn.localdomain> (raw)
In-Reply-To: <1356483340-12962-1-git-send-email-akong@redhat.com>

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

  reply	other threads:[~2013-01-09  4:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19  7:22 [Qemu-devel] [PATCH] don't boot from un-selected devices Amos Kong
2012-12-19  7:24 ` [Qemu-devel] [Resend][Seabios PATCH] " Amos Kong
2012-12-19  7:38   ` Gerd Hoffmann
2012-12-19  8:12     ` Amos Kong
2012-12-19  9:32   ` Gleb Natapov
2012-12-25  3:58     ` Amos Kong
2012-12-25  6:37       ` Gleb Natapov
2012-12-25 10:37         ` Amos Kong
2012-12-26  0:55           ` [Qemu-devel] [SeaBIOS PATCH v2] boot: support strict boot and make it configurable Amos Kong
2013-01-09  4:00             ` Kevin O'Connor [this message]
2013-01-09  5:03               ` Amos Kong
2013-01-12 22:01                 ` Kevin O'Connor
2013-01-09  5:17               ` [Qemu-devel] [SeaBIOS PATCH v3] boot: add a new type to halt booting Amos Kong
2012-12-25 15:59     ` [Qemu-devel] [Resend][Seabios PATCH] don't boot from un-selected devices Ronen Hod
2012-12-25 17:15       ` Gleb Natapov
2012-12-19 16:39   ` Kevin O'Connor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130109040042.GC26614@morn.localdomain \
    --to=kevin@koconnor.net \
    --cc=akong@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=dallan@redhat.com \
    --cc=gleb@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).