blob: 6937862ba0de220432c1a29071e505740759fa18 [file] [log] [blame]
Stefan Weil280a66a2012-08-10 21:53:02 +02001= Bootindex property =
Gleb Natapov466b5862011-01-30 12:29:19 +02002
3Block and net devices have bootindex property. This property is used to
4determine the order in which firmware will consider devices for booting
5the guest OS. If the bootindex property is not set for a device, it gets
6lowest boot priority. There is no particular order in which devices with
7unset bootindex property will be considered for booting, but they will
8still be bootable.
9
10== Example ==
11
Peter Maydelle03ba132013-04-09 12:48:19 +010012Let's assume we have a QEMU machine with two NICs (virtio, e1000) and two
Gleb Natapov466b5862011-01-30 12:29:19 +020013disks (IDE, virtio):
14
15qemu -drive file=disk1.img,if=none,id=disk1
Markus Armbruster1c9f3b82017-05-09 11:41:15 +020016 -device ide-hd,drive=disk1,bootindex=4
Gleb Natapov466b5862011-01-30 12:29:19 +020017 -drive file=disk2.img,if=none,id=disk2
18 -device virtio-blk-pci,drive=disk2,bootindex=3
19 -netdev type=user,id=net0 -device virtio-net-pci,netdev=net0,bootindex=2
20 -netdev type=user,id=net1 -device e1000,netdev=net1,bootindex=1
21
22Given the command above, firmware should try to boot from the e1000 NIC
Peter Maydelle03ba132013-04-09 12:48:19 +010023first. If this fails, it should try the virtio NIC next; if this fails
Gleb Natapov466b5862011-01-30 12:29:19 +020024too, it should try the virtio disk, and then the IDE disk.
25
26== Limitations ==
27
281. Some firmware has limitations on which devices can be considered for
29booting. For instance, the PC BIOS boot specification allows only one
30disk to be bootable. If boot from disk fails for some reason, the BIOS
Peter Maydelle03ba132013-04-09 12:48:19 +010031won't retry booting from other disk. It can still try to boot from
Gleb Natapov466b5862011-01-30 12:29:19 +020032floppy or net, though.
33
342. Sometimes, firmware cannot map the device path QEMU wants firmware to
35boot from to a boot method. It doesn't happen for devices the firmware
36can natively boot from, but if firmware relies on an option ROM for
37booting, and the same option ROM is used for booting from more then one
38device, the firmware may not be able to ask the option ROM to boot from
Peter Maydelle03ba132013-04-09 12:48:19 +010039a particular device reliably. For instance with the PC BIOS, if a SCSI HBA
Gleb Natapov466b5862011-01-30 12:29:19 +020040has three bootable devices target1, target3, target5 connected to it,
41the option ROM will have a boot method for each of them, but it is not
42possible to map from boot method back to a specific target. This is a
Peter Maydelle03ba132013-04-09 12:48:19 +010043shortcoming of the PC BIOS boot specification.
Thomas Huthc0d9f7d2017-02-28 18:40:01 +010044
45== Mixing bootindex and boot order parameters ==
46
47Note that it does not make sense to use the bootindex property together
48with the "-boot order=..." (or "-boot once=...") parameter. The guest
49firmware implementations normally either support the one or the other,
50but not both parameters at the same time. Mixing them will result in
51undefined behavior, and thus the guest firmware will likely not boot
52from the expected devices.