1from ..qemu_config import QemuArchParams 2import os 3import os.path 4import sys 5 6GITHUB_OPENSBI_URL = 'https://github.com/qemu/qemu/raw/master/pc-bios/opensbi-riscv64-generic-fw_dynamic.bin' 7OPENSBI_FILE = os.path.basename(GITHUB_OPENSBI_URL) 8 9if not os.path.isfile(OPENSBI_FILE): 10 print('\n\nOpenSBI file is not in the current working directory.\n' 11 'Would you like me to download it for you from:\n' + GITHUB_OPENSBI_URL + ' ?\n') 12 response = input('yes/[no]: ') 13 if response.strip() == 'yes': 14 os.system('wget ' + GITHUB_OPENSBI_URL) 15 else: 16 sys.exit() 17 18QEMU_ARCH = QemuArchParams(linux_arch='riscv', 19 kconfig=''' 20CONFIG_SOC_VIRT=y 21CONFIG_SERIAL_8250=y 22CONFIG_SERIAL_8250_CONSOLE=y 23CONFIG_SERIAL_OF_PLATFORM=y 24CONFIG_RISCV_SBI_V01=y 25CONFIG_SERIAL_EARLYCON_RISCV_SBI=y''', 26 qemu_arch='riscv64', 27 kernel_path='arch/riscv/boot/Image', 28 kernel_command_line='console=ttyS0', 29 extra_qemu_params=[ 30 '-machine', 'virt', 31 '-cpu', 'rv64', 32 '-bios', 'opensbi-riscv64-generic-fw_dynamic.bin']) 33