Required Setup

To complete that exercise you will need a recent Debian/Ubuntu Linux installation with root privileges. The recommended distributions are Debian 12 and Ubuntu 22.04. Certain steps of this guide are not guaranteed to work on other distributions/versions.

The machine you use also needs to have an Intel x86-64 CPU (this guide will not work with MacBook's ARM M1/M2 CPUs). If somehow you cannot get a proper setup please contact the instructor, you will be given temporary access to a remote machine satisfying these constraints.

Setting Up a Development Environment

To set up the proper environment for this exercise you can either:

  • Use a virtual machine. Download the following VM image and import it into VirtualBox. To log in, enter the username user and password a. That user has root access with sudo.

  • Use a Docker container if you know what you are doing. If it is not installed on your machine install Docker. Start a Debian 12 container from your host, for example if you are using the command line:

    docker run -it debian:12
    

    Make sure to install the few pre-requisite Debian packages that will allow us to compile Linux and Qemu. Within the container:

    apt update
    apt install -y build-essential git bc libssl-dev flex bison wget python3 python3-venv ninja-build pkg-config libglib2.0-dev libelf-dev libslirp-dev
    
  • Install Linux natively if you know what you are doing. If you are not familiar with that or don't already have a Debian 12/Ubuntu 22.04 distribution up and running, this is not recommended. Indeed, it can take a bit of time and learning how to install Linux bare metal is not the goal of this exercise.

Note that whatever environment you use make sure there is at least 20 GB of free disk space.

In the exercise, the VirtualBox VM/Linux container/native Linux install you will work on will be called the host. This is because in that host we will create another virtual machine that will make use of the virtual device you developed. That VM will be called the VM. It is a bit counter intuitive to name the VirtualBox VM "host" and not VM, but this is done for reasons of consistency between the different development environments you may use.

Creating a Base Directory for the Exercise

You should create a base directory for the exercise. In the rest of this guide, that base directory is assumed to be present in your home folder and named virt-101-exercise. You can create it with the following command:

mkdir ~/virt-101-exercise