<< Back to Codezero Application Development
Codezero run-time consists of two main components; the microkernel and containers.
The microkernel is the only privileged component in the Codezero run-time. It is considered as the single point of trust, namely the trusted computing base. It exposes a minimal system call API to userspace containers. It is also responsible for security checking of resource accesses issued by each container, through the use of its system call API.
Containers are independent userspace projects that may consist of a single baremetal application, or a full-blown virtualized operating system with many applications. There may be any number of containers in a Codezero build, and each container may be developed independent of others.
The build system consists of the SCons build tool and a set of python scripts. SCons is a python-based build tool that has similar functionality to Make. The main difference is that build rules are written using python functions.
All build and configuration scripts are located under the scripts/ directory. The microkernel is built by the top-level SConstruct file, and with help of many SConscript files spread across the kernel build directories.
The build system is designed with a modular approach. In essence once the full system is configured, the various parts of the system like kernel, containers, libraries, loader can be build individually using the SConscript file present in various directories.
The build system may be invoked via the ./build.py script at the top-level directory.
Codezero project is configured using the python-based CML2 kernel configuration system. CML2 allows a menu-based configuration of build parameters before building. Typically configuration data produced by CML2 are used for configuring the microkernel, as well as kernel-related parameters of each container included in the build. In essence, the CML2 configuration is used for a complete userspace and microkernel build.
The source code for CML2 itself lies under the tools/cml2-tools directory. Codezero project configuration data and scripts reside under scripts/config directory.
CML2 uses configuration files with a .cml extension for configuration. Various pre-defined configuration files reside under the scripts/config/examples/cml directory.
For reference to CML2 syntax and internals please refer to the CML2 Language Reference Manual.
The loader directory contains sources for an elf library and the boot loader. The boot loader is a simple elf program that is responsible for scatter-loading the kernel and container images.
The loader is the final module built during a Codezero system build. After all containers and the kernel is built, the loader module bundles all resulting ELF files under a single final.elf which also contains the elf loader program.
The loader/libs directory contains 2 libraries called “C” and “elf”. “elf” is the library used for loading the elf files during boot. The C library is a partial C library that is used by the bootloader during boot.
This directory contains various tools and scripts that are used as part of the project. tools/tagsgen directory contains scripts to produce ctags and cscope index data for the microkernel and any other project included in the build. For instance, ./tools/tagsgen_kernel.py may be used to create a kernel index, and ./tools/tagsgen_linux.py may be used for creating an index for the linux kernel. These scripts consider the current configuration in order to filter out only the relevant architecture and platform directories for an index generation. tools/pyelf is a host-side python library for inspecting ELF elements of a file inside the host. For instance it is possible to extract fields from ELF headers or make calculations using this library. tools/run-qemu-insight script is an autogenerated script that allows the final.elf image to be instantiated on qemu and Insight/gdb after a build.
This directory includes various self-contained documents about peculiarities of the Codezero Run-time. docs/man directory includes reference manual pages for each Codezero Microkernel system call. They may be invoked by: % man -M docs/man <man_page_name>
In the future more ad-hoc documentation will be added here.
These directories contain the sources and headers repectively for the kernel.
conts directory contains all the userspace sources.
Contains example userspace servers and applications, e.g., Hello World and a template for user space development.
This directory is used for building Virtualized Linux on top of Codezero. It does not exist in original Codezero sources, but should be created if Linux virtualization functionality is going to be used. The typical instantiation of this directory includes copying Linux environment files from a separate repository, which includes the linux filesystem and boot parameters. Finally, the virtualized linux kernel should be copied or cloned from a separate kernel repository, into this directory. The contents of this directory must be set up in order to initiate a linux build via the Codezero build system.
This directory is used for building Virtualized u-boot on top of Codezero. It does not exist in original Codezero sources, but should be created if u-boot functionality is going to be used at run-time. The typical instantiation of this directory includes copying virtualized u-boot sources from a separate repository into this directory, before initiating a u-boot build via the Codezero build system.
This directory contains all userspace libraries that are available for any userspace application. These libraries consist of libl4, libc, libmem and libdev.
libl4 is the most fundamental library provided for userspace. This library presents raw Codezero system calls in a more user-friendly format. It is appropriate to link with this library from every project, including virtualized operating system kernels. It is recommended that system calls to Codezero are issued via this library.
libc is the userspace C runtime library. It is particularly useful for referring to C library functionality that does not require an operating system. For example string and basic IO functionality is included.
libdev is a helper library for clcd, timer, and uart devices for different platforms. The conts/baremetal/{clcd_service, timer_service, uart_service} servers make use of this library.
libmem contains 3 different memory allocators. A fixed-size memory cache implementation, a kmalloc implementation, and a page allocator implementation for page-size granularity memory allocation. Out of the three, memcache is the most frequently used, since it provides a simple and deterministic method of memory allocation.
The posix sources consist of a partially complete POSIX implementation on top of Codezero. Advanced capabilities such as demand paging, memory and process management are provided. As of this writing, this is an experimental container for investigating advanced pager behavior on top of the microkernel.