Linux/Virtualization Development for RISC-V

414 views
Skip to first unread message

Bharat Bhushan

unread,
Feb 12, 2018, 10:58:26 PM2/12/18
to sw-...@groups.riscv.org
Hi All,

I am interested in Linux, KVM/QEMU development for RISC-V. Can someone
guild be to startup guide, which includes latest development
environment (toolchain, qemu or model), pre-built images and build
environment.

Thanks
-Bharat

--
-Bharat

Michael Clark

unread,
Feb 13, 2018, 12:28:16 AM2/13/18
to Bharat Bhushan, RISC-V SW Dev


> On 13/02/2018, at 4:58 PM, Bharat Bhushan <bharat...@gmail.com> wrote:
>
> Hi All,
>
> I am interested in Linux, KVM/QEMU development for RISC-V. Can someone
> guild be to startup guide, which includes latest development
> environment (toolchain, qemu or model), pre-built images and build
> environment.

You could start with the wiki:

- https://github.com/riscv/riscv-qemu/wiki

or this blog post:

- https://www.sifive.com/blog/2017/12/20/risc-v-qemu-part-1-privileged-isa-hifive1-virtio/

riscv-qemu doesn’t yet implement the Draft RISC-V Hypervisor specification, however, when it or another emulator implements the Hypervisor spec, it will become possible to implement kvm in riscv-linux. There is plenty of development work that needs to be done in riscv-qemu so let me know if you want more pointers.

Presently, most folk are running riscv-qemu on x86 hosts, but with the HiFive Unleashed, it is theoretically possible to implement the H mode specification using trap and emulate and run riscv-qemu riscv virtual machines accelerated on a riscv-linux host:

- https://www.sifive.com/products/hifive-unleashed/

In the meantime, you’re best bet is to build the riscv-gnu-toolchain for linux, then checkout and build riscv-linux, riscv-pk (using linux as the payload), and riscv-qemu.

There are scripts to build qemu and a root image in the Freedom U SDK

- https://github.com/sifive/freedom-u-sdk/

However you might want to pull in the latest qemu branch if you want to track current development:

- https://github.com/riscv/riscv-qemu/tree/qemu-upstream-v5

Michael.

atish patra

unread,
Feb 13, 2018, 2:19:42 AM2/13/18
to Michael Clark, Bharat Bhushan, RISC-V SW Dev
Thanks Michael for the detailed list. I found freedom-u-sdk particularly helpful to start with.
It has one script that install all the required tools chains and boots linux with qemu without any issues.


--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/C9629A99-DDAE-4221-876C-D36456676FA2%40sifive.com.



--
Regards,
Atish

David H. Lynch Jr.

unread,
Feb 13, 2018, 3:38:28 AM2/13/18
to Bharat Bhushan, sw-...@groups.riscv.org
There are several tools to "virtualize" the RISC-V on other systems.

Most of these can be found under
https://github.com/riscv

These would include
angel which is a javascript/web risc-v simulator
spike which as I understand is sort of the "reference platform" for
RISC-V - if hardware behaves differently than spike, the hardware is
wrong. Atleast that is how I understand it.
and qemu.

I have been building.using each of these over the past couple of weeks
on an x86-64 running linux, simulating a RISC-V64.
That all seems to work well. spike and qemu will currently boot linux,
or run linux applications directly using linux system call emulation.

I have personally been more interested in RISC-V32. That does not work
out of the box at the moment.
But the changes necescary are to Makefiles or config files.
At this time I have been able to get RISC-V32 linux applications
(atleast hello world) running with both spike and qemu.
I am working to get linux itself booting with spike and qemu.
I do not have that working for me yet.

I started using the freedom-u-sdk - which can be found on sifive's
site. But that appears to just be mostly a git project of projects,
and is just pulls most of the risc-v repositories from github. 

I have also built the peices using individual repositories and
instructions on github.
There are a small number of errors or things that are out of date in
the README.md's on github. As an example the current linux is 4.15 not
3.4


Anyway that is what I know for the moment.
Hopefully that is useful to you.

Others here can correct my errors or expand on anything I have said.

David H. Lynch Jr.

unread,
Feb 13, 2018, 3:47:02 AM2/13/18
to atish patra, Michael Clark, Bharat Bhushan, RISC-V SW Dev
freedom-u-sdk needs about half a dozen patches to make files to build for 32bits.

I will try to see if I can put them into the form of a useable patch.
But I have to adjust my changes so they work both ways as I really only care about RISC-V32
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.

To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
Reply all
Reply to author
Forward
0 new messages