While adding pages & stuff to http://gunkies.org/wiki/Unix_System_6 I came across this thing called xv6 at MIT.


What it is, is a port of Unix v6 to the x86 cpu. Before this, apparently they were using actual v6 on a PDP-11 emulator, however for their uses it would be easier to use something more i386 like. Now the cool part is that it’s SMALL. It harkens back to the day when people could actually read the code to their OS..

# cat *.c wc -l
cat *.h wc -l
cat *.S wc -l

Yes, that all there is to it! It litteraly takes 4.5 seconds to compile the whole thing, and setup a boot/root disk image on a 1.5 Ghz P4. The only ‘catch’ is that you need elf tools to build the thing.. Most Linux/NetBSD/OpenBSD folk ought to be in luck as they have been elf for quite some time now.. For windows people it’s just easier to install an OS into a VM that contains an ELF toolchain.. Don’t feel bad about compiling it in a VM as it will not be that big of an ordeal.

Download the inital source from here: http://pdos.csail.mit.edu/6.828/2006/src/xv6-rev0.tar.gz

If you feel brave go thru the labs.. They have stuff to add like virtual memory and whatnot, but they do walk you thru it, with guides and stuff… Remember this is out of a class, they don’t throw the kids to the wolves as it were.

Naturally since it’s v6, there is no TCP/IP, heck it doesn’t even have native tools… But it *can* run exe’s so it’s got enough to get your feet wet.. It’s dammed near tempting to complete the course work to flesh it out, grab 32v and start building a userland then bring it to 3BSD levels… But then I guess that is missing the point of a small readable Unix.

Anyways I found it interesting, no pictures on this one but either way its… different. Oh and the disk images run great under Qemu for what it’s worth.

2 thoughts on “xv6

  1. In it’s current state it only uses the IDE controller (polled mode ontop of that!) so it would be a matter if your USB pen drive emulated the old IDE controller…. This would preclude any BIOS type thing (ie hooking int 13 etc) …

    If your pen drive did support emulating an IDE interface you would need two of them, and to ‘dd’ the images to the pen drive…

    Qemu/Bochs may be a better approach as it’s current incanation doesn’t respect partitions, and requires 2 disks.

Leave a Reply