"make" (which must be GNU Make) in the userland directory will create a kernel.a static library containing the mbuf routines, which can be used to create testing code in userland. To facilitate that, in the directory tests there is a Makefile.inc file, which can be included in the Makefile of any tests. The including Makefile is supposed to set the S variable to the userland directory. The test itself is supposed to be divided in two sets of files. The first are compiled like kernel sources with all the -D_KERNEL -ffreestanding flags, and the inclusion of Makefile.inc takes care of compiling them and setting the right CFLAGS. The second set are files compiled like normal userland files. One of those should contain the main function. A separate Makefile should be created for them and be named Makefile.std. As the GNU Make has sufficient built-in rules, this file can be usually left empty. In the including Makefile, the names of the first set of files should be assigned to a variable KERNSRCS ant of the second set to the variable STDSRCS. THe PROG variable should be set to the name of the resulting program. The Makefile.inc itself can be included after setting those variables. That's all. After that, gmake in this directory creates the program from the sources named in KERNSRCS and STDSRCS. Makefile.inc takes care of rebuilding the kernel.a library. A sample program is in the directory tests/example1. It contains a deliberate bug, where the mbuf is not ensured to be long enough. This is to demonstrate how the Valgrind memory debugger can catch such errors (because the subsequent printf then references unitialized data).