1 Managing device boot order with bootindex properties
2 ====================================================
4 QEMU can tell QEMU-aware guest firmware (like the x86 PC BIOS)
5 which order it should look for a bootable OS on which devices.
6 A simple way to set this order is to use the ``-boot order=`` option,
7 but you can also do this more flexibly, by setting a ``bootindex``
8 property on the individual block or net devices you specify
9 on the QEMU command line.
11 The ``bootindex`` properties are used to determine the order in which
12 firmware will consider devices for booting the guest OS. If the
13 ``bootindex`` property is not set for a device, it gets the lowest
14 boot priority. There is no particular order in which devices with no
15 ``bootindex`` property set will be considered for booting, but they
16 will still be bootable.
18 Some guest machine types (for instance the s390x machines) do
19 not support ``-boot order=``; on those machines you must always
20 use ``bootindex`` properties.
22 There is no way to set a ``bootindex`` property if you are using
23 a short-form option like ``-hda`` or ``-cdrom``, so to use
24 ``bootindex`` properties you will need to expand out those options
25 into long-form ``-drive`` and ``-device`` option pairs.
30 Let's assume we have a QEMU machine with two NICs (virtio, e1000) and two
35 |qemu_system| -drive file=disk1.img,if=none,id=disk1 \\
36 -device ide-hd,drive=disk1,bootindex=4 \\
37 -drive file=disk2.img,if=none,id=disk2 \\
38 -device virtio-blk-pci,drive=disk2,bootindex=3 \\
39 -netdev type=user,id=net0 \\
40 -device virtio-net-pci,netdev=net0,bootindex=2 \\
41 -netdev type=user,id=net1 \\
42 -device e1000,netdev=net1,bootindex=1
44 Given the command above, firmware should try to boot from the e1000 NIC
45 first. If this fails, it should try the virtio NIC next; if this fails
46 too, it should try the virtio disk, and then the IDE disk.
51 Some firmware has limitations on which devices can be considered for
52 booting. For instance, the PC BIOS boot specification allows only one
53 disk to be bootable. If boot from disk fails for some reason, the BIOS
54 won't retry booting from other disk. It can still try to boot from
55 floppy or net, though.
57 Sometimes, firmware cannot map the device path QEMU wants firmware to
58 boot from to a boot method. It doesn't happen for devices the firmware
59 can natively boot from, but if firmware relies on an option ROM for
60 booting, and the same option ROM is used for booting from more then one
61 device, the firmware may not be able to ask the option ROM to boot from
62 a particular device reliably. For instance with the PC BIOS, if a SCSI HBA
63 has three bootable devices target1, target3, target5 connected to it,
64 the option ROM will have a boot method for each of them, but it is not
65 possible to map from boot method back to a specific target. This is a
66 shortcoming of the PC BIOS boot specification.
68 Mixing bootindex and boot order parameters
69 ------------------------------------------
71 Note that it does not make sense to use the bootindex property together
72 with the ``-boot order=...`` (or ``-boot once=...``) parameter. The guest
73 firmware implementations normally either support the one or the other,
74 but not both parameters at the same time. Mixing them will result in
75 undefined behavior, and thus the guest firmware will likely not boot
76 from the expected devices.