Build System

SBL chooses EDK II build system to compile and build SBL image. EDK II build infrastructure provides a flexible framework supporting different platforms and extensive configuration capabilities.

It supports many tools chains including GCC on Linux and Visual Studio on Windows.

This choice also comes with two benefits:

  • EDK II build tool is familiar to many UEFI/BIOS developers
  • Open source EDK II libraries can be ported with smaller effort

Pre Build Customization

SBL build system provides build time customization. Before the build, one can modify the configuration file Platform/<Platform_Foo>/BoardConfig.py based on requirement, image footprint, or hardware features etc.

Prebuild process determines the build time configuration by generating multiple files, among those are:

File Description
Platform.dsc Finalized platform configuration based on BoardConfig.py
ConfigDataStruct.h C header file for configuration data structure based on *.dsc file
ConfigDataBlob.h C file for Internal configuration data with default values

See Customize Build for more details.

Build SBL

SBL master build script Buildloader.py provides many options to compile images. To get help:

python BuildLoader.py build -h

Bhuild SBL for a supported platform:

python BuildLoader.py build <platform_name>

Clean up files generated during build process:

python BuildLoader.py clean

Final SBL image(s) should be generated under Outputs/<platform_name> directory

See Build Command for more details.

Post Build Customization

SBL supports platform customizations by embedding configuration data in a dedicated region in the image. The configuration data region can be patched without recompiling the code. This feature is most useful in supporting multiple similar boards in a single SBL image.

See Board Configuration Listing for more details.

Release vs Debug Build

SBL build system provides building debug or release images. Debug build contains verbose log messages for debugging, while release build image is deployed in a production environment. It contains minimum log messages to the console, and in some cases, may be built with more secure configurations, compared to debug build image.

Build system builds debug SBL image by default. To build a release image:

python BuildLoader build <target> -r

Note

When verified boot is enabled, SBL release build requires IAS image format to boot OS.

Developing on Windows

Note

Typically, Windows C compiler generates smaller code size compared to GCC build. This needs to be considered when allocating image size in SBL build.