2023-07-10 15:43:08 +00:00
|
|
|
---
|
|
|
|
title: Build from source
|
|
|
|
x-toc-enable: true
|
|
|
|
...
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
nonGeNUine Boot's build system is named `gbmk`, short for **G**nu**B**oot**M**a**K**e, and this
|
2023-07-10 15:43:08 +00:00
|
|
|
document describes how to use it. With this guide, you can know how to compile
|
2023-07-17 15:45:56 +00:00
|
|
|
nonGeNUine Boot from the available source code.
|
|
|
|
This version, if hosted live on the website, assumes that you are using
|
|
|
|
the `gbmk` git repository, which
|
2023-07-10 15:43:08 +00:00
|
|
|
you can download using the instructions on [the code review page](../../git.md).
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
If you're using a release archive of nonGeNUine Boot, please refer to the
|
|
|
|
documentation included with *that* release. nonGeNUine Boot releases are only intended
|
2023-07-10 15:43:08 +00:00
|
|
|
as *snapshots*, not for development. For proper development, you should always
|
2023-07-17 15:45:56 +00:00
|
|
|
be working directly in the nonGeNUine Boot git repository.
|
2023-07-10 15:43:08 +00:00
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
The following document describes how `gbmk` works, and how you can make changes
|
|
|
|
to it: [gbmk maintenance manual](../maintain/)
|
2023-07-10 15:43:08 +00:00
|
|
|
|
|
|
|
Git
|
|
|
|
===
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
nonGeNUine Boot's build system uses Git, extensively. You should perform the steps
|
2023-07-10 15:43:08 +00:00
|
|
|
below, *even if you're using a release archive*.
|
|
|
|
|
|
|
|
Before you use the build system, please know: the build system itself uses
|
|
|
|
Git extensively, when downloading software like coreboot and patching it.
|
|
|
|
|
|
|
|
You should make sure to initialize your Git properly, before you begin or else
|
|
|
|
the build system will not work properly. Do this:
|
|
|
|
|
|
|
|
git config --global user.name "John Doe"
|
|
|
|
git config --global user.email johndoe@example.com
|
|
|
|
|
|
|
|
Change the name and email address to whatever you want, when doing this.
|
|
|
|
|
|
|
|
You may also want to follow more of the steps here:
|
|
|
|
<https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>
|
|
|
|
|
|
|
|
Python
|
|
|
|
======
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
Python2 is unused by gbmk or anything that it pulls down as modules. You
|
2023-07-10 15:43:08 +00:00
|
|
|
should ensure that the `python` command runs python 3, on your system.
|
|
|
|
|
|
|
|
Make
|
|
|
|
========
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
**G**nu**B**oot**M**a**K**e (gbmk) includes a file called `Makefile`. You can still use
|
|
|
|
the `gbmk` build system directly, or you can use Make. The `Makefile`
|
|
|
|
simply runs `gbmk` commands. However, using `gbmk` directly will offer you
|
2023-07-10 15:43:08 +00:00
|
|
|
much more flexibility; for example, the Makefile currently cannot build single
|
|
|
|
ROM images (it just builds all of them, for all boards).
|
|
|
|
|
|
|
|
You must ensure that all build dependencies are installed. If you're running
|
2023-07-17 15:45:56 +00:00
|
|
|
Trisquel 11, you can run this:
|
2023-07-10 15:43:08 +00:00
|
|
|
|
|
|
|
sudo make install-dependencies-ubuntu
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
One exists specifically for Debian (may also work for trisquel):
|
2023-07-10 15:43:08 +00:00
|
|
|
|
|
|
|
sudo make install-dependencies-debian
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
Another exists for Arch (may also work for parabola):
|
2023-07-10 15:43:08 +00:00
|
|
|
|
|
|
|
sudo make install-dependencies-arch
|
|
|
|
|
|
|
|
Now, simply build the coreboot images like so:
|
|
|
|
|
|
|
|
make
|
|
|
|
|
|
|
|
This single command will build ROM images for *every* board integrated in
|
2023-07-17 15:45:56 +00:00
|
|
|
nonGeNUine Boot. If you only wish to build a limited set, you can use `gbmk` directly:
|
2023-07-10 15:43:08 +00:00
|
|
|
|
|
|
|
./build boot roms x200_8mb
|
|
|
|
|
|
|
|
You can specify more than one argument:
|
|
|
|
|
|
|
|
./build boot roms x200_8mb x60
|
|
|
|
|
|
|
|
ROM images appear under the newly created `bin/` directory in the build system.
|
|
|
|
|
|
|
|
For other commands, simply read the `Makefile` in your favourite text editor.
|
2023-07-17 15:45:56 +00:00
|
|
|
The `Makefile` is simple, because it merely runs `gbmk` commands, so it's very
|
2023-07-10 15:43:08 +00:00
|
|
|
easy to know what commands are available by simply reading it.
|
|
|
|
|
|
|
|
Standard `clean` command available (cleans all modules except `crossgcc`):
|
|
|
|
|
|
|
|
make clean
|
|
|
|
|
|
|
|
To clean your `crossgcc` builds:
|
|
|
|
|
|
|
|
make crossgcc-clean
|
|
|
|
|
|
|
|
To build release archives:
|
|
|
|
|
|
|
|
make release
|
|
|
|
|
|
|
|
Build without using Make
|
|
|
|
============================
|
|
|
|
|
|
|
|
The `Makefile` is included just for *compatibility*, so that someone who
|
|
|
|
instictively types `make` will get a result.
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
Actual development/testing is always done using `gbmk` directly, and this
|
2023-07-10 15:43:08 +00:00
|
|
|
includes when building from source. Here are some instructions to get you
|
|
|
|
started:
|
|
|
|
|
|
|
|
First, install build dependencies
|
|
|
|
---------------------------------
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
nonGeNUine Boot includes a script that automatically installs apt-get dependencies
|
2023-07-10 15:43:08 +00:00
|
|
|
in Ubuntu 20.04:
|
|
|
|
|
|
|
|
sudo ./build dependencies ubuntu2004
|
|
|
|
|
|
|
|
Separate scripts also exist:
|
|
|
|
|
|
|
|
sudo ./build dependencies debian
|
|
|
|
|
|
|
|
sudo ./build dependencies arch
|
|
|
|
|
|
|
|
sudo ./build dependencies void
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
Technically, any GNU+Linux distribution can be used to build nonGeNUine Boot.
|
2023-07-10 15:43:08 +00:00
|
|
|
However, you will have to write your own script for installing build
|
|
|
|
dependencies.
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
**G**nu**B**oot**M**a**K**e (gbmk)
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
**G**nu**B**oot**M**a**K**e (gbmk) automatically runs all necessary commands; for
|
2023-07-10 15:43:08 +00:00
|
|
|
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
|
2023-07-17 15:45:56 +00:00
|
|
|
gbmk.
|
2023-07-10 15:43:08 +00:00
|
|
|
|
|
|
|
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
|
2023-07-17 15:45:56 +00:00
|
|
|
on! You can read about all available scripts in `gbmk` by reading
|
|
|
|
the [gbmk maintenance manual](../maintain/); gbmk is designed to be modular
|
2023-07-10 15:43:08 +00:00
|
|
|
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
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
The above command downloads all modules defined in the nonGeNUine Boot build system.
|
2023-07-10 15:43:08 +00:00
|
|
|
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
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
This builds every module defined in the nonGeNUine Boot build system, but you can
|
2023-07-10 15:43:08 +00:00
|
|
|
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
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
Each board has its own U-Boot build configuration in `gbmk` under
|
2023-07-10 15:43:08 +00:00
|
|
|
`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
|
|
|
|
|
2023-07-17 15:45:56 +00:00
|
|
|
Each board has its own configuration in `gbmk` under `resources/coreboot/`
|
2023-07-10 15:43:08 +00:00
|
|
|
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/
|