riscvarchive / riscv-qemu

QEMU with RISC-V (RV64G, RV32G) Emulation Support
384 stars 154 forks source link

qemu-system-riscv64: -machine virt: unsupported machine type #171

Closed leeehui closed 5 years ago

leeehui commented 5 years ago

Hi, I compile riscv-qemu as described in Wiki page

git clone --recursive https://github.com/riscv/riscv-qemu.git cd riscv-qemu ./configure \ --target-list=riscv64-softmmu,riscv32-softmmu,riscv64-linux-user,riscv32-linux-user make -j$(nproc) make install

however, when I try to find supported machine type, the output of "qemu-system-riscv64 -machine help" is: Supported machines are: none empty machine sifive RISC-V Board compatible with SiFive U500 SDK (incomplete) spike RISC-V Generic Board (matching 'Spike') (default)

why can't I see the "supported machine spike_v1.9.1 sifive_e sifine_u virt ...." as described in Wiki page? thanks in advance.

michaeljclark commented 5 years ago

I think you have an older version of QEMU in your path. can you try:

which qemu-system-riscv64

The default install path is /usr/local/bin. You can use --prefix argument to configure to override this e.g.

./configure --prefix=/opt/riscv \

 --target-list=riscv64-softmmu,riscv32-softmmu,riscv64-linux-user,riscv32-linux-user

and then set your PATH environment variable so that the newly installed QEMU path is first:

export PATH=/opt/riscv/bin:${PATH}
leeehui commented 5 years ago

Hi, @michaeljclark qemu-system-riscv64 does locate under /usr/local/bin as I use the default --prefix

what I can confirm is the binay file qemu-system-riscv64 is up-to-date according to the time I compile

btw, I tried your method by using ./configure --prefix=/opt/riscv --target-list=riscv64-softmmu,
same result

jim-wilson commented 5 years ago

What does "qemu-system-riscv64 --version" say? For a tree updated last month, I get for instance

gamma05:2016$ ./qemu --version QEMU emulator version 2.12.92 (v3.0.0-rc2-85-g2d264d6-dirty) Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers gamma05:2017$

leeehui commented 5 years ago

hi,jim sorry,it is my fault,this is misunderstand of git operation, I made the mistake for not carefully checking the source and binary version. I get the source according to the riscv-gnu-toolchain page , and I did not notice the risv-qemu version referred is a year ago. thanks for you remind. btw, I just confused why the riscv-gnu-toolchain is using risv-qemu a year ago? can we update it to newer version so that some careless guy like me will not suffer this problem?

jim-wilson commented 5 years ago

Glibc is only half-upstream. The 64-bit support is upstream, the 32-bit support is not. The 32-bit support currently only exists in the old obsolete tree that is the riscv-glibc tree. This glibc tree does not work with current qemu because of ABI changes made when the 64-bit support was upstreamed. So in order to continue to test both 32-bit and 64-bit gcc support, I must use an old obsolete qemu.

We are in the process of trying to upstream the 32-bit glibc support now, thanks to help from Andes which is doing a lot of the work. When the 32-bit glibc support gets upstreamed, we can update riscv-glibc to use a copy of the FSF tree, and then we can update to the current qemu version. Probably a lot of stuff will break when that happens, and a lot of issues will need to be sorted out, which could take some time.

We still have the problem that we have two gdb ports, one in the upstream tree, and one in riscv-binutils-gdb, which are different ports with different feature sets. That problem still needs to be worked out.