mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 13:05:03 +08:00
3c4fc7bf4c
When running a RISC-V test kernel under QEMU, we need an OpenSBI BIOS
file. In the original QEMU support patchset, kunit_tool would optionally
download this file from GitHub if it didn't exist, using wget.
These days, it can usually be found in the distro's qemu-system-riscv
package, and is located in /usr/share/qemu on all the distros I tried
(Debian, Arch, OpenSUSE). Use this file, and thereby don't do any
downloading in kunit_tool.
In addition, we used to shell out to whatever 'wget' was in the path,
which could have potentially been used to trick the developer into
running another binary. By not using wget at all, we nicely sidestep
this issue.
Cc: Xu Panda <xu.panda@zte.com.cn>
Fixes: 87c9c16317
("kunit: tool: add support for QEMU")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: David Gow <davidgow@google.com>
Tested-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
29 lines
856 B
Python
29 lines
856 B
Python
from ..qemu_config import QemuArchParams
|
|
import os
|
|
import os.path
|
|
import sys
|
|
|
|
OPENSBI_FILE = 'opensbi-riscv64-generic-fw_dynamic.bin'
|
|
OPENSBI_PATH = '/usr/share/qemu/' + OPENSBI_FILE
|
|
|
|
if not os.path.isfile(OPENSBI_PATH):
|
|
print('\n\nOpenSBI bios was not found in "' + OPENSBI_PATH + '".\n'
|
|
'Please ensure that qemu-system-riscv is installed, or edit the path in "qemu_configs/riscv.py"\n')
|
|
sys.exit()
|
|
|
|
QEMU_ARCH = QemuArchParams(linux_arch='riscv',
|
|
kconfig='''
|
|
CONFIG_SOC_VIRT=y
|
|
CONFIG_SERIAL_8250=y
|
|
CONFIG_SERIAL_8250_CONSOLE=y
|
|
CONFIG_SERIAL_OF_PLATFORM=y
|
|
CONFIG_RISCV_SBI_V01=y
|
|
CONFIG_SERIAL_EARLYCON_RISCV_SBI=y''',
|
|
qemu_arch='riscv64',
|
|
kernel_path='arch/riscv/boot/Image',
|
|
kernel_command_line='console=ttyS0',
|
|
extra_qemu_params=[
|
|
'-machine', 'virt',
|
|
'-cpu', 'rv64',
|
|
'-bios', OPENSBI_PATH])
|