---
title: Compile RBoot from source
x-toc-enable: true
...

If you need to build RBoot from source, this guide is for you.

libre BIOS/UEFI firmware
------------

RBoot's build system is named `rbmk`, short for `RBoot MaKe`, and this
document describes how to use it. With this guide, you can know how to compile
rboot from the available source code.

The following document describes how `rbmk` works, and how you can make changes
to it: [rboot maintenance manual](../maintain/)

### WARNING: eCryptfs file name limits

Do not run the build system on a eCryptfs file system, because it has
very short file name limits and RBoot's build system deals with very
long file names.

System requirements
-------------------

You must ensure that you have the correct operating system, CPU, RAM, disk space
and so on.

System requirements are documented in
the [rbmk maintenance manual](../maintain/#system-requirements).

Multi-threaded builds
---------------------

RBoot's build system defaults to a single build thread, but you can change
it by doing e.g.

	export XBMK_THREADS=4

This would make rbmk run on 4 threads.

More specifically: when compiling source trees via `script/trees`, `-jTHREADS`
is passed, where THREADS is the number of threads. This is also set when running
xz commands for compression, using the `-t` option.

Environmental variables
-----------------------

Please read about environmental variables in [the build
instructions](../maintain/), before running rbmk. You should set
your variables accordingly, though you do not technically need to; some
of them may be useful, e.g. `XBMK_THREADS` (sets the number of build threads).

Sources
-------

This version, if hosted live on rboot.org, assumes that you are using
the `rbmk` git repository, which
you can download using the instructions on [the code review page](../../git.md).

Git
---

RBoot'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:

	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>

How to compile RBoot

Actual development/testing is always done using rbmk directly, and this
includes when building from source. Here are some instructions to get you
started:

### Zero..st, check time/date

Make sure date/hwclock report the correct time and date on your system,
because parts of the build process download from HTTPS servers and wrong
time or date can cause connections to be dropped during negotiation.

### First, install build dependencies

Check `config/dependencies/` for list of supported distros.

Some examples (run them as root, use e.g. `sudo`, `doas`):

	./mk dependencies parabola

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

### MIPS cross compiler

RBoot has support for the Sony PlayStation (PS1/PSX), based on
the PCSX-Redux Open BIOS. If you're doing a full release build, and/or
specifically building the PSX BIOS, you need a MIPS cross compiler.

If your distro doesn't have the MIPS compiler available,
the [PlayStation](../install/playstation.md) page provides instructions for
manual installation; please do this in addition to the normal dependencies.

### Next, build ROM images

RBoot MaKe (rbmk) automatically runs all necessary commands; for
example, `./mk -b coreboot` will automatically build the required payloads
if not already compiled.

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

	./mk -b coreboot

To get a list of targets, do:

	./mk -b coreboot list

Then from the target list, you can pick one, for example:

	./mk -b coreboot lenovo_thinkpad_x60_2mb_bios

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
rbmk.

Want to modify RBoot?
-------------------------

Check the [rbmk maintenance manual](../maintain/) for guidance. You may for
example want to modify a config, e.g.:

	./mk -m coreboot lenovo_thinkpad_x200_8mb_bios

Or perhaps add a new board! The maintenance manual will teach you how the
RBoot build system (rbmk) works!

A note about documentation (and this page)
-------------------------------

So you compiled your RBoot 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 flashprog.


[//]: # "SPDX-License-Identifier: GFDL-1.3-or-later"


