1
# mach-virt - VirtIO guest (serial console)
2
# =========================================================
6
# $ qemu-system-aarch64 \
8
# -readconfig mach-virt-serial.cfg \
9
# -display none -serial mon:stdio \
12
# You will probably need to tweak the lines marked as
13
# CHANGE ME before being able to use this configuration!
15
# The guest will have a selection of VirtIO devices
16
# tailored towards optimal performance with modern guests,
17
# and will be accessed through the serial console.
19
# ---------------------------------------------------------
21
# Using -nodefaults is required to have full control over
22
# the virtual hardware: when it's specified, QEMU will
23
# populate the board with only the builtin peripherals,
24
# such as the PL011 UART, plus a PCI Express Root Bus; the
25
# user will then have to explicitly add further devices.
27
# The PCI Express Root Bus shows up in the guest as:
31
# This configuration file adds a number of other useful
32
# devices, more specifically:
34
# 00.1c.* PCI bridge (PCI Express Root Ports)
35
# 01:00.0 SCSI storage controller
36
# 02:00.0 Ethernet controller
38
# More information about these devices is available below.
40
# We use '-display none' to prevent QEMU from creating a
41
# graphical display window, which would serve no use in
42
# this specific configuration, and '-serial mon:stdio' to
43
# multiplex the guest's serial console and the QEMU monitor
44
# to the host's stdio; use 'Ctrl+A h' to learn how to
45
# switch between the two and more.
49
# =========================================================
51
# We use the virt machine type and enable KVM acceleration
52
# for better performance.
54
# Using less than 1 GiB of memory is probably not going to
55
# yield good performance in the guest, and might even lead
56
# to obscure boot issues in some cases.
58
# Unfortunately, there is no way to configure the CPU model
59
# in this file, so it will have to be provided on the
60
# command line, but we can configure the guest to use the
61
# same GIC version as the host.
74
# Firmware configuration
75
# =========================================================
77
# There are two parts to the firmware: a read-only image
78
# containing the executable code, which is shared between
79
# guests, and a read/write variable store that is owned
80
# by one specific guest, exclusively, and is used to
81
# record information such as the UEFI boot order.
83
# For any new guest, its permanent, private variable store
84
# should initially be copied from the template file
85
# provided along with the firmware binary.
87
# Depending on the OS distribution you're using on the
88
# host, the name of the package containing the firmware
89
# binary and variable store template, as well as the paths
90
# to the files themselves, will be different. For example:
94
# /usr/share/edk2/aarch64/QEMU_EFI-pflash.raw (bin)
95
# /usr/share/edk2/aarch64/vars-template-pflash.raw (var)
99
# /usr/share/AAVMF/AAVMF_CODE.fd (bin)
100
# /usr/share/AAVMF/AAVMF_VARS.fd (var)
104
# /usr/share/AAVMF/AAVMF_CODE.fd (bin)
105
# /usr/share/AAVMF/AAVMF_VARS.fd (var)
108
file = "/usr/share/AAVMF/AAVMF_CODE.fd" # CHANGE ME
114
[drive "uefi-varstore"]
115
file = "guest_VARS.fd" # CHANGE ME
121
# PCI bridge (PCI Express Root Ports)
122
# =========================================================
124
# We create eight PCI Express Root Ports, and we plug them
125
# all into separate functions of the same slot. Some of
126
# them will be used by devices, the rest will remain
127
# available for hotplug.
130
driver = "pcie-root-port"
138
driver = "pcie-root-port"
145
driver = "pcie-root-port"
152
driver = "pcie-root-port"
159
driver = "pcie-root-port"
166
driver = "pcie-root-port"
173
driver = "pcie-root-port"
180
driver = "pcie-root-port"
187
# SCSI storage controller (and storage)
188
# =========================================================
190
# We use virtio-scsi here so that we can (hot)plug a large
191
# number of disks without running into issues; a SCSI disk,
192
# backed by a qcow2 disk image on the host's filesystem, is
195
# We also create an optical disk, mostly for installation
196
# purposes: once the guest OS has been successfully
197
# installed, the guest will no longer boot from optical
198
# media. If you don't want, or no longer want, to have an
199
# optical disk in the guest you can safely comment out
200
# all relevant sections below.
203
driver = "virtio-scsi-pci"
214
file = "guest.qcow2" # CHANGE ME
218
[device "scsi-optical-disk"]
221
drive = "optical-disk"
224
[drive "optical-disk"]
225
file = "install.iso" # CHANGE ME
231
# =========================================================
233
# We use virtio-net for improved performance over emulated
234
# hardware; on the host side, we take advantage of user
235
# networking so that the QEMU process doesn't require any
236
# additional privileges.
242
driver = "virtio-net-pci"