xref: /openbmc/qemu/docs/system/s390x/bootdevices.rst (revision 4921d0a7)
1Boot devices on s390x
2=====================
3
4Booting with bootindex parameter
5--------------------------------
6
7For classical mainframe guests (i.e. LPAR or z/VM installations), you always
8have to explicitly specify the disk where you want to boot from (or "IPL" from,
9in s390x-speak -- IPL means "Initial Program Load"). In particular, there can
10also be only one boot device according to the architecture specification, thus
11specifying multiple boot devices is not possible (yet).
12
13So for booting an s390x guest in QEMU, you should always mark the
14device where you want to boot from with the ``bootindex`` property, for
15example::
16
17 qemu-system-s390x -drive if=none,id=dr1,file=guest.qcow2 \
18                   -device virtio-blk,drive=dr1,bootindex=1
19
20For booting from a CD-ROM ISO image (which needs to include El-Torito boot
21information in order to be bootable), it is recommended to specify a ``scsi-cd``
22device, for example like this::
23
24 qemu-system-s390x -blockdev file,node-name=c1,filename=... \
25                   -device virtio-scsi \
26                   -device scsi-cd,drive=c1,bootindex=1
27
28Note that you really have to use the ``bootindex`` property to select the
29boot device. The old-fashioned ``-boot order=...`` command of QEMU (and
30also ``-boot once=...``) is not supported on s390x.
31
32
33Booting without bootindex parameter
34-----------------------------------
35
36The QEMU guest firmware (the so-called s390-ccw bios) has also some rudimentary
37support for scanning through the available block devices. So in case you did
38not specify a boot device with the ``bootindex`` property, there is still a
39chance that it finds a bootable device on its own and starts a guest operating
40system from it. However, this scanning algorithm is still very rough and may
41be incomplete, so that it might fail to detect a bootable device in many cases.
42It is really recommended to always specify the boot device with the
43``bootindex`` property instead.
44
45This also means that you should avoid the classical short-cut commands like
46``-hda``, ``-cdrom`` or ``-drive if=virtio``, since it is not possible to
47specify the ``bootindex`` with these commands. Note that the convenience
48``-cdrom`` option even does not give you a real (virtio-scsi) CD-ROM device on
49s390x. Due to technical limitations in the QEMU code base, you will get a
50virtio-blk device with this parameter instead, which might not be the right
51device type for installing a Linux distribution via ISO image. It is
52recommended to specify a CD-ROM device via ``-device scsi-cd`` (as mentioned
53above) instead.
54
55
56Selecting kernels with the ``loadparm`` property
57------------------------------------------------
58
59The ``s390-ccw-virtio`` machine supports the so-called ``loadparm`` parameter
60which can be used to select the kernel on the disk of the guest that the
61s390-ccw bios should boot. When starting QEMU, it can be specified like this::
62
63 qemu-system-s390x -machine s390-ccw-virtio,loadparm=<string>
64
65The first way to use this parameter is to use the word ``PROMPT`` as the
66``<string>`` here. In that case the s390-ccw bios will show a list of
67installed kernels on the disk of the guest and ask the user to enter a number
68to chose which kernel should be booted -- similar to what can be achieved by
69specifying the ``-boot menu=on`` option when starting QEMU. Note that the menu
70list will only show the names of the installed kernels when using a DASD-like
71disk image with 4k byte sectors. On normal SCSI-style disks with 512-byte
72sectors, there is not enough space for the zipl loader on the disk to store
73the kernel names, so you only get a list without names here.
74
75The second way to use this parameter is to use a number in the range from 0
76to 31. The numbers that can be used here correspond to the numbers that are
77shown when using the ``PROMPT`` option, and the s390-ccw bios will then try
78to automatically boot the kernel that is associated with the given number.
79Note that ``0`` can be used to boot the default entry.
80
81
82Booting from a network device
83-----------------------------
84
85Beside the normal guest firmware (which is loaded from the file ``s390-ccw.img``
86in the data directory of QEMU, or via the ``-bios`` option), QEMU ships with
87a small TFTP network bootloader firmware for virtio-net-ccw devices, too. This
88firmware is loaded from a file called ``s390-netboot.img`` in the QEMU data
89directory. In case you want to load it from a different filename instead,
90you can specify it via the ``-global s390-ipl.netboot_fw=filename``
91command line option.
92
93The ``bootindex`` property is especially important for booting via the network.
94If you don't specify the ``bootindex`` property here, the network bootloader
95firmware code won't get loaded into the guest memory so that the network boot
96will fail. For a successful network boot, try something like this::
97
98 qemu-system-s390x -netdev user,id=n1,tftp=...,bootfile=... \
99                   -device virtio-net-ccw,netdev=n1,bootindex=1
100
101The network bootloader firmware also has basic support for pxelinux.cfg-style
102configuration files. See the `PXELINUX Configuration page
103<https://wiki.syslinux.org/wiki/index.php?title=PXELINUX#Configuration>`__
104for details how to set up the configuration file on your TFTP server.
105The supported configuration file entries are ``DEFAULT``, ``LABEL``,
106``KERNEL``, ``INITRD`` and ``APPEND`` (see the `Syslinux Config file syntax
107<https://wiki.syslinux.org/wiki/index.php?title=Config>`__ for more
108information).
109