2021-05-18 12:21:48 +00:00
|
|
|
---
|
|
|
|
title: Build from source
|
|
|
|
x-toc-enable: true
|
|
|
|
...
|
|
|
|
|
2023-10-10 16:58:18 +00:00
|
|
|
WARNING: Flash from bin/, NOT elf/
|
|
|
|
==================================
|
|
|
|
|
|
|
|
**WARNING: When you build a ROM image from the Libreboot build system, please
|
|
|
|
ensure that you flash the appropriate ROM image from `bin/`, NOT `elf/`.
|
|
|
|
The `elf/` coreboot ROMs do not contain payloads. Libreboot's build system
|
|
|
|
builds no-payload ROMs under `elf/`, and payloads separately under `elf/`. Then
|
|
|
|
it copies from `elf/` and inserts payloads from `elf/`, and puts the final ROM
|
|
|
|
images (containing payloads) in `bin/`. This design is more efficient, and
|
|
|
|
permits many configurations without needless duplication of work. More info
|
|
|
|
is available in the [lbmk maintenance manual](../maintain/)**
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
|
2023-09-12 00:03:17 +00:00
|
|
|
libreboot's build system is named `lbmk`, short for `LibreBoot MaKe`, and this
|
2021-05-18 12:21:48 +00:00
|
|
|
document describes how to use it. With this guide, you can know how to compile
|
2022-11-14 02:31:12 +00:00
|
|
|
libreboot from the available source code.
|
2023-10-19 15:14:26 +00:00
|
|
|
|
|
|
|
The following document describes how `lbmk` works, and how you can make changes
|
|
|
|
to it: [libreboot maintenance manual](../maintain/)
|
|
|
|
|
|
|
|
Sources
|
|
|
|
=======
|
|
|
|
|
2022-11-14 02:31:12 +00:00
|
|
|
This version, if hosted live on libreboot.org, assumes that you are using
|
|
|
|
the `lbmk` git repository, which
|
2021-05-18 12:21:48 +00:00
|
|
|
you can download using the instructions on [the code review page](../../git.md).
|
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
A note about documentation (and this page)
|
|
|
|
------------------------------------------
|
|
|
|
|
|
|
|
From Libreboot 20231021 onwards, *all* releases (including 20231021)
|
|
|
|
have `lbwww.git` (the website) and `lbwww-img.git` (images for the website)
|
|
|
|
archived in the *src* tar archive for that release; older releases were hit
|
|
|
|
or miss, from 20210522 to 20230625, as to whether they came with documentation;
|
|
|
|
releases older than 20210522 generally always came with documentation. Modern
|
|
|
|
Libreboot documentation is written in Markdown (pandoc variant)
|
|
|
|
|
|
|
|
If you're working with *release* documentation, you don't get the full HTML
|
|
|
|
files (such as the one you're viewing now, if you're reading *this* page in a
|
|
|
|
web browser), so either read the Markdown files directly, or compile them to
|
|
|
|
HTML using the [Untitled Static Site Generator](https://untitled.vimuser.org/)
|
|
|
|
(which is what the Libreboot project uses to generate HTML from those files).
|
|
|
|
|
|
|
|
NOTE: `av.libreboot.org` is hardcoded as the domain name where images are
|
|
|
|
pointed to, in `lbwww.git`, so you will need to replace these references in
|
|
|
|
your local version, unless you're happy to just continue using those.
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2022-11-18 22:41:56 +00:00
|
|
|
Git
|
|
|
|
===
|
|
|
|
|
|
|
|
Libreboot's build system uses Git, extensively. You should perform the steps
|
|
|
|
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:
|
|
|
|
|
2023-01-08 01:22:04 +00:00
|
|
|
git config --global user.name "John Doe"
|
|
|
|
git config --global user.email johndoe@example.com
|
2022-11-18 22:41:56 +00:00
|
|
|
|
|
|
|
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-10-19 15:14:26 +00:00
|
|
|
You should ensure that the `python` command runs python 3, on your system.
|
|
|
|
Python2 is unused by lbmk or anything that it pulls down as modules.
|
|
|
|
|
|
|
|
If building on Debian/Ubuntu based systems, you can achieve that via:
|
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
sudo apt install python-is-python3
|
2023-10-19 15:14:26 +00:00
|
|
|
|
|
|
|
On Fedora, you can use the following
|
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
sudo dnf install python-unversioned-command
|
2022-11-18 22:41:56 +00:00
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
How to compile Libreboot
|
|
|
|
========================
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
Actual development/testing is always done using lbmk directly, and this
|
2021-05-18 12:21:48 +00:00
|
|
|
includes when building from source. Here are some instructions to get you
|
|
|
|
started:
|
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
First, install build dependencies
|
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
Libreboot includes a script that automatically installs build dependencies
|
2023-10-19 15:14:26 +00:00
|
|
|
according to the selected linux distro.
|
|
|
|
The currently supported distros are: Debian/Ubuntu/Linux Mint/Pop!\_OS,
|
|
|
|
Fedora, Arch Linux/Parabola or Void Linux.
|
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
Some examples (run them as root, use use e.g. `sudo`, `doas`):
|
2023-01-08 01:22:04 +00:00
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
./build dependencies ubuntu
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2023-10-19 15:51:36 +00:00
|
|
|
or
|
2021-11-18 07:23:15 +00:00
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
./build dependencies debian
|
2021-11-18 07:23:15 +00:00
|
|
|
|
2023-10-19 15:51:36 +00:00
|
|
|
or
|
2023-10-19 15:14:26 +00:00
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
./build dependencies fedora38
|
2023-10-19 15:14:26 +00:00
|
|
|
|
2023-10-19 15:51:36 +00:00
|
|
|
or
|
2023-10-19 15:14:26 +00:00
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
./build dependencies arch
|
2023-10-19 15:14:26 +00:00
|
|
|
|
2023-10-19 15:51:36 +00:00
|
|
|
NOTE: In case of Ubuntu 20.04 LTS or derived distros for that specific release,
|
2023-10-20 04:58:47 +00:00
|
|
|
use the dedicated configuration file:
|
2021-11-18 07:23:15 +00:00
|
|
|
|
2023-10-20 04:58:47 +00:00
|
|
|
./build dependencies ubuntu2004
|
2021-11-21 16:25:52 +00:00
|
|
|
|
2023-09-12 00:03:17 +00:00
|
|
|
Check: `config/dependencies/` for list of supported distros.
|
|
|
|
|
2023-04-09 21:38:30 +00:00
|
|
|
Technically, any Linux distribution can be used to build libreboot.
|
2021-05-18 12:21:48 +00:00
|
|
|
However, you will have to write your own script for installing build
|
|
|
|
dependencies.
|
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
Next, build ROM images
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Libreboot MaKe (lbmk) automatically runs all necessary commands; for
|
2023-10-20 05:07:57 +00:00
|
|
|
example, `./build roms` will automatically run `./build grub`
|
2023-10-10 17:17:39 +00:00
|
|
|
if the required GRUB payload (under `elf/grub/`) does not exist.
|
2021-05-18 12:21:48 +00:00
|
|
|
|
|
|
|
As a result, you can now (after installing the correct build dependencies) run
|
2023-09-12 00:03:17 +00:00
|
|
|
just a single command, from a fresh Git clone, to build all ROM images:
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2023-10-20 05:07:57 +00:00
|
|
|
./build roms all
|
2021-05-18 12:21:48 +00:00
|
|
|
|
|
|
|
or even just build specific ROM images, e.g.:
|
|
|
|
|
2023-10-20 05:07:57 +00:00
|
|
|
./build roms x60
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2023-09-12 00:03:17 +00:00
|
|
|
or get a list of supported build targets:
|
|
|
|
|
2023-10-20 05:07:57 +00:00
|
|
|
./build roms list
|
2023-09-12 00:03:17 +00:00
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
Or maybe just build payloads?
|
|
|
|
-----------------------------
|
|
|
|
|
2021-05-18 12:21:48 +00:00
|
|
|
If you wish to build payloads, you can also do that. For example:
|
|
|
|
|
2023-10-20 05:07:57 +00:00
|
|
|
./build grub
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2023-10-20 05:07:57 +00:00
|
|
|
./update trees -b seabios
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2023-10-20 05:07:57 +00:00
|
|
|
./update trees -b u-boot
|
2022-12-17 20:21:53 +00:00
|
|
|
|
2021-05-18 12:21:48 +00:00
|
|
|
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
|
2022-11-14 02:31:12 +00:00
|
|
|
lbmk.
|
2021-05-18 12:21:48 +00:00
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
Want to modify Libreboot?
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
Check the [lbmk maintenance manual](../maintain/) for guidance. You may for
|
|
|
|
example want to modify a config, e.g.:
|
|
|
|
|
|
|
|
./update trees -m coreboot x200_8mb
|
|
|
|
|
|
|
|
Or perhaps add a new board! The maintenance manual will teach you how the
|
|
|
|
Libreboot build system (lbmk) works!
|
|
|
|
|
2023-10-12 23:45:54 +00:00
|
|
|
Post-compilation steps
|
|
|
|
======================
|
|
|
|
|
|
|
|
So you compiled your Libreboot image? Congratulations!
|
|
|
|
|
|
|
|
Before you flash, please make sure that you *dumped* two copies of the original
|
|
|
|
firmware just in case (verifying the hashes of each dump, to ensure that they
|
|
|
|
match), using the `-r` option in flashrom.
|
|
|
|
|
|
|
|
There are some additional considerations:
|
|
|
|
|
|
|
|
Regarding binary blobs
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Firstly, you should read the Libreboot *Binary Blob Reduction Policy*:
|
|
|
|
<https://libreboot.org/news/policy.html>
|
|
|
|
|
|
|
|
A lot of mainboards in Libreboot will boot entirely with free software,
|
|
|
|
but there are certain newer mainboards supported in Libreboot
|
|
|
|
that need binary blobs added to them, mostly for minor initialisation tasks.
|
|
|
|
|
|
|
|
They are *automatically* inserted during the build process, but then deleted
|
|
|
|
during the *release* process; images built directly from lbmk can be flashed
|
|
|
|
without further modification, but release images need to have these files
|
|
|
|
re-inserted (e.g. KBC1126 EC firmware on HP EliteBooks). Please read this page
|
|
|
|
for context:
|
|
|
|
<https://libreboot.org/docs/install/ivy_has_common.html>
|
|
|
|
|
2023-10-21 23:13:48 +00:00
|
|
|
The scripts under directory `script/vendor/` are the ones that do this.
|
2023-10-20 05:07:57 +00:00
|
|
|
Specifically, `script/vendor/download`. The benefit of this is that you
|
2023-10-12 23:45:54 +00:00
|
|
|
do not need to extract anything from the original vendor image (e.g. Lenovo
|
|
|
|
UEFI image).
|
|
|
|
|
|
|
|
To know if this was performed on your board, you can read the Freedom Status
|
|
|
|
page which documents which files are used (if any), on which boards:
|
|
|
|
<https://libreboot.org/freedom-status.html>
|
|
|
|
|
|
|
|
There are specific files that you must know about, so they will be covered
|
|
|
|
next:
|
|
|
|
|
|
|
|
### Regarding CPU microcode
|
|
|
|
|
|
|
|
Libreboot release archives provide ROMs with or without CPU microcode updates,
|
|
|
|
but the newest revisions of lbmk (from `lbmk.git`) *only* build ROM images that
|
|
|
|
contain microcode updates, by default. Libreboot's build system contains a script
|
|
|
|
that will generate release archives, and this is used to provide Libreboot
|
|
|
|
releases; this script is what provides the images with microcode removed,
|
|
|
|
alongside the default ones generated by lbmk during the build.
|
|
|
|
|
|
|
|
Please read:
|
|
|
|
<https://libreboot.org/freedom-status.html#cpu-microcode>
|
|
|
|
|
|
|
|
The linked page has info, and includes instructions about how to manually remove
|
|
|
|
them, if you wish to do so. Removal of CPU microcode updates (on Intel/AMD
|
|
|
|
processors) will result in unpredictable security/stability issues, so beware.
|
|
|
|
|
|
|
|
Further context is provided in the Libreboot *Binary Blob Reduction Policy*:
|
|
|
|
<https://libreboot.org/news/policy.html>
|
|
|
|
|
|
|
|
We *recommend* that you do not delete these updates, but you have the freedom
|
|
|
|
to choose. Additionally: we have only tested certain mainboards under this
|
|
|
|
configuration. To know which ones they are, do this in `lbmk.git`:
|
|
|
|
|
|
|
|
cd config/coreboot/
|
|
|
|
git grep microcode_required
|
|
|
|
|
|
|
|
Example entry:
|
|
|
|
|
|
|
|
e6400_4mb/target.cfg:microcode_required="n"
|
|
|
|
|
|
|
|
If it says `="n"`, that means it has been tested. That *does not* mean it will
|
|
|
|
be stable, it's just that we're reasonably sure it will at least *boot* most
|
|
|
|
of the time, but you should expect random instability e.g. kernel panics.
|
|
|
|
|
|
|
|
If a given mainboard *excludes* `microcode_required` in `target.cfg`, or if
|
|
|
|
it says `microcode_required="y"`, then the release ROMs will only contain
|
|
|
|
microcode updates. Manual removal (as above) is still possible, but it has
|
|
|
|
not been tested and is not recommended.
|
|
|
|
|
|
|
|
NOTE: ARM-based chromebooks (that Libreboot supports) don't use microcode at
|
|
|
|
all. This section is only revelant for x86 (Intel/AMD).
|
|
|
|
|
|
|
|
### Regarding Nvidia GPU ROM (Dell Latitude E6400)
|
|
|
|
|
|
|
|
Dell Latitude E6400 comes in two variants: Nvidia graphics, or Intel graphics.
|
|
|
|
More information is available on the page:
|
|
|
|
<https://libreboot.org/docs/hardware/e6400.html>
|
|
|
|
|
|
|
|
The intel graphics model can boot with coreboot's native video initialisation,
|
|
|
|
which is free software. The *Nvidia* model (comes with Nvidia GPU) requires
|
|
|
|
proprietary code called a *VGA Option ROM* to initialise the video display in
|
|
|
|
early boot.
|
|
|
|
|
|
|
|
Libreboot automatically fetches this during the build process, inserting it into
|
|
|
|
the very same ROM image that can be flashed on either model, but the VGA ROM
|
2023-10-12 23:52:07 +00:00
|
|
|
will only be *executed* if you actually have the Nvidia *GPU* on your board.
|
2023-10-12 23:45:54 +00:00
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
**ALSO: Libreboot 20230625 did not support Nvidia models at all (only Intel).
|
|
|
|
In releases, only Libreboot 20231021 and newer will support it.**
|
2023-10-12 23:45:54 +00:00
|
|
|
|
2023-10-20 23:00:28 +00:00
|
|
|
Pre-built ROM images from release archives since 20231021 will *not* contain
|
2023-10-12 23:45:54 +00:00
|
|
|
this file by default, but it will be present if you compiled directly from lbmk.
|
|
|
|
To remove it, do this:
|
|
|
|
|
|
|
|
./cbutils/default/cbfstool libreboot.rom remove -n pci10de,06eb.rom
|
|
|
|
|
|
|
|
The cbfstool binary was compiled when your image (target `e6400_4mb`) was
|
|
|
|
compiled, which can alter the file system within your coreboot image.
|
|
|
|
|
|
|
|
Obviously, removing this VGA ROM will mean that the ROM image will only work
|
|
|
|
correctly on Intel GPU variants of E6400, but you probably knew that already!
|
|
|
|
|
|
|
|
(If you're using a release archive instead, you can re-insert the VGA ROM by
|
|
|
|
following [these instructions](../install/ivy_has_common.md))
|