-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instruction how to run Linux #57
Comments
As about firmware, the generic OpenSBI works fine. You may download prebuilt binaries from their Releases repo section. The fw_jump.bin bootrom is used to boot into the SBI payload (S-mode kernel like Linux or U-Boot). After that, you have a bunch of choices for both kernel and userland
Here is my personal Linux build config for RV64: linux_6.0_rv64_config.txt Here is a built kernel Image from that config: linux_6.0.zip Be aware this build incorporates out-of-tree fixes which apparently no one in the mailing list wants to merge... See my rant here: https://lore.kernel.org/all/76741e1c-056d-d3ae-fc20-eeb8f6e996f6@gmail.com/, etc, but you probably shouldn't care about that Btw, there is a nice OpenSBI fork called OpenSBI-H which introduces Hypervisor extension support to platforms that don't have any hardware support for it. This allows running KVM inside RVVM guests, for example, but this is really experimental and I'm afraid not going to upstream OpenSBI. If you have any other questions, I'll gladly help. |
My usual approach to booting a distro with my custom kernel:
This is of course really simplified, dumb, does not reflect the boot flow of real RISC-V boards, but that's easy to get working and see in action. As for more proficient users, they may use SBI->U-Boot->GRUB->Linux - whatever, I'm not very good at explaining that, but it sure will work as well. |
Can I close this issue? Should I add more info to README perhaps, since that already covers some basics on starting up machines? |
The best would be an instruction how to run Linux in RVVM with using only released binaries and without building/patching anything (except building RVVM itself). Including distribution names and download URLs. Non-Linux (Windows, MacOS, Haiku etc.) users may also want to run RVVM and it is hard to build Linux there. |
Yeah, but that's complicated with RISC-V for now. |
With Haiku I try to achieve possibility to run the same Haiku disk image on all supported RISC-V platforms, both hardware and virtual. For hardware platforms UEFI/FDT is used (usually u-boot based and shipped with hardware). For virtual machines (TinyEMU, QEmu, RVVM) Haiku boot loader complied as firmware ( Despite that Linux have strange tradition to ship image with FDT data and u-boot that makes it non-portable. So I promote to use UEFI and FDT stored in hardware. |
So far there are 3 ways for proper & transparent support of all distros, firmwares, etc:
Not really, the FDT my VM generates is passed all over through SBI, U-Boot and to the guest kernel. It's simply the fact that most images are tailored to specific target(s) or aren't tested well. |
ATA still works in RVVM but not available from CLI. You can patch main.c to attach ATA devices instead of NVMe, or you can tell me and I will add some kind of |
At my previous work on RVVM support I adapted ATA support for boot loader and kernel so it can pass up to GUI. But I got some strange problems with timer interrupts so thread scheduler freeze.
In theory you can use PATA PCIe card on Hifive Unmatched for example. But it is rare case. |
Ahh. Was this 0.4? It did not pass wfi tests back then, there were some related commits (c7cda30, 896a68a) that fixed it. |
Welp, U-Boot doesn't even have working drivers for that then. They are using some x86 port IO specific stuff, do not support ATA over PCI and do not enumerate ATA PIO from FDT. Never got it to work. |
See https://lekkit.github.io/test/index.html for some nightmare fuel. |
I'd like to test this. Is there just an archive somewhere that I could just boot from, replicating the example in the README? This would be a great thing to link. Or did I miss it? I'm figuring it out but it'd be awesome if you could download a tarball just to test drive this thing. |
@LekKit Hi, I've been trying to run the ubuntu disk I have installed using qemu and this instruction. I have run it with qemu using
I am trying to run it on this vm using
I fails on u boot stage with
I have noticed there is no networking support yet, but perhaps there is a way to make u boot ignore this and run regardless? Thank you! |
This is a known issue on U-Boot side (More precisely, the config for QEMU board). They build support for VirtIO block device found in QEMU, but not for NVMe drives (Even though QEMU may emulate NVMe as well). I also recommend raising JIT cache size with
There is, but QEMU U-Boot again has no drivers for it, and doesn't need to know about it's existence at all |
@LekKit That one worked, thanks again and special thanks for this promising project - the performance seems to be better that qemu's indeed |
This was already explained here: #57 (comment) TL;DR: Use upstream OpenSBI from their releases, U-Boot build provided in this thread, then download some upstream distro like Ubuntu. As for the general guide & prebuilt images: I'm gonna do this in time with v0.5 release, this is gonna take a bunch of weeks probably. Thanks for patience) |
I'm glad you like it) |
I got it going, and the performance seems very good. What are the plans for networking support in this? I have some really interesting use case ideas. |
Networking separates into NIC device support (Guest sees it & passes ethernet packets through it) and TAP interface (Host-side thing for virtual ethernet to interact with outside world) What's working now:
How to use userspace networking (WIP):
For Linux TAP (Beware: Complicated):
|
For user space networking it'd be good to have some way to use this as a library too, to embed into other applications. Why not do virtio devices inside the VM? Support for those is in most OSes and AFAIK they are very well suited for this kind of thing being designed to interface between a guest and a hypervisor. |
Do you mean the TAP interface? See
See #55 (comment) for my (subjective) rant about virtio.
|
@X547 A note about Linux guests:
The reason for slow GL is |
@LekKit Is WASM also something you plan to support longterm for RVVM - I know the performance is worse off in wasm but for my use case, it's actually fast enough (in fact much faster than other projects like this that target WASM). Happy to sponsor you too 😄 (please let me know how) Also are you able to share the flags you used to compile the demo? |
Yes, the Emscripten target reuses 90% of other POSIXy code. RVVM only uses a tiny bit of platform-dependent code abstracted in a nice way, therefore I do not plan on any breakage. There are some unintentional issues with this target, however (See #71), like perf and overall usability, but I hope they would be figured out at some point. I do have higher priorities than improving WASM target. but it's not going to get worse, that's it. There are also plans for more advanced interpreter approaches which could speed up WASM, non-JIT native targets and JIT tracing phase. It should be even possible to implement Sad thing is: Different WASM runtimes have different perf and I am not in control of that. On Firefox, RVVM Web Demo boots in ~1.5 secs for me, whereas on Chromium it is 6 seconds. Doom demo is unplayable on Chromium for me 3: |
I've updated the demo to latest RVVM commit and uploaded all the required stuff to rebuild it |
Github disallows to receive payments in my region. I'm not too sad about it though. If you like this project and want to help, there are things you can do ^^,
|
@LekKit Thanks for sharing the build scripts for the demo, super helpful. My plan would be to use RVVM without a gui, in terminal/shell only mode through something like xterm.js (though I'm still to figure this out) - since all the things I'd need to emulate are shell based only. (I've noticed a recent commit disables this for emscripten) Other things I still have to figure out for my use case:
I'm fairly new to C & wasm so it's going to take me a while, sorry in advance for any noob questions 😅
That's a shame 😞 I can also sponsor through crypto also, saw you mentioned it somewhere 🙃 let me know how |
Emscripten enables POSIX code paths, and RVVM is usually hooked to an actual terminal on those systems. Default Emscripten console however is very limited and slows RVVM significantly, so there was nothing useful disabled - just explicitly disabling something that was broken to begin with.
I am currently working on some kind of UART/VT API which would either get you serial IO or screen characters from an internal VT. This would bring proper VT support on older Windows or... you get it, Emscripten (And other cool usecases)
This is somewhat tough since the VM accesses raw block devices holding their own FS and stuff, same as your usual hard drive or whatever. You might want to use networking mounts or investigate 9p and how to bring support for it, if you actually need file interoperability.
Yea it is definitely possibe. There are 2 ways: Getting See As for writing a separate |
Question: Where should preferred SBI / U-Boot / Linux builds be hosted? In releases, CI artifacts or just a separate link? I've published a U-Boot patch to support RVVM board & NVMe boot properly: LekKit/patches-misc@ef2bb2b @fish4terrisa-MSDSM any suggestions? |
Build in ci ,and release one artifacts in releases is a good idea,the ci can be config as build once commited |
I recommend circleci. |
On a related note, I was interested in checking out the libretro integration but wasn't sure how to go from a compiled core lib to actually booting something. Any hints? |
See https://github.com/libretro/docs/pull/845/files for more info on libretro port
|
Awesome. Thanks for the tips! |
Hi, I am a newcomer of the project. I am trying to build RVVM as riscv32, and I have a problem of running it.
It seems like it couldn't find the root filesystem to mount. I don't what is happening. Is the problem cause by my root filesystem or other things and how I can build RVVM successfully? |
Do you have NVMe driver enabled in the kernel? RVVM emulates NVMe for drives and it seems kernel can't find it. This is a kernel config which includes everything needed to function on RVVM: https://github.com/LekKit/patches-misc/blob/master/linux-rvvm-configs/config_tiny_6.2 (Remember to switch to RV32 build) |
I would like to give a sample for passing arguments in pre.js:
The prebuilt kernel and rootfs images are from here |
The new v0.6 release includes EFI U-Boot firmware and a prebuilt Arch RISC-V image. There is also fw_jump.bin + tiny static kernel for custom buildroot builds or the likes. Closing this for now. Reopen if any other questions arise, or preferably open a new issue. |
Are there any recommended Linux disk images and firmware sets that are confirmed to work? I tried your kernels from this comment, but after switching to NVMe it do not boot anymore.
The text was updated successfully, but these errors were encountered: