mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.52k stars 2.37k forks source link

Adding flake with nix shell #240

Closed TornaxO7 closed 1 month ago

TornaxO7 commented 2 months ago

Hello! This PR adds a nix-shell which setups the cross-compiler and qemu which let's you start hacking immediately.

tomfitzhenry commented 3 weeks ago

For any other nix fans, here's a shell.nix that works for me:

with import <nixpkgs> {};
pkgsCross.riscv64.mkShell {}

Then execute:

$ nix-shell
$ make qemu
qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -global virtio-mmio.force-legacy=false -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0

xv6 kernel is booting

hart 2 starting
hart 1 starting
init: starting sh
$ 
TornaxO7 commented 3 weeks ago

Damn, thank you for pointing out pkgsCross!