1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-07 16:59:22 +00:00

qemuriscv64: Add the QEMU RISC-V 64-bit machine

The include is split ready to add the 32-bit RISC-V machine as soon as
glibc supports 32-bit RISC-V.

This is based on the work in the meta-riscv layer, thanks to Khem for
starting this.

(From OE-Core rev: 11b6020dff4550fc3a42e04bc1e86baf37942c62)

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alistair Francis
2019-06-18 17:55:41 -07:00
committed by Richard Purdie
parent ef82d0230e
commit aad4228593
4 changed files with 85 additions and 0 deletions
@@ -0,0 +1,10 @@
# RISCV Architecture definition
DEFAULTTUNE ?= "riscv64"
TUNE_ARCH = "${TUNE_ARCH_tune-${DEFAULTTUNE}}"
TUNE_PKGARCH = "${TUNE_PKGARCH_tune-${DEFAULTTUNE}}"
TUNE_CCARGS .= ""
# QEMU usermode fails with invalid instruction error (For riscv32)
MACHINE_FEATURES_BACKFILL_CONSIDERED_append = "${@bb.utils.contains('TUNE_FEATURES', 'riscv32', ' qemu-usermode', '', d)}"
@@ -0,0 +1,45 @@
PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
require conf/machine/include/qemu.inc
require conf/machine/include/riscv/tune-riscv.inc
MACHINE_FEATURES = "screen keyboard ext2 ext3 serial"
KERNEL_IMAGETYPE = "Image"
SERIAL_CONSOLES ?= "115200;ttyS0 115200;hvc0"
IMAGE_FSTYPES_append = " ext4"
MACHINE_EXTRA_RRECOMMENDS += " kernel-modules"
EXTRA_IMAGEDEPENDS += "opensbi"
RISCV_SBI_PLAT ?= "qemu/virt"
RISCV_SBI_PAYLOAD ?= "${KERNEL_IMAGETYPE}-${MACHINE}.bin"
# qemuboot options
QB_KERNEL_CMDLINE_APPEND = "earlycon=sbi"
QB_MEM = "-m 512"
QB_MACHINE = "-machine virt"
QB_DEFAULT_KERNEL = "fw_jump.elf"
QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@"
QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
QB_TCPSERIAL_OPT = " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
QB_OPT_APPEND = " -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0"
BAD_RECOMMENDATIONS += "\
libcxx-dev \
libcxx-staticdev \
compiler-rt-dev \
compiler-rt-staticdev \
"
ASSUME_PROVIDED += "\
libcxx-dev \
libcxx-staticdev \
compiler-rt-dev \
compiler-rt-staticdev \
"
@@ -0,0 +1,19 @@
require conf/machine/include/riscv/arch-riscv.inc
TUNEVALID[riscv64] = "Enable 64-bit RISC-V optimizations"
TUNEVALID[riscv32] = "Enable 32-bit RISC-V optimizations"
TUNEVALID[littleendian] = "Little endian mode"
AVAILTUNES += "riscv64 riscv32"
TUNE_FEATURES_tune-riscv64 = "riscv64 littleendian"
TUNE_ARCH_tune-riscv64 = "riscv64"
TUNE_PKGARCH_tune-riscv64 = "riscv64"
PACKAGE_EXTRA_ARCHS_tune-riscv64 = "riscv64"
TUNE_FEATURES_tune-riscv32 = "riscv32 littleendian"
TUNE_ARCH_tune-riscv32 = "riscv32"
TUNE_PKGARCH_tune-riscv32 = "riscv32"
PACKAGE_EXTRA_ARCHS_tune-riscv32 = "riscv32"
+11
View File
@@ -0,0 +1,11 @@
#@TYPE: Machine
#@NAME: generic riscv64 machine
#@DESCRIPTION: Machine configuration for running a generic riscv64
require conf/machine/include/riscv/qemuriscv.inc
QB_OPT_APPEND = "-show-cursor -monitor null -device loader,file=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE},addr=0x80200000"
EXTRA_IMAGEDEPENDS += "u-boot"
UBOOT_MACHINE = "qemu-riscv64_defconfig"
UBOOT_ELF = "u-boot"