cbwww/site/docs/build/index.md

8.0 KiB

libreboot includes a script that automatically installs apt-get dependencies in Ubuntu 20.04:

sudo ./build dependencies ubuntu2004

Separate scripts also exist:

sudo ./build dependencies debian

sudo ./build dependencies arch

sudo ./build dependencies void

Technically, any Linux distribution can be used to build libreboot. However, you will have to write your own script for installing build dependencies.

libreboot Make (lbmk) automatically runs all necessary commands; for example, ./build payload grub will automatically run ./build module grub if the required utilities for GRUB are not built, to produce payloads.

As a result, you can now (after installing the correct build dependencies) run just a single command, from a fresh Git clone, to build the ROM images:

./build boot roms

or even just build specific ROM images, e.g.:

./build boot roms x60

If you wish to build payloads, you can also do that. For example:

./build payload grub

./build payload seabios

./build payload u-boot qemu_x86_12mb

Previous steps will be performed automatically. However, you can still run individual parts of the build system manually, if you choose. This may be beneficial when you're making changes, and you wish to test a specific part of lbmk.

Therefore, if you only want to build ROM images, just do the above. Otherwise, please continue reading!

Second, download all of the required software components

If you didn't simply run ./build boot roms (with or without extra arguments), you can still perform the rest of the build process manually. Read on! You can read about all available scripts in lbmk by reading the libreboot maintenance manual; lbmk is designed to be modular which means that each script can be used on its own (if that's not true, for any script, it's a bug that should be fixed).

It's as simple as that:

./download all

The above command downloads all modules defined in the libreboot build system. However, you can download modules individually.

This command shows you the list of available modules:

./download list

Example of downloading an individual module:

./download coreboot

./download seabios

./download grub

./download flashrom

./download u-boot

Third, build all of the modules:

Building a module means that it needs to have already been downloaded. Currently, the build system does not automatically do pre-requisite steps such as this, so you must verify this yourself.

Again, very simple:

./build module all

This builds every module defined in the libreboot build system, but you can build modules individually.

The following command lists available modules:

./build module list

Example of building specific modules:

./build module grub

./build module seabios

./build module flashrom

Commands are available to clean a module, which basically runs make-clean. You can list these commands:

./build clean list

Clean all modules like so:

./build clean all

Example of cleaning specific modules:

./build clean grub

./build clean cbutils

Fourth, build all of the payloads:

Very straight forward:

./build payload all

You can list available payloads like so:

./build payload list

Example of building specific payloads:

./build payload grub

./build payload seabios

Each board has its own U-Boot build configuration in lbmk under resources/u-boot. To build U-Boot payloads, you need to specify the target board and maybe a cross compiler for its CPU architecture. These are handled automatically when building ROM images, but for example:

./build payload u-boot qemu_x86_12mb	# on x86 hosts

CROSS_COMPILE=aarch64-linux-gnu- ./build payload u-boot gru_kevin

CROSS_COMPILE=arm-linux-gnueabi- ./build payload u-boot veyron_speedy

The build-payload command is is a prerequsite for building ROM images.

Fifth, build the ROMs!

Run this command:

./build boot roms

Each board has its own configuration in lbmk under resources/coreboot/ which specifies which payloads are supported.

By default, all ROM images are built, for all boards. If you wish to build just a specific board, you can specify the board name based on the directory name for it under resources/coreboot/. For example:

./build boot roms x60

Board names, like above, are the same as the directory names for each board, under resources/coreboot/ in the build system.

That's it!

If all went well, ROM images should be available to you under bin/