Install XV6 Operating system

Summary of what you are going to install:

  1. qemu
  2. xv6

Summary of the commands:

sudo apt update
sudo apt install qemu
git clone git://
make qemu-nox

Here are the steps:

Step 1 – Install qemu:

$ sudo apt install qemu

If you have 64 bit OS there is a chance Makefile will not be able to find qemu. In that case you should edit the Makefile at line 54 and add the following code:

QEMU = qemu-system-x86_64

Step 2 – Install xv6

Create a directory, and clone xv6 to that directory:

$ git clone git://

Step 3 – Compile xv6

$ make

Step 4 – Compile and run the emulator qemu:

$ make qemu

The emulator will start but it will echo on the terminal too. Better to run it with the following frag (preferred):

$ make qemu-nox

Also, for gdb enabled execution run:

$ make qemu-nox-gdb

To enter the qemu console at any time, press ctrl+a, then c. If you want to exit, simply type “quit” to exit the emulator

Step 5 – Write an user application (eg: bla)

5.1) Create a copy of an existent program like wc and name it as your new user program (eg bla.c):

$ cp wc.c bla.c

5.2) Edit bla.c with your favorite editor. Take a look at the source code examples of existent commands, in order to see the syntax of the available functions of xv6 (they are slightly different).

5.3) Modify the makefile of xv6 to include bla.c:

The simplest way is to open the makefile, search for wc and add bla next to it whenever it appears on the makefile

5.4) Clean and recompile xv6.

The new command should be available.


  1. Exploring the xv6
  2. Official xv6 homepage
  3. Adding a user program in xv6
  4.  Implementing a simple priority Scheduling policy
  5. Adding a system call in xv6
  6. Adding a system call in xv6 (stack overflow)
  7. Compile and run an xv6 application
  8. Implementing ps in xv6
  9. Adding and changing priority
  10. How to pass a variable to a system call

Leave a Reply