Using the build system

Genode relies on a custom tool chain, which can be downloaded at the following website:

Tool chain

https://genode.org/download/tool-chain

Build directory

The build system never touches the source tree but generates object files, libraries, and programs in a dedicated build directory. We do not have a build directory yet. For a quick start, let us create one using the following command:

 cd <genode-dir>
 ./tool/create_builddir x86_64

To follow the subsequent steps of test driving the Linux version of Genode, the specified platform argument should match your host OS installation. If you are using a 32-bit installation, specify x86_32 instead of x86_64.

The command creates a new build directory at build/x86_64.

Build configuration

Before using the build directory, it is recommended to revisit and possibly adjust the build configuration, which is located in the etc/ subdirectory of the build directory, e.g., build/x86_64/etc/. The build.conf file contains global build parameters, in particular the selection of source-code repositories to be incorporated, the kernel to use (KERNEL), and the targeted board (BOARD). It is also a suitable place for adding global build options. For example, for enabling GNU make to use 4 CPU cores, use the following line in the build.conf file:

 MAKE += -j4

Building components

The recipe for building a component has the form of a target.mk file within the src/ directory of one of the source-code repositories. For example, the target.mk file of the init component is located at <genode-dir>/repos/os/src/init/target.mk. To build the component, execute the following command from within the build directory:

 make init

The argument "init" refers to the path relative to the src/ subdirectory. The build system determines and builds all targets found under this path in all source-code repositories. When the build the is finished, the resulting executable binary can be found in a subdirectory that matches the target's path. Additionally, the build system installs a symbolic link in the bin/ subdirectory that points to the executable binary.

If the specified path contains multiple target.mk files in different subdirectories, the build system builds all of them. For example, the following command builds all targets found within one of the <repo>/src/drivers/ subdirectories:

 make drivers

Furthermore, it is possible to specify multiple targets at once. The following command builds both the init component and the nitpicker GUI server component:

 make init server/nitpicker