Lines Matching +full:build +full:- +full:opensbi
8 real-world hardware.
11 -----------------
17 * Platform-Level Interrupt Controller (PLIC)
22 * 8 virtio-mmio transport devices
31 ----------------------------------
34 which it passes to the guest, if there is no ``-dtb`` option. This provides
39 If users want to provide their own DTB, they can use the ``-dtb`` option.
42 * The number of subnodes of the /cpus node should match QEMU's ``-smp`` option
43 * The /memory reg size should match QEMU’s selected ram_size via ``-m``
45 "riscv,clint0" if using with OpenSBI BIOS images
48 ------------
50 The ``virt`` machine can start using the standard -kernel functionality
51 for loading a Linux kernel, a VxWorks kernel, an S-mode U-Boot bootloader
52 with the default OpenSBI firmware image as the -bios. It also supports
53 the recommended RISC-V bootflow: U-Boot SPL (M-mode) loads OpenSBI fw_dynamic
54 firmware and U-Boot proper (S-mode), using the standard -bios functionality.
57 -------------------
60 S-mode firmware code. It can be configured as read-only, with the
65 .. code-block:: bash
67 $ qemu-system-riscv64 \
68 -blockdev node-name=pflash0,driver=file,read-only=on,filename=<edk2_code> \
69 -blockdev node-name=pflash1,driver=file,filename=<edk2_vars> \
70 -M virt,pflash0=pflash0,pflash1=pflash1 \
73 For TCG guests only, it is also possible to boot M-mode firmware from
74 the first flash device (pflash0) by additionally passing ``-bios
77 .. code-block:: bash
79 $ qemu-system-riscv64 \
80 -bios none \
81 -blockdev node-name=pflash0,driver=file,read-only=on,filename=<m_mode_code> \
82 -M virt,pflash0=pflash0 \
87 riscv-iommu support
88 -------------------
90 The board has support for the riscv-iommu-pci device by using the following
93 .. code-block:: bash
95 $ qemu-system-riscv64 -M virt -device riscv-iommu-pci (...)
97 Refer to :ref:`riscv-iommu` for more information on how the RISC-V IOMMU support
100 Machine-specific options
101 ------------------------
103 The following machine-specific options are supported:
105 - aclint=[on|off]
111 - acpi=[on|off|auto]
116 - aia=[none|aplic|aplic-imsic]
121 interrupts whereas the "aia=aplic-imsic" selects APLIC and IMSIC (incoming
126 - aia-guests=nnn
128 The number of per-HART VS-level AIA IMSIC pages to be emulated for a guest
129 having AIA IMSIC (i.e. "aia=aplic-imsic" selected). When not specified,
130 the default number of per-HART VS-level AIA IMSIC pages is 0.
133 --------------------
135 Linux mainline v5.12 release is tested at the time of writing. To build a
137 64-bit mode, simply configure the kernel using the defconfig configuration:
139 .. code-block:: bash
142 $ export CROSS_COMPILE=riscv64-linux-
148 .. code-block:: bash
150 $ qemu-system-riscv64 -M virt -smp 4 -m 2G \
151 -display none -serial stdio \
152 -kernel arch/riscv/boot/Image \
153 -initrd /path/to/rootfs.cpio \
154 -append "root=/dev/ram"
156 To build a Linux mainline kernel that can be booted by the ``virt`` machine
157 in 32-bit mode, use the rv32_defconfig configuration. A patch is required to
158 fix the 32-bit boot issue for Linux kernel v5.12.
160 .. code-block:: bash
163 $ export CROSS_COMPILE=riscv64-linux-
164 …$ curl https://patchwork.kernel.org/project/linux-riscv/patch/20210627135117.28641-1-bmeng.cn@gmai…
169 Replace ``qemu-system-riscv64`` with ``qemu-system-riscv32`` in the command
170 line above to boot the 32-bit Linux kernel. A rootfs image containing 32-bit
173 Running U-Boot
174 --------------
176 U-Boot mainline v2021.04 release is tested at the time of writing. To build an
177 S-mode U-Boot bootloader that can be booted by the ``virt`` machine, use
178 the qemu-riscv64_smode_defconfig with similar commands as described above for Linux:
180 .. code-block:: bash
182 $ export CROSS_COMPILE=riscv64-linux-
183 $ make qemu-riscv64_smode_defconfig
185 Boot the 64-bit U-Boot S-mode image directly:
187 .. code-block:: bash
189 $ qemu-system-riscv64 -M virt -smp 4 -m 2G \
190 -display none -serial stdio \
191 -kernel /path/to/u-boot.bin
193 To test booting U-Boot SPL which in M-mode, which in turn loads a FIT image
194 that bundles OpenSBI fw_dynamic firmware and U-Boot proper (S-mode) together,
195 build the U-Boot images using riscv64_spl_defconfig:
197 .. code-block:: bash
199 $ export CROSS_COMPILE=riscv64-linux-
200 $ export OPENSBI=/path/to/opensbi-riscv64-generic-fw_dynamic.bin
201 $ make qemu-riscv64_spl_defconfig
203 The minimal QEMU commands to run U-Boot SPL are:
205 .. code-block:: bash
207 $ qemu-system-riscv64 -M virt -smp 4 -m 2G \
208 -display none -serial stdio \
209 -bios /path/to/u-boot-spl \
210 -device loader,file=/path/to/u-boot.itb,addr=0x80200000
212 To test 32-bit U-Boot images, switch to use qemu-riscv32_smode_defconfig and
213 riscv32_spl_defconfig builds, and replace ``qemu-system-riscv64`` with
214 ``qemu-system-riscv32`` in the command lines above to boot the 32-bit U-Boot.
217 ------------
223 .. code-block:: bash
225 $ swtpm socket --tpm2 -t -d --tpmstate dir=/tmp/tpm \
226 --ctrl type=unixio,path=swtpm-sock
230 .. code-block:: bash
232 $ qemu-system-riscv64 \
234 -chardev socket,id=chrtpm,path=swtpm-sock \
235 -tpmdev emulator,id=tpm0,chardev=chrtpm \
236 -device tpm-tis-device,tpmdev=tpm0