Category Archives: Operating System

Loading MIT’s xv6 Operating System into Hardware

I learned a bit on the concept of Operating Systems (OS) in 2023 when I was still a middle schooler. To be honest, I don’t think I understood the whole concepts too well, but I got the basic ideas of the OS, which is that it is a software that acts as a bridge between program and hardware. For example, when users type something from a keyboard, move the cursor with the mouse, print something to the printer, or watch a video in the monitor, it is the OS that is actually translating the user’s requests and converts it to the operations that underlying hardware can understand.

I was wondering if there exists a piece of very simple OS software that I can to learn and understand how that process occurs. Luckily, I bumped into xv6, a simple Operating System that is used exactly for teaching students the concepts and leaving them to further expand on it.

It is very easy to launch through an emulator called QEMU, and provides some basic commands to run.

xv6 launched via QEMU

While I don’t have much knowledge of QEMU, I do know it is a platform that functions like a virtual machine (VM) hence the xv6 is running as a VM instead of directly on a real computer.

I was thinking that it would be fun to have xv6 run on a real piece of hardware or chips. Would that make a student better at understanding about how an OS interacts with the underlying hardware systems? Interestingly, someone already did it. Check out the following GitHub repository.

Port of xv6 to the Nezha RISC-V board using the Allwinner D1 SoC

It seems quite simple to get it running in the Allwinner D1 board with just a few runs of xfel commands. My understanding of xfel commands is to initialize the board memory, download xv6 OS image in the board, and then launch the OS. It requires a serial console to interact with the OS though.

xv6 launched in Allwinner D1 board

I’m going to use this little piece of hardware to learn the xv6. The little board is easy to get through Amazon. In fact, I found at least two boards from Amazon that are able to support xv6.

Sipeed RV Dock Allwinner D1 Single Board Computer

Sipeed Nezha 64bit RISC-V Linux SBC Board Allwinner D1

Note: The cable with Black/White/Green pins is the serial console cable, and the White USB-C cable is the data and power.