From patchwork Wed Dec 19 07:22:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 207247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0F2562C008C for ; Wed, 19 Dec 2012 18:19:52 +1100 (EST) Received: from localhost ([::1]:47798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlDwT-0006TG-AM for incoming@patchwork.ozlabs.org; Wed, 19 Dec 2012 02:19:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlDwM-0006T8-03 for qemu-devel@nongnu.org; Wed, 19 Dec 2012 02:19:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlDwL-0006en-2z for qemu-devel@nongnu.org; Wed, 19 Dec 2012 02:19:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlDwK-0006ec-SS for qemu-devel@nongnu.org; Wed, 19 Dec 2012 02:19:41 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBJ7Jcnt013127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Dec 2012 02:19:38 -0500 Received: from dhcp-8-167.nay.redhat.com ([10.66.7.126]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBJ7JZcp017657; Wed, 19 Dec 2012 02:19:35 -0500 From: Amos Kong To: kevin@koconnor.net Date: Wed, 19 Dec 2012 15:22:10 +0800 Message-Id: <1355901730-24350-1-git-send-email-akong@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: alex.williamson@redhat.com, Amos Kong , dallan@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com Subject: [Qemu-devel] [PATCH] don't boot from un-selected devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. Sometimes, user don't want to boot from some devices. This patch changes seabios to boot only from selected devices. If user choose first boot device from menu, then seabios will try all the devices, even some of them are not selected. Signed-off-by: Amos Kong --- src/boot.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/boot.c b/src/boot.c index 3ca7960..ee810ac 100644 --- a/src/boot.c +++ b/src/boot.c @@ -424,6 +424,10 @@ interactive_bootmenu(void) maxmenu++; printf("%d. %s\n", maxmenu , strtcpy(desc, pos->description, ARRAY_SIZE(desc))); + /* If user chooses first boot device from menu, we will treat + all the devices as selected. */ + if (pos->priority == DEFAULT_PRIO) + pos->priority = DEFAULT_PRIO - 1; pos = pos->next; } @@ -490,7 +494,10 @@ boot_prep(void) // Map drives and populate BEV list struct bootentry_s *pos = BootList; - while (pos) { + + /* The priority of un-selected device is not changed, + we only boot from user selected devices. */ + while (pos && pos->priority != DEFAULT_PRIO) { switch (pos->type) { case IPL_TYPE_BCV: call_bcv(pos->vector.seg, pos->vector.offset); @@ -513,10 +520,6 @@ boot_prep(void) } pos = pos->next; } - - // If nothing added a floppy/hd boot - add it manually. - add_bev(IPL_TYPE_FLOPPY, 0); - add_bev(IPL_TYPE_HARDDISK, 0); }