Introduction to the Build System
Codezero project uses
Makefiles for building the hypervisor and other individual projects. All manual labour of setting up build projects have been conveniently automated by a set of simple bash scripts. We describe how the complete build process works in this section. A typical Codezero build involves the hypervisor, and one or more of guest components such as the Linux kernel.
If you’re in hurry to test Codezero, you can just execute
make in freshly cloned
codezero-meta directory. The building system will download necessary repositories, load default config, build the system and print commands to test it.
Using saved build configurations (aka meta-configs)
A configuration of Codezero based system consists of kernel and guests configuration files plus some metadata about the building. The build system contains a tools to manage such configuration. The bash scripts mentioned earlier make loading, comparing and switching between multiple meta-configs a seamless process.
The pre-saved meta-configs prepared for your convenience are kept under
c0meta/config directory. To list all the meta-configs use
./config-load.sh without any argument or just
It’s necessary to use
config-load.sh script to begin working with any meta-config. It loads a pre-saved meta-config given as an argument into
build directory so it can be used and modified, without altering its saved state. Also the script switches the
codezero-meta/current symlink, that marks the active meta-config for other tools to be used by default.
$ cd codezero-meta $ ./config-load.sh vx-single-initramfs
Now the hypervisor build configuration and guests kernels configurations have been loaded. You can load multiple meta-configs at the same time and switch between them with
$ ./config-switch.sh tuna
All the loaded configs are permanently stored inside
build/ dir and switching between them will not trigger rebuilding, which saves a lot of time when working on multiple similar system configurations.
At any time you can check which configuration is currently active with:
$ cat .current tuna
While not necessary at the very beginning it’s possible to to alter the active config. Codezero system builder uses
KBuild for configuration, and it lets us configure the entire system as well as each individual guest kernels included in the build. Use:
$ make menuconfig
to iterate though the configuration menus for each build component. Each individual Linux kernel guest configurations come up one by one, starting from Guest #0. You can make necessary changes.
It’s worth noting, that you can limit the traversed components using
only= argument, like this:
$ make menuconfig only=kernel,cont0
only= argument works for most
make invocations that Codzero build system supports.
We are now ready to build the system. Before that, we can check the differences between active meta-config loaded into
build dir and it’s saved version:
At any time you can save the active metaconfig under it’s original name with:
or you can give it new name:
$ ./config-save.sh tuna-mytest
For the first build, make sure you’re using
vx-single-initramfs meta-config by
$ ./config-load.sh vx-single-initramfs
as it’s a simplest configuration that will let you run Codzero with Linux guest in Qemu emulating Versatile Express platform, without dealing with any filesystem preparation and using any hardware.
Once the right configuration has been loaded building is simple. Always make sure that you are on the right branch for every individual git repository. This frequently includes
android repositories. To build, go to
codezero-meta root directory and type:
The build system should now build every guest and bundle it together with hypervisor build.
All build output is available under
c0meta/current. Some of the build components are below:
final.elf- This is the final output from the build and is a flashable, compressed, self extracting, elf bundle.
Image– Raw binary, like Linux
kernel.elf– This is the hypervisor binary.
- You can also find Linux guests
vmlinuzbinaries under respective container directories.
codezero-meta repository contains
README file that describes more features of Codezero building system. It’s good idea to read this file before attempting any more advanced operations.
Continue to the Running and Debugging page for information on how to use the output files and test your build.
Note that this is a generic guide, for more specific information about platforms please look at Building for Devices pages.