Skip to content

rumprun unikernel environment

lab176 edited this page Jun 11, 2015 · 11 revisions

This documents the specific steps needed to build a runnable rumprun unikernel using QEMU, an open source machine emulator and virtualizer. A more generic rumprun tutorial can be read here.

The rumprun repository provides the rumprun unikernel for various platforms. Rumprun uses the drivers offered by rump kernels, adds a libc and an application environment on top, and provides a toolchain with which to build existing POSIX-y applications as rumprun unikernels.

Platforms currently support by rumprun are hw/x86 and Xen/x86+x64, with more being worked on. Platform support is modular with the maximal amount of code shared between platforms, and generally speaking only bootstrap code and glue to I/O devices and the clock are required for supporting a new platform.

First step is to copy the repo

git clone https://github.com/rumpkernel/rumprun.git

and install QEMU

sudo apt-get install QEMU

Building the component libraries

cd into rumprun directory. Assuming you have gcc compiling for x64 by default, you must specify the -m32 flag like below as 32bit is the only supported hw for now. If a different target other than the host hardware is desired, you must specify CC=cross-compiler. See https://github.com/rumpkernel/wiki/wiki/Repo:-rumprun for info.

./build-rr.sh hw -- -F ACFLAGS=-m32

NOTE: This is how you recompile and build the components after making a kernel src change

Compile application

To compile a program consisting of a single C module for the hw platform:

rumprun-bmk-cc -o test test.c -c

If writing an app that makes direct system-calls to the RK, then one must disable the rump_fermented check within the rumpbake shell code. This located on line 102. The end of rump-bmk-cc compiles in a symbol called rump-fermented, which is what rumpbake checks for. Because we end the compiler before all files are linked in due to the -c flag, rump-fermented is never changed- hence the necessary work around.

baking

baking is done using the rumpbake tool. (found in app-tools) It takes the binary produced by the compiler and produces a runnable image. The parameters are the output image and target name.

rumpbake hw_generic test.bin test

use rumpbake list to see the available targets. Or, to use your own target, you can edit the rumpbake.conf to add a new configuration with specific rump libraries.

Running

The rumprun tool helps hide the details of running a unikernel from platform to platform, to provide a uniform experience.

rumprun hw -i prog

Debugging

To debug you need to both start qemu paused and connecting to an a port. GDB will then connect to this port, find the right debug symbols and start the app through the continue command.

Make sure when you first compile the app using rumprun-bmk-cc you set the -g flag.

Terminal 1: From application directory $<rumprun dir>/app-tools/rumprun qemu -ip -D 1234 <app>

Terminal 2: From application directory

$gdb
$target remote:1233
$file <app>
$y
Set desired break points...
$c