Click here to Skip to main content
15,910,303 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: The perfect cat video has finally been created Pin
Gary Wheeler21-May-24 0:50
Gary Wheeler21-May-24 0:50 
GeneralRe: The perfect cat video has finally been created Pin
Ed Attfield21-May-24 3:37
Ed Attfield21-May-24 3:37 
JokeRe: The perfect cat video has finally been created Pin
Nelek21-May-24 4:13
protectorNelek21-May-24 4:13 
GeneralRe: The perfect cat video has finally been created Pin
dandy7222-May-24 3:23
dandy7222-May-24 3:23 
GeneralRe: The perfect cat video has finally been created Pin
David O'Neil22-May-24 13:23
professionalDavid O'Neil22-May-24 13:23 
GeneralAssembly: One of those things I keep on trying Pin
raddevus19-May-24 6:37
mvaraddevus19-May-24 6:37 
GeneralRe: Assembly: One of those things I keep on trying Pin
honey the codewitch19-May-24 7:48
mvahoney the codewitch19-May-24 7:48 
GeneralRe: Assembly: One of those things I keep on trying Pin
raddevus19-May-24 9:37
mvaraddevus19-May-24 9:37 
honey the codewitch wrote:
I gave up. QEMU refused to operate in any of my environments. I tried several guides, and nada. Mad | :mad:

I felt the same way yesterday. I had spent all day yesterday and could not find any help or get it working.

It was a real pain. I even asked Copilot to help me but it wasn't helpful.

I finally got it working because I found that blog site (mentioned in original post).
I got very lucky.

I really had no idea what I was doing.

Even the blog site had so much information that I barely made it through it.

But, here's the deal.

First of all make sure you've installed QEMU properly on your dev machine:
$ sudo apt install qemu-system-riscv64
$ sudo apt install u-boot-qemu opensbi

After that, all I had to do was:
1) run this command to download a debian image:
$ wget "https://gitlab.com/api/v4/projects/giomasce%2Fdqib/jobs/artifacts/master/download?job=convert_riscv64-virt" -O debian-rv64.zip

2) Then follow these commands:
$ mkdir debian-rv64
$ cd debian-rv64
$ unzip ../debian-rv64.zip
$ cd artifacts
NOTE: That last step was wrong bec the directory that gets unzipped is not named artifacts but is named something else.

Inside that "artifacts" directory, there is a readme.txt.
I ignored the rest of the blog author's instructions and followed that readme.

There is a command in there for how to start it:
Note: Edited command because I had line breaks incorrect
qemu-system-riscv64 -machine 'virt' -cpu 'rv64' -m 1G -device virtio-blk-device,drive=hd -drive file=image.qcow2,if=none,id=hd -device virtio-net-device,netdev=net -netdev user,id=net,hostfwd=tcp::2222-:22 -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf -object rng-random,filename=/dev/urandom,id=rng -device virtio-rng-device,rng=rng -nographic -append "root=LABEL=rootfs console=ttyS0"


3rd Edit - With Line Breaks For Easier Reading (tested & it works)

qemu-system-riscv64 -machine 'virt' \
	-cpu 'rv64' \
	-m 1G -device virtio-blk-device,drive=hd \
	 -drive file=image.qcow2,if=none,id=hd \
	 -device virtio-net-device,netdev=net \
	 -netdev user,id=net,hostfwd=tcp::2222-:22 \
	 -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \
	-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \
	 -object rng-random,filename=/dev/urandom,id=rng \
	 -device virtio-rng-device,rng=rng \
	-nographic \
	-append "root=LABEL=rootfs console=ttyS0"


That's it. Once I ran that command I had my RISC-V environment running.
It's running right now.
I had to install the build-essential package and I was able to compile, build, link via as and ld

Cannot believe I got it going.

I hope these steps might help you some time too. Smile | :)

modified 19-May-24 16:00pm.

GeneralRe: Assembly: One of those things I keep on trying Pin
honey the codewitch19-May-24 14:08
mvahoney the codewitch19-May-24 14:08 
GeneralRe: Assembly: One of those things I keep on trying Pin
Matt Bond20-May-24 5:46
Matt Bond20-May-24 5:46 
GeneralRe: Assembly: One of those things I keep on trying Pin
raddevus28-May-24 10:46
mvaraddevus28-May-24 10:46 
GeneralRe: Assembly: One of those things I keep on trying Pin
raddevus19-May-24 11:11
mvaraddevus19-May-24 11:11 
GeneralRe: Assembly: One of those things I keep on trying Pin
obermd19-May-24 10:02
obermd19-May-24 10:02 
GeneralRe: Assembly: One of those things I keep on trying Pin
raddevus19-May-24 10:13
mvaraddevus19-May-24 10:13 
GeneralRe: Assembly: One of those things I keep on trying Pin
trønderen19-May-24 12:48
trønderen19-May-24 12:48 
GeneralRe: Assembly: One of those things I keep on trying Pin
raddevus19-May-24 13:18
mvaraddevus19-May-24 13:18 
GeneralRe: Assembly: One of those things I keep on trying Pin
obermd19-May-24 16:38
obermd19-May-24 16:38 
GeneralRe: Assembly: One of those things I keep on trying Pin
pkfox19-May-24 10:16
professionalpkfox19-May-24 10:16 
GeneralRe: Assembly: One of those things I keep on trying Pin
Nelek19-May-24 10:18
protectorNelek19-May-24 10:18 
GeneralRe: Assembly: One of those things I keep on trying Pin
CPallini20-May-24 1:36
mveCPallini20-May-24 1:36 
GeneralRe: Assembly: One of those things I keep on trying Pin
den2k8820-May-24 21:31
professionalden2k8820-May-24 21:31 
GeneralRe: Assembly: One of those things I keep on trying Pin
trønderen21-May-24 3:21
trønderen21-May-24 3:21 
GeneralRe: Assembly: One of those things I keep on trying Pin
den2k8821-May-24 4:07
professionalden2k8821-May-24 4:07 
GeneralFluent Api in Pascal, nothing earth-shattering ... Pin
0x01AA19-May-24 4:18
mve0x01AA19-May-24 4:18 
GeneralRe: Fluent Api in Pascal, nothing earth-shattering ... Pin
Mike Hankey19-May-24 4:49
mveMike Hankey19-May-24 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.