Documentation/Platforms/RISCV: Difference between revisions
(Add youtube video on Risc-V support on QEMU) |
(Update instructions) |
||
Line 11: | Line 11: | ||
== Booting Linux == | == Booting Linux == | ||
=== Booting 64-bit Fedora === | |||
Download the [https://fedorapeople.org/groups/risc-v/disk-images/ Fedora disk images] | Download the [https://fedorapeople.org/groups/risc-v/disk-images/ Fedora disk images] | ||
Decompress the disk image: | Decompress the disk image: | ||
Line 32: | Line 33: | ||
* Login: root | * Login: root | ||
* Password: riscv | * Password: riscv | ||
=== Booting 32-bit OpenEmbedded Images === | |||
Follow the usual OpenEmbedded build flow using meta-riscv to build for the qemuriscv32 machine. More details on doing this can be found here: https://github.com/riscv/meta-riscv/#build-image | |||
Once the images are build you can boot them using: | |||
qemu-system-riscv32 \ | |||
-device loader,file=./tmp-glibc/deploy/images/qemuriscv32/Image,addr=0x80400000 \ | |||
-device virtio-net-device,netdev=net0 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23 \ | |||
-drive id=disk0,file=./tmp-glibc/deploy/images/qemuriscv64/core-image-minimal-qemuriscv32.ext4,if=none,format=raw \ | |||
-device virtio-blk-device,drive=disk0 \ | |||
-object rng-random,filename=/dev/urandom,id=rng0 \ | |||
-device virtio-rng-device,rng=rng0 \ | |||
-kernel ./tmp-glibc/deploy/images/qemuriscv32/Image \ | |||
-append 'root=/dev/vda rw highres=off console=ttyS0 mem=512M ip=dhcp earlycon=sbi ' \ | |||
-show-cursor -nographic -machine virt -m 512 -serial mon:stdio -serial null | |||
The above command will open up SSH and telnet ports which can be used to communicate with the guest. It will also pass in host entropy to the guest, allowing entropy to be available on boot. | |||
NOTE: When using OpenEmbedded it is recommended to use the runqemu script to boot QEMU. It will dynamically handle display options as well as advanced networking | |||
=== Booting 64-bit OpenEmbedded Images === | |||
Follow the usual OpenEmbedded build flow using meta-riscv to build for the qemuriscv64 machine. More details on doing this can be found here: https://github.com/riscv/meta-riscv/#build-image | |||
Once the images are build you can boot them using: | |||
qemu-system-riscv64 \ | |||
-device loader,file=./tmp-glibc/deploy/images/qemuriscv64/Image,addr=0x80200000 \ | |||
-device virtio-net-device,netdev=net0 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23 \ | |||
-drive id=disk0,file=./tmp-glibc/deploy/images/qemuriscv64/core-image-minimal-qemuriscv64.ext4,if=none,format=raw \ | |||
-device virtio-blk-device,drive=disk0 \ | |||
-object rng-random,filename=/dev/urandom,id=rng0 \ | |||
-device virtio-rng-device,rng=rng0 \ | |||
-kernel ./tmp-glibc/deploy/images/qemuriscv64/Image \ | |||
-append 'root=/dev/vda rw highres=off console=ttyS0 mem=512M ip=dhcp earlycon=sbi ' \ | |||
-show-cursor -nographic -machine virt -m 512 -serial mon:stdio -serial null | |||
The above command will open up SSH and telnet ports which can be used to communicate with the guest. It will also pass in host entropy to the guest, allowing entropy to be available on boot. | |||
NOTE: When using OpenEmbedded it is recommended to use the runqemu script to boot QEMU. It will dynamically handle display options as well as advanced networking | |||
=== Booting 32-bit Buildroot Images === | |||
Clone the Buildroot source code and cd into the directory. | |||
Generate the default config: | |||
make qemu_riscv32_virt_defconfig | |||
Build the images | |||
make | |||
Boot the images: | |||
qemu-system-riscv32 \ | |||
-M virt -nographic \ | |||
-kernel output/images/fw_jump.elf \ | |||
-device loader,file=output/images/Image,addr=0x80400000 \ | |||
-append "root=/dev/vda ro" \ | |||
-drive file=output/images/rootfs.ext2,format=raw,id=hd0 \ | |||
-device virtio-blk-device,drive=hd0 \ | |||
-netdev user,id=net0 -device virtio-net-device,netdev=net0 | |||
=== Booting 64-bit Buildroot Images === | |||
Clone the Buildroot source code and cd into the directory. | |||
Generate the default config: | |||
make qemu_riscv64_virt_defconfig | |||
Build the images | |||
make | |||
Boot the images: | |||
qemu-system-riscv64 \ | |||
-M virt -nographic \ | |||
-kernel output/images/fw_jump.elf \ | |||
-device loader,file=output/images/Image,addr=0x80200000 \ | |||
-append "root=/dev/vda ro" \ | |||
-drive file=output/images/rootfs.ext2,format=raw,id=hd0 \ | |||
-device virtio-blk-device,drive=hd0 \ | |||
-netdev user,id=net0 -device virtio-net-device,netdev=net0 | |||
== Links == | == Links == | ||
* [https://fedoraproject.org/wiki/Architectures/RISC-V Fedora RISC-V wiki] | * [https://fedoraproject.org/wiki/Architectures/RISC-V Fedora RISC-V wiki] | ||
* [https://github.com/riscv/meta-riscv/ OpenEmbedded meta-riscv] | |||
* [https://www.youtube.com/watch?v=b5g8u3GA-lo Video: QEMU Support for the RISC-V Instruction Set Architecture] | * [https://www.youtube.com/watch?v=b5g8u3GA-lo Video: QEMU Support for the RISC-V Instruction Set Architecture] | ||
== Contacts == | == Contacts == | ||
Maintainers: | Maintainers: | ||
*[mailto:palmer@sifive.com Palmer Dabbelt] | *[mailto:palmer@sifive.com Palmer Dabbelt] | ||
*[mailto:alistair.francis@wdc.com Alistair Francis] | |||
*[mailto:sagark@eecs.berkeley.edu Sagar Karandikar] | *[mailto:sagark@eecs.berkeley.edu Sagar Karandikar] | ||
*[mailto:kbastian@mail.uni-paderborn.de Bastian Koppelmann] | *[mailto:kbastian@mail.uni-paderborn.de Bastian Koppelmann] |
Revision as of 00:08, 27 March 2019
Description
RISC-V is an open source instruction set. It is a modular with only a small set of mandatory instructions. Every other module might be implemented by vendors allowing RISC-V to be suitable for small embended systems up to large supercomputers.
Build Directions
For RV64GC:
./configure --target-list=riscv64-softmmu && make
For RV32GC:
./configure --target-list=riscv32-softmmu && make
Booting Linux
Booting 64-bit Fedora
Download the Fedora disk images Decompress the disk image:
xzdec -d stage4-disk.img.xz > stage4-disk.img
Boot linux using RV64GC qemu:
qemu-system-riscv64 \ -nographic \ -machine virt \ -smp 4 \ -m 2G \ -kernel bbl \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-device,rng=rng0 \ -append "console=ttyS0 ro root=/dev/vda" \ -device virtio-blk-device,drive=hd0 \ -drive file=stage4-disk.img,format=raw,id=hd0 \ -device virtio-net-device,netdev=usernet \ -netdev user,id=usernet,hostfwd=tcp::10000-:22
- Login: root
- Password: riscv
Booting 32-bit OpenEmbedded Images
Follow the usual OpenEmbedded build flow using meta-riscv to build for the qemuriscv32 machine. More details on doing this can be found here: https://github.com/riscv/meta-riscv/#build-image
Once the images are build you can boot them using:
qemu-system-riscv32 \ -device loader,file=./tmp-glibc/deploy/images/qemuriscv32/Image,addr=0x80400000 \ -device virtio-net-device,netdev=net0 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23 \ -drive id=disk0,file=./tmp-glibc/deploy/images/qemuriscv64/core-image-minimal-qemuriscv32.ext4,if=none,format=raw \ -device virtio-blk-device,drive=disk0 \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-device,rng=rng0 \ -kernel ./tmp-glibc/deploy/images/qemuriscv32/Image \ -append 'root=/dev/vda rw highres=off console=ttyS0 mem=512M ip=dhcp earlycon=sbi ' \ -show-cursor -nographic -machine virt -m 512 -serial mon:stdio -serial null
The above command will open up SSH and telnet ports which can be used to communicate with the guest. It will also pass in host entropy to the guest, allowing entropy to be available on boot.
NOTE: When using OpenEmbedded it is recommended to use the runqemu script to boot QEMU. It will dynamically handle display options as well as advanced networking
Booting 64-bit OpenEmbedded Images
Follow the usual OpenEmbedded build flow using meta-riscv to build for the qemuriscv64 machine. More details on doing this can be found here: https://github.com/riscv/meta-riscv/#build-image
Once the images are build you can boot them using:
qemu-system-riscv64 \ -device loader,file=./tmp-glibc/deploy/images/qemuriscv64/Image,addr=0x80200000 \ -device virtio-net-device,netdev=net0 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23 \ -drive id=disk0,file=./tmp-glibc/deploy/images/qemuriscv64/core-image-minimal-qemuriscv64.ext4,if=none,format=raw \ -device virtio-blk-device,drive=disk0 \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-device,rng=rng0 \ -kernel ./tmp-glibc/deploy/images/qemuriscv64/Image \ -append 'root=/dev/vda rw highres=off console=ttyS0 mem=512M ip=dhcp earlycon=sbi ' \ -show-cursor -nographic -machine virt -m 512 -serial mon:stdio -serial null
The above command will open up SSH and telnet ports which can be used to communicate with the guest. It will also pass in host entropy to the guest, allowing entropy to be available on boot.
NOTE: When using OpenEmbedded it is recommended to use the runqemu script to boot QEMU. It will dynamically handle display options as well as advanced networking
Booting 32-bit Buildroot Images
Clone the Buildroot source code and cd into the directory.
Generate the default config:
make qemu_riscv32_virt_defconfig
Build the images
make
Boot the images:
qemu-system-riscv32 \ -M virt -nographic \ -kernel output/images/fw_jump.elf \ -device loader,file=output/images/Image,addr=0x80400000 \ -append "root=/dev/vda ro" \ -drive file=output/images/rootfs.ext2,format=raw,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -netdev user,id=net0 -device virtio-net-device,netdev=net0
Booting 64-bit Buildroot Images
Clone the Buildroot source code and cd into the directory.
Generate the default config:
make qemu_riscv64_virt_defconfig
Build the images
make
Boot the images:
qemu-system-riscv64 \ -M virt -nographic \ -kernel output/images/fw_jump.elf \ -device loader,file=output/images/Image,addr=0x80200000 \ -append "root=/dev/vda ro" \ -drive file=output/images/rootfs.ext2,format=raw,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -netdev user,id=net0 -device virtio-net-device,netdev=net0
Links
- Fedora RISC-V wiki
- OpenEmbedded meta-riscv
- Video: QEMU Support for the RISC-V Instruction Set Architecture
Contacts
Maintainers: