xref: /openbmc/qemu/docs/system/s390x/bootdevices.rst (revision 2c471a8291c182130a77702d9bd4c910d987c6a9)
170c04a7cSThomas HuthBoot devices on s390x
270c04a7cSThomas Huth=====================
370c04a7cSThomas Huth
470c04a7cSThomas HuthBooting with bootindex parameter
570c04a7cSThomas Huth--------------------------------
670c04a7cSThomas Huth
770c04a7cSThomas HuthFor classical mainframe guests (i.e. LPAR or z/VM installations), you always
870c04a7cSThomas Huthhave to explicitly specify the disk where you want to boot from (or "IPL" from,
90bd10713SJared Rossiin s390x-speak -- IPL means "Initial Program Load").
1070c04a7cSThomas Huth
1170c04a7cSThomas HuthSo for booting an s390x guest in QEMU, you should always mark the
1270c04a7cSThomas Huthdevice where you want to boot from with the ``bootindex`` property, for
1370c04a7cSThomas Huthexample::
1470c04a7cSThomas Huth
1570c04a7cSThomas Huth qemu-system-s390x -drive if=none,id=dr1,file=guest.qcow2 \
1670c04a7cSThomas Huth                   -device virtio-blk,drive=dr1,bootindex=1
1770c04a7cSThomas Huth
180bd10713SJared RossiMultiple devices may have a bootindex. The lowest bootindex is assigned to the
190bd10713SJared Rossidevice to IPL first.  If the IPL fails for the first, the device with the second
200bd10713SJared Rossilowest bootindex will be tried and so on until IPL is successful or there are no
210bd10713SJared Rossiremaining boot devices to try.
220bd10713SJared Rossi
2370c04a7cSThomas HuthFor booting from a CD-ROM ISO image (which needs to include El-Torito boot
2470c04a7cSThomas Huthinformation in order to be bootable), it is recommended to specify a ``scsi-cd``
2570c04a7cSThomas Huthdevice, for example like this::
2670c04a7cSThomas Huth
2770c04a7cSThomas Huth qemu-system-s390x -blockdev file,node-name=c1,filename=... \
2870c04a7cSThomas Huth                   -device virtio-scsi \
2970c04a7cSThomas Huth                   -device scsi-cd,drive=c1,bootindex=1
3070c04a7cSThomas Huth
3170c04a7cSThomas HuthNote that you really have to use the ``bootindex`` property to select the
3270c04a7cSThomas Huthboot device. The old-fashioned ``-boot order=...`` command of QEMU (and
3370c04a7cSThomas Huthalso ``-boot once=...``) is not supported on s390x.
3470c04a7cSThomas Huth
3570c04a7cSThomas Huth
3670c04a7cSThomas HuthBooting without bootindex parameter
3770c04a7cSThomas Huth-----------------------------------
3870c04a7cSThomas Huth
3970c04a7cSThomas HuthThe QEMU guest firmware (the so-called s390-ccw bios) has also some rudimentary
4070c04a7cSThomas Huthsupport for scanning through the available block devices. So in case you did
4170c04a7cSThomas Huthnot specify a boot device with the ``bootindex`` property, there is still a
4270c04a7cSThomas Huthchance that it finds a bootable device on its own and starts a guest operating
4370c04a7cSThomas Huthsystem from it. However, this scanning algorithm is still very rough and may
4470c04a7cSThomas Huthbe incomplete, so that it might fail to detect a bootable device in many cases.
4570c04a7cSThomas HuthIt is really recommended to always specify the boot device with the
4670c04a7cSThomas Huth``bootindex`` property instead.
4770c04a7cSThomas Huth
4870c04a7cSThomas HuthThis also means that you should avoid the classical short-cut commands like
4970c04a7cSThomas Huth``-hda``, ``-cdrom`` or ``-drive if=virtio``, since it is not possible to
5070c04a7cSThomas Huthspecify the ``bootindex`` with these commands. Note that the convenience
5170c04a7cSThomas Huth``-cdrom`` option even does not give you a real (virtio-scsi) CD-ROM device on
5270c04a7cSThomas Huths390x. Due to technical limitations in the QEMU code base, you will get a
5370c04a7cSThomas Huthvirtio-blk device with this parameter instead, which might not be the right
5470c04a7cSThomas Huthdevice type for installing a Linux distribution via ISO image. It is
5570c04a7cSThomas Huthrecommended to specify a CD-ROM device via ``-device scsi-cd`` (as mentioned
5670c04a7cSThomas Huthabove) instead.
5770c04a7cSThomas Huth
5870c04a7cSThomas Huth
59be5df2edSThomas HuthSelecting kernels with the ``loadparm`` property
60be5df2edSThomas Huth------------------------------------------------
61be5df2edSThomas Huth
62be5df2edSThomas HuthThe ``s390-ccw-virtio`` machine supports the so-called ``loadparm`` parameter
63be5df2edSThomas Huthwhich can be used to select the kernel on the disk of the guest that the
64be5df2edSThomas Huths390-ccw bios should boot. When starting QEMU, it can be specified like this::
65be5df2edSThomas Huth
66be5df2edSThomas Huth qemu-system-s390x -machine s390-ccw-virtio,loadparm=<string>
67be5df2edSThomas Huth
68be5df2edSThomas HuthThe first way to use this parameter is to use the word ``PROMPT`` as the
69be5df2edSThomas Huth``<string>`` here. In that case the s390-ccw bios will show a list of
70be5df2edSThomas Huthinstalled kernels on the disk of the guest and ask the user to enter a number
71be5df2edSThomas Huthto chose which kernel should be booted -- similar to what can be achieved by
72be5df2edSThomas Huthspecifying the ``-boot menu=on`` option when starting QEMU. Note that the menu
73be5df2edSThomas Huthlist will only show the names of the installed kernels when using a DASD-like
74be5df2edSThomas Huthdisk image with 4k byte sectors. On normal SCSI-style disks with 512-byte
75be5df2edSThomas Huthsectors, there is not enough space for the zipl loader on the disk to store
76be5df2edSThomas Huththe kernel names, so you only get a list without names here.
77be5df2edSThomas Huth
78be5df2edSThomas HuthThe second way to use this parameter is to use a number in the range from 0
79be5df2edSThomas Huthto 31. The numbers that can be used here correspond to the numbers that are
80be5df2edSThomas Huthshown when using the ``PROMPT`` option, and the s390-ccw bios will then try
81be5df2edSThomas Huthto automatically boot the kernel that is associated with the given number.
82*0271fdc6SJared RossiNote that ``0`` can be used to boot the default entry. If the machine
83*0271fdc6SJared Rossi``loadparm`` is not assigned a value, then the default entry is used.
84*0271fdc6SJared Rossi
85*0271fdc6SJared RossiBy default, the machine ``loadparm`` applies to all boot devices. If multiple
86*0271fdc6SJared Rossidevices are assigned a ``bootindex`` and the ``loadparm`` is to be different
87*0271fdc6SJared Rossibetween them, an independent ``loadparm`` may be assigned on a per-device basis.
88*0271fdc6SJared Rossi
89*0271fdc6SJared RossiAn example guest using per-device ``loadparm``::
90*0271fdc6SJared Rossi
91*0271fdc6SJared Rossi  qemu-system-s390x -drive if=none,id=dr1,file=primary.qcow2 \
92*0271fdc6SJared Rossi                   -device virtio-blk,drive=dr1,bootindex=1 \
93*0271fdc6SJared Rossi                   -drive if=none,id=dr2,file=secondary.qcow2 \
94*0271fdc6SJared Rossi                   -device virtio-blk,drive=dr2,bootindex=2,loadparm=3
95*0271fdc6SJared Rossi
96*0271fdc6SJared RossiIn this case, the primary boot device will attempt to IPL using the default
97*0271fdc6SJared Rossientry (because no ``loadparm`` is specified for this device or for the
98*0271fdc6SJared Rossimachine). If that device fails to boot, the secondary device will attempt to
99*0271fdc6SJared RossiIPL using entry number 3.
100*0271fdc6SJared Rossi
101*0271fdc6SJared RossiIf a ``loadparm`` is specified on both the machine and a device, the per-device
102*0271fdc6SJared Rossivalue will superseded the machine value.  Per-device ``loadparm`` values are
103*0271fdc6SJared Rossionly used for devices with an assigned ``bootindex``. The machine ``loadparm``
104*0271fdc6SJared Rossiis used when attempting to boot without a ``bootindex``.
105be5df2edSThomas Huth
106be5df2edSThomas Huth
10770c04a7cSThomas HuthBooting from a network device
10870c04a7cSThomas Huth-----------------------------
10970c04a7cSThomas Huth
110ab2691b6SJared RossiThe firmware that ships with QEMU includes a small TFTP network bootloader
111ab2691b6SJared Rossifor virtio-net-ccw devices.  The ``bootindex`` property is especially
112ab2691b6SJared Rossiimportant for booting via the network. If you don't specify the ``bootindex``
113ab2691b6SJared Rossiproperty here, the network bootloader won't be taken into consideration and
114ab2691b6SJared Rossithe network boot will fail. For a successful network boot, try something
115ab2691b6SJared Rossilike this::
11670c04a7cSThomas Huth
11770c04a7cSThomas Huth qemu-system-s390x -netdev user,id=n1,tftp=...,bootfile=... \
11870c04a7cSThomas Huth                   -device virtio-net-ccw,netdev=n1,bootindex=1
11970c04a7cSThomas Huth
120ab2691b6SJared RossiThe network bootloader also has basic support for pxelinux.cfg-style
12170c04a7cSThomas Huthconfiguration files. See the `PXELINUX Configuration page
12270c04a7cSThomas Huth<https://wiki.syslinux.org/wiki/index.php?title=PXELINUX#Configuration>`__
12370c04a7cSThomas Huthfor details how to set up the configuration file on your TFTP server.
12470c04a7cSThomas HuthThe supported configuration file entries are ``DEFAULT``, ``LABEL``,
12570c04a7cSThomas Huth``KERNEL``, ``INITRD`` and ``APPEND`` (see the `Syslinux Config file syntax
12670c04a7cSThomas Huth<https://wiki.syslinux.org/wiki/index.php?title=Config>`__ for more
12770c04a7cSThomas Huthinformation).
128