Getting Xv6 to Work
Getting this to work (I am using Ubuntu for this) was really very simple. You will need to have QEMU installed before beginning.
|
|
To download, build, and run xv6, do this:
|
|
Next, you will probably have to remove all the occurrences of -Werror
in the repo for it to compile. If you are using an old enough complier it may work as-is. But since xv6 is frozen in time, a historically accurate rewrite of 1970s Unix for educational use, and modern compilers expect different (more modern) coding practices, this flag will probably need to be removed before you can make xv6.
So, use a text editor (I used Visual Studio Code) to remove all the occurrences of -Werror
. There were four in total, two in the Perl script called cuth
and two in the Makefile
.
After that, xv6 magically built and started running!
|
|
⚠️ NOTE: Xv6 is really minimal! The very basic shell doesn’t even have pwd
, nor does it keep track of what directory you are in. There are only about 15 commands and they are all in the root directory.
There are only 9031 lines of actual code (counting C, Assembly, and C/C++ Header files), plus 1055 lines of comments, plus 1229 blank lines in the entire OS!
|
|
That is really not much!
It seems that anything much I want to do with it, I will have to add it. I guess that is the point of a super-minimal teaching OS.
MIT’s Operating Systems Course Featuring xv6
MIT’s course 6.828 Operating System Engineering (and its revision 6.1810) centers around the xv6 teaching operating system. Lectures cover core OS topics like scheduling, memory, inter-process communication, and more using xv6 as the vehicle.
Available Video Lecture Series
MIT has published a set of video lectures specifically focused on xv6 and OS internals.
First Lecture
Second Lecture
(See the YouTube videos for links to more…)
These are part of a multi-part playlist that walks through xv6’s architecture, kernel components, and C/assembly code structure, typically used in MIT’s RISC‑V‑based OS curriculum
Additional Resources
Lecture Notes and Slides: MIT’s OpenCourseWare site for 6.828 provides extensive PDF notes aligned with xv6 chapters and OS concepts like scheduling, traps, memory, and more.
Full Course Materials: Video lectures, slides, reading assignments, and code are publicly available through OCW’s course page for 6.828 / 6.1810