The buildrump.sh script builds unmodified NetBSD kernel drivers such as file systems and the TCP/IP stack as components for hosts such as Linux and BSDs. These components can be linked in a variety of configurations to form rump kernels, which provide services to applications directly on the host. The benefits of this approach include avoiding the overhead of OS virtualization. Also, root privileges are not mandated. buildrump.sh also provides the tools necessary to build rump kernels for other platforms, such as the Xen hypervisor or the Linux kernel.
Examples of using rump kernels are as follows: fs-utils uses file system drivers in unprivileged applications. The TCP/IP stack can be used in conjunction with the Data Plane Development Kit for fast userspace packet processing. An alternative Lua interface to rump kernels is available via the ljsyscall project.
For full details on rump kernels, read http://www.NetBSD.org/docs/rump/ and follow the links. For a video overview including various demos, watch the FOSDEM 2013 presenation.
The easiest way to install rump kernel components is to use a binary package for your OS/distribution/architecture.
- Void Linux:
xbps-install -S netbsd-rumpkernel
- Arch Linux: pacman (OBS), AUR
- OpenSUSE Linux: 12.3 RPM (OBS) || Tumbleweed RPM (OBS) || Factory RPM (OBS) || SLE_11_SP2 RPM (OBS)
- Fedora Linux: 17 RPM (OBS) || 18 RPM (OBS) || RHEL 6 RPM (OBS) || CentOS 6 RPM (OBS)
- Mandriva Linux 2011: RPM (OBS)
- Debian Linux: 7 DEB (OBS)
- Ubuntu Linux: 13.04 DEB (OBS)
- NetBSD: pkgsrc/misc/rump
- DragonFly BSD: pkgsrc/misc/rump
- Solaris: pkgsrc/misc/rump
The links for some of packages are provided by the openSUSE Build Service. You can download and install the packages manually, but it is highly recommended to add the OBS repositories for the right distro and architecture to the package manager. This way, updates and dependencies will be automatically resolved other packages depending on rump kernels.
Building from source may be necessary of there are no binary packages for your systems, or if you wish to make source level modifications to the rump kernel components.
The following are required for building from source:
- cc (gcc and clang are known to work)
- ld (GNU or Solaris ld required)
- binutils (ar, nm, objcopy)
Clone the repository and run:
./buildrump.sh
You will now find the kernel drivers and necessary headers in ./rump
ready for use. Examples on how to use the resulting drivers are available
in the tests
and examples
directories.
When run without parameters, buildrump.sh
implicitly assumes that the
given commands were checkout fullbuild tests
. You can override this
default by giving explicit commands.
The checkout
command will fetch the necessary subset of the NetBSD
source tree from github into ./src
. You are free to use any method
for fetching NetBSD sources, though the only officially supported way
is to let the script handle the checkout.
The fullbuild
command will then instruct the script to to build the
necessary set of tools for building rump kernels, e.g. the BSD version
of make
, after which it will build the rump kernels. By default,
cc
from path is used along with other host tools such as nm
.
Crosscompilation is documented further below.
If the command tests
is given, the script will run simple tests
to check that e.g. file systems and the TCP/IP stack work correctly.
If everything was successfully completed, the final output from the
script is "Success". Note that tests
cannot be run when buildrump.sh
is used with a crosscompiler.
To learn more about command line parameters, run the buildrump.sh
script with the -h
flag.
If the environment variable $CC
is set, its value is used as the compiler
instead of cc
. This allows not only to select between compiling with
gcc or clang, but also allows to specify a crosscompiler. If $CC
is set
and does not contain the value cc
, gcc
, or clang
the script assumes
a crosscompiler and will by default use tools with names based on the
target of $CC
with the format target-tool
(e.g. target-nm
).
Crosscompiling for an ARM system might look like this (first command is purely informational):
$ arm-linux-gnueabihf-gcc -dumpmachine
arm-linux-gnueabihf
$ env CC=arm-linux-gnueabihf-gcc ./buildrump.sh [params]
Since the target is arm-linux-gnueabihf
, arm-linux-gnueabihf-nm
etc.
must be found from $PATH
. The assumption is that the crosscompiler
can find the target platform headers and libraries which are required
for building the hypercall library. You can override the defaults
by setting $AR
, $NM
and/or $OBJCOPY
in the environment before
running the script.
Continuous testing on Linux/amd64 + gcc/clang is done by Travis CI for every commit.
Tested machine architectures include x86 (32/64bit), ARM, PowerPC (32/64bit) and UltraSPARC (32/64bit).
Examples of hosts buildrump.sh has manually been tested on are as follows:
-
Linux
- Linux Gallifrey 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux (with seLinux in permissive mode, amd64)
- Linux vyrnwy 3.6.2-1.fc16.x86_64 #1 SMP Wed Oct 17 05:30:01 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux (Fedora release 16 with read-only /usr/src via NFS)
- Linux void-rpi 3.6.11_1 #1 PREEMPT Tue Feb 19 17:40:24 CET 2013 armv6l GNU/Linux (Void, Raspberry Pi, evbarm)
- Linux braniac 3.9.9-1-ARCH #1 SMP PREEMPT Wed Jul 3 22:45:16 CEST 2013 x86_64 GNU/Linux (Arch Linux, amd64, gcc 4.8.1)
- Linux pike 3.6.7-4.fc17.ppc64 #1 SMP Thu Dec 6 06:41:58 MST 2012 ppc64 ppc64 ppc64 GNU/Linux (Fedora, ppc64)
-
DragonFly BSD
- DragonFly 3.2-RELEASE DragonFly v3.2.1.9.g80b03f-RELEASE #2: Wed Oct 31 20:17:57 PDT 2012 [email protected]:/usr/obj/build/home/justin/src/sys/GENERIC i386
-
FreeBSD
- FreeBSD frab 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #5 r243866: Wed Dec 5 02:15:02 CET 2012 root@vetinari:/usr/obj/usr/src/sys/RINCEWIND amd64 (static rump kernel components, with thanks to Philip for test host access)
-
NetBSD
- NetBSD pain-rustique.localhost 5.1_STABLE NetBSD 5.1_STABLE (PAIN-RUSTIQUE) #5: Wed Feb 16 13:34:14 CET 2011 [email protected]:/objs/kobj.i386/PAIN-RUSTIQUE i386
-
Solaris
- SunOS hutcs 5.10 Generic_142900-15 sun4v sparc SUNW,T5240 Solaris (needs xpg4/bin/sh, sparc64 in 64bit mode, sparc in 32bit mode)
- SunOS pkgsrc-dev 5.11 joyent_20120126T071347Z i86pc i386 i86pc (with thanks to Jonathan for test host access, amd64 in 64bit mode, i386 in 32bit mode)
There is also initial support for Cygwin, but it will not work out-of-the-box due to object format issues (ELF vs. PE-COFF). Mac OS X is likely to require support for its linker.
Place your buildtools in a separate directory, e.g. $HOME/rumptools
using ./buildrump.sh -T $HOME/rumptools tools
. Put that directory in
$PATH
. You can now do fast build interation for kernel components by
going to the appropriate directory and running rumpmake dependall && rumpmake install
.