News for hackers. Stuff that matters.

Show HN: Porting xv6 to HiFive Unmatched board

https://github.com/eyengin/xv6-riscv-unmatched

Hi HN,

I ported the teaching OS xv6-riscv to HiFive Unmatched and got it running on real hardware, including passing usertests.

I've been self-studying OS internals using the MIT 6.1810 materials. After finishing most of the labs, I was eager to see what it's like to run the OS on bare metal, rather than QEMU.

The Unmatched may not have the latest RISC-V features, but it's well-documented, and the Rev B release has made it more affordable, which makes it a good learning platform.

The porting process involved several interesting challenges:

- Hardware Quirks: Handling things like enabling A/D bits in PTEs (the hardware doesn't set them automatically, causing page faults), proper handling of interrupts, and instruction cache synchronization.

- Boot Flow: xv6 expects M-mode on startup, but standard RISC-V boot flows (typically via OpenSBI) jump to S-mode. To bridge this gap, I created a minimal U-Boot FIT image that contains only the xv6 kernel. This way, U-Boot SPL handles the complex CPU/DDR initialization, then hands control to xv6 in M-mode (skipping OpenSBI).

- Drivers: Ported an SPI SD card driver, replacing the virtio disk driver.

I wrote up implementation notes here: https://github.com/eyengin/xv6-riscv-unmatched/blob/unmatche...

Hopefully, this is useful for others who are learning OS internals and want to try running their code on real RISC-V hardware.

( 4 comments | 4 points | on HN )
Re:Show HN: Porting xv6 to HiFive Unmatched board by Neywiny on Sunday January 11, 2026 @06:51PM (#46581852)
I'm more interested in the animated svg. That's cool
Re:Show HN: Porting xv6 to HiFive Unmatched board by eyengin on Sunday January 11, 2026 @07:41PM (#46582231)
Thanks! It's asciinema + svg-term-cli:

    asciinema rec -c "tio /dev/ttyUSB1 -b 115200" uart_output.cast
    cat uart_output.cast | svg-term --window > example.svg
Re:Show HN: Porting xv6 to HiFive Unmatched board by disdi89 on Monday January 12, 2026 @01:11AM (#46584697)
Thanks for the nice work.. I plan to do something similar for Vexriscv
Re:Show HN: Porting xv6 to HiFive Unmatched board by eyengin on Monday January 12, 2026 @02:37AM (#46585284)
Thanks! Working with VexRiscv sounds like fun. Looking forward to seeing how it goes.