Disk Image

As we will run linux in gem5 we need to provide it with a disk with a root filesystem installed on it. There are several ways to create disk images for gem5 all described here.

We recommend to follow the instructions in option 3) and use qemu to create your first disk images. Using qemu enables you to configure your disk image with your serverless function play around a bit and test all your setup from the software side before switching to the actual simulation.

Note: Setting up a disk image from scratch can be tricky to get it right and also installation costs a lot of time. To get around this we distribute ready to use disk-images with every vSwarm-u release. Refer to the download section in the setup guide.

Install OS and packages

We compiled a Makefile which will use the autoinstall feature in ubuntu to bake a new disk image with all tools required for your experiments

The installer will:

  1. Create a empty disk image with
  2. Install Ubuntu as operating system
  3. Create users root (password root) and ubuntu (password root) with privileged permissions to all resources.
  4. Setup ssh-login for both users.
  5. Install the m5 binary and gem5 init service.
  6. Install the docker engine, docker-compose and the golang tools.
# Install dependencies
make -f setup/disk.Makefile dep_install
# Download the installation medium for Ubuntu server
make -f setup/disk.Makefile download
# Run the installation
make -f setup/disk.Makefile install
# Save the disk into $RESOURCES/base-disk-image.img
make -f setup/disk.Makefile save

Note: The installation will take a while therefore we recommend to make a backup of this disk image once the installation has completed.

Test Installation

Use the disk image

Once you have baked your basic disk image you can test and play around with it using the qemu emulator. To start the emulator use the command:

sudo qemu-system-x86_64 \
    -nographic \
    -cpu host -enable-kvm \
    -smp <Number of CPUs> \
    -m <MEMORY size> \
    -drive file=<path/to/disk/image>,format=raw \
    -kernel <path/to/kernel> \
    -append 'console=ttyS0 root=/dev/hda2'

Gem5 binary

The m5 binary is a useful tool to execute magic instructions from the running system. After installation you can use this tool in scripts or even in the command line to for example take a snapshot or exit the simulation. Type m5 -h for available subcommands. More information about the m5 binary you will find here.

Note: Using the gem5.Makefile will already build the m5 utility tool for you.

Gem5 init service.

The gem5 init service is a neat way to automatically start execution a workload as soon as linux is fully booted. This service is very general in that it uses the m5 tool retrieve any script you can specify in your gem5-config file and execute it. Just check the --run-script argument in the gem5-config/run.py file to see how such a script is send to the simulator and the config/gem5init file to find out how the linux obtains and execute it.