В Ср., 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 :( _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel