[oe-commits] [openembedded-core] 14/24: qemuriscv64: Add the QEMU RISC-V 64-bit machine

git at git.openembedded.org git at git.openembedded.org
Wed Jun 19 12:16:34 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 11b6020dff4550fc3a42e04bc1e86baf37942c62
Author: Alistair Francis <alistair.francis at wdc.com>
AuthorDate: Tue Jun 18 17:55:41 2019 -0700

    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.
    
    Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/conf/machine/include/riscv/arch-riscv.inc | 10 ++++++
 meta/conf/machine/include/riscv/qemuriscv.inc  | 45 ++++++++++++++++++++++++++
 meta/conf/machine/include/riscv/tune-riscv.inc | 19 +++++++++++
 meta/conf/machine/qemuriscv64.conf             | 11 +++++++
 4 files changed, 85 insertions(+)

diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc
new file mode 100644
index 0000000..19f8f3e
--- /dev/null
+++ b/meta/conf/machine/include/riscv/arch-riscv.inc
@@ -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)}"
diff --git a/meta/conf/machine/include/riscv/qemuriscv.inc b/meta/conf/machine/include/riscv/qemuriscv.inc
new file mode 100644
index 0000000..aa1eba7
--- /dev/null
+++ b/meta/conf/machine/include/riscv/qemuriscv.inc
@@ -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 \
+"
diff --git a/meta/conf/machine/include/riscv/tune-riscv.inc b/meta/conf/machine/include/riscv/tune-riscv.inc
new file mode 100644
index 0000000..1e3a108
--- /dev/null
+++ b/meta/conf/machine/include/riscv/tune-riscv.inc
@@ -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"
+
diff --git a/meta/conf/machine/qemuriscv64.conf b/meta/conf/machine/qemuriscv64.conf
new file mode 100644
index 0000000..f1be7b8a
--- /dev/null
+++ b/meta/conf/machine/qemuriscv64.conf
@@ -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"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list