Pages

Sunday, February 21, 2016

Installing and Running xv6 Operating System

xv6 running on QEMU

When learning advanced concepts of operating systems, it is interesting to look at the source code of a real operating system. However unfortunately, most of the open source operating system source codes are so huge and it is not an easy job to read the code and understand how certain things are implemented. In a situation like that, it is important to have something much smaller in size while providing all the necessary ingredients of a real operating system.

xv6 is an operating system developed by MIT for the exact same purpose. It is an implementation of the Unix version 6 using ANSI C language for x86 platforms. It is a great resource for learning operating systems and many universities all over the world have already used it in their courses. Here's how we run xv6 operating system on a QEMU virtual machine simply on top of a 64-bit Ubuntu 14.04 LTS machine.

First of all, we have to install some tools and packages on our Ubuntu Linux system as follows.

Now, let's download the source code of the xv6 operating system. MIT provided an official git repository to download the source code. However, I have cloned it into a my own repository on Github from where I will get it.

git clone https://github.com/asanka-code/xv6.gitcd xv6

After moving into the directory with the source code, we need to make an important entry inside the Makefile. Therefore, find the line which has the QEMU command and update it to make it look like as follows.

QEMU = qemu-system-x86_64

Time to compile and run xv6 system on QEMU emulator.

makemake qemu

This will startup a window with QEMU emulator and will start the shell prompt of xv6 operating system.