From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TM8vG-0002g2-OM for mharc-grub-devel@gnu.org; Wed, 10 Oct 2012 22:54:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TM8vD-0002dF-JH for grub-devel@gnu.org; Wed, 10 Oct 2012 22:54:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TM8vC-00064y-Ka for grub-devel@gnu.org; Wed, 10 Oct 2012 22:54:51 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:33815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TM8vC-00062P-DF for grub-devel@gnu.org; Wed, 10 Oct 2012 22:54:50 -0400 Received: by mail-lb0-f169.google.com with SMTP id k6so1033005lbo.0 for ; Wed, 10 Oct 2012 19:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:in-reply-to:references:content-type :x-mailer:mime-version:content-transfer-encoding; bh=1+G3iPt8q9JGccEAPsdqTmgn/EM0AItqTdmz3RRCw1g=; b=Brlhi5ci6bgtU1VHR8ztT4n7sbtWVJWniLI+IVTc1+HFbcwKtsFJC5OdjfyffkO7so GQlG2D90HKHkR/uC04sdZXpPdOzs1EhOCEqwmJj2DJ+ySiQtxMKI10oLArZJLpWZ171F BDOlz2ZZEl/qSxDHJd0tGqz0SnB4ZzjkYfxBChaLuy82DqjLsTDXPshCgd0CdMAHeWL3 ROjWDlo5YaOZGI21Cq2NeSvy/oSYTFrI5jR7tg1lRyGRji0YLcN1mqDXqEBkXFzhEaw8 Ld1cfLerrXW87F+KOC1BDlXOXUV5I5uB7gleoakaxlGYW9MiupTETyxg+UDBOyRoNb7R j5pg== Received: by 10.152.124.180 with SMTP id mj20mr21769940lab.43.1349924089017; Wed, 10 Oct 2012 19:54:49 -0700 (PDT) Received: from [192.168.10.103] (ppp83-237-19-151.pppoe.mtu-net.ru. [83.237.19.151]) by mx.google.com with ESMTPS id lr17sm922696lab.12.2012.10.10.19.54.47 (version=SSLv3 cipher=OTHER); Wed, 10 Oct 2012 19:54:48 -0700 (PDT) Message-ID: <1349924084.1949.4.camel@opensuse.site> Subject: Re: [PATCH] Add testpci command (v2) From: Andrey Borzenkov To: The development of GNU GRUB Date: Thu, 11 Oct 2012 06:54:44 +0400 In-Reply-To: <20121011002145.GV2289@earth.li> References: <20120927214211.GS2289@earth.li> <20121011002145.GV2289@earth.li> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.4 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.217.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 02:54:53 -0000 В Ср., 10/10/2012 в 17:21 -0700, Jonathan McDowell пишет: > On Thu, Sep 27, 2012 at 02:42:11PM -0700, Jonathan McDowell wrote: > > I have a machine with both Linux and Windows installed on the hard > > drive. Linux runs on the bare metal and I occasionally run the Windows > > install in a VM using KVM pointed at /dev/sda. However if I'm not quick > > enough, or Windows decides to reboot when I'm not around to notice, the > > grub running under KVM will decide to boot Linux and much confusion > > ensues. > > > > I couldn't find an easy way to test what the running environment was, so > > I knocked up a simple testpci command that allows me to test for the > > existence of a PCI device and change the default boot option based on > > that. I have: > > > > | if testpci 8086:1237; then > > | set default="2" > > | fi > > > > in my grub.cfg to correctly select the Windows partition if the qemu > > provided host bridge is present. > > So, a v2, changing to use --vendor/--product and also adding > --subvendor/--subproduct as it was pointed out to me that the subsystem > information can be used to confirm the hypervisor presence. I now have: > > | if testpci --vendor=0x8086 --subvendor=0x1af4 --subproduct=0x1100; then > | set default="2" > | fi > > which looks for an Intel device that has a Red Hat / KVM subsystem ID. > Could you also add minimal documentation for it? Otherwise nobody will even know that command exists :(