Skip to content

Commit 80ce9f4

Browse files
committed
boot-qemu.py: Add support for riscv
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 521125e commit 80ce9f4

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

boot-qemu.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
'ppc32_mac',
2929
'ppc64',
3030
'ppc64le',
31+
'riscv',
3132
'x86',
3233
'x86_64',
3334
]
@@ -558,6 +559,26 @@ def __init__(self):
558559
self._ram = '2G'
559560

560561

562+
class RISCVQEMURunner(QEMURunner):
563+
564+
def __init__(self):
565+
super().__init__()
566+
567+
self.cmdline.append('earlycon')
568+
self._default_kernel_path = Path('arch/riscv/boot/Image')
569+
self._initrd_arch = 'riscv'
570+
self._qemu_arch = 'riscv64'
571+
572+
deb_bios = '/usr/lib/riscv64-linux-gnu/opensbi/qemu/virt/fw_jump.elf'
573+
if 'BIOS' in os.environ:
574+
bios = os.environ['BIOS']
575+
elif Path(deb_bios).exists():
576+
bios = deb_bios
577+
else:
578+
bios = 'default'
579+
self._qemu_args += ['-bios', bios, '-M', 'virt']
580+
581+
561582
class X86QEMURunner(QEMURunner):
562583

563584
def __init__(self):
@@ -688,6 +709,7 @@ def parse_arguments():
688709
'ppc32_mac': PowerPC32MacQEMURunner,
689710
'ppc64': PowerPC64QEMURunner,
690711
'ppc64le': PowerPC64LEQEMURunner,
712+
'riscv': RISCVQEMURunner,
691713
'x86': X86QEMURunner,
692714
'x86_64': X8664QEMURunner,
693715
}

0 commit comments

Comments
 (0)