xref: /linux/tools/testing/kunit/qemu_configs/riscv.py (revision e7d759f31ca295d589f7420719c311870bb3166f)
1from ..qemu_config import QemuArchParams
2import os
3import os.path
4import sys
5
6OPENSBI_FILE = 'opensbi-riscv64-generic-fw_dynamic.bin'
7OPENSBI_PATH = '/usr/share/qemu/' + OPENSBI_FILE
8
9if not os.path.isfile(OPENSBI_PATH):
10	print('\n\nOpenSBI bios was not found in "' + OPENSBI_PATH + '".\n'
11	      'Please ensure that qemu-system-riscv is installed, or edit the path in "qemu_configs/riscv.py"\n')
12	sys.exit()
13
14QEMU_ARCH = QemuArchParams(linux_arch='riscv',
15			   kconfig='''
16CONFIG_SOC_VIRT=y
17CONFIG_SERIAL_8250=y
18CONFIG_SERIAL_8250_CONSOLE=y
19CONFIG_SERIAL_OF_PLATFORM=y
20CONFIG_RISCV_SBI_V01=y
21CONFIG_SERIAL_EARLYCON_RISCV_SBI=y''',
22			   qemu_arch='riscv64',
23			   kernel_path='arch/riscv/boot/Image',
24			   kernel_command_line='console=ttyS0',
25			   extra_qemu_params=[
26					   '-machine', 'virt',
27					   '-cpu', 'rv64',
28					   '-bios', OPENSBI_PATH])
29