Build HOWTO: Difference between revisions
(add multi-threaded crossgcc build) |
(split into Intel and AMD boards, explain payloads, add list of required blobs) |
||
Line 24: | Line 24: | ||
The result of this step should be an ELF file (e.g. filo.elf, or coreinfo.elf) which you can use with coreboot (see below). | The result of this step should be an ELF file (e.g. filo.elf, or coreinfo.elf) which you can use with coreboot (see below). | ||
Most beginners want to use the default [[SeaBIOS]] payload. It runs Option ROMs, is able to discover boot devices and provides a very simple boot menu. | |||
There's no need to build SeaBIOS by hand, it is done by coreboot. | |||
== Building coreboot == | == Building coreboot == | ||
Line 49: | Line 53: | ||
** In '''Mainboard model''' select your exact mainboard name. | ** In '''Mainboard model''' select your exact mainboard name. | ||
** In '''ROM chip size''' select the exact size of the flash ROM chip you want to flash the coreboot image on. (see output of <code>flashrom</code> command) | ** In '''ROM chip size''' select the exact size of the flash ROM chip you want to flash the coreboot image on. (see output of <code>flashrom</code> command) | ||
* | |||
=== Intel boards === | |||
For Intel boards you have to provide files coreboot can't generate by itself: | |||
* [[Intel Flash Descriptor region]] | |||
* [[Intel Gigabit Ethernet firmware]] | |||
* [[Intel Management Engine]] | |||
Please have a look at [[Binary situation]] for a full overview. | |||
The files have to be extracted from your vendor bios. | |||
* Enter the '''Chipset''' menu | |||
** Do the following based on which blobs you have: | ** Do the following based on which blobs you have: | ||
** Untick '''Build with a fake IFD''' (descriptor.bin) | ** Untick '''Build with a fake IFD''' (descriptor.bin) | ||
** Tick '''Add gigabit ethernet firmware''' (gbe.bin) | ** Tick '''Add gigabit ethernet firmware''' (gbe.bin) | ||
** Tick '''Add Intel Management Engine firmware''' (me.bin) | ** Tick '''Add Intel Management Engine firmware''' (me.bin) | ||
=== AMD boards === | |||
For AMD boards you have to provide files coreboot can't generate by itself: | |||
* [[NIC firmware]] | |||
* [[AMD IMC]] | |||
* [[AMD XHCI]] | |||
Please have a look at [[Binary situation]] for a full overview. | |||
The files have to be extracted from your vendor bios. | |||
=== Choose the payload === | |||
Here's the full list of supported [[Payloads]]. | |||
By default, the [[SeaBIOS]] payload will be downloaded and built during the coreboot build process. | |||
If you want to use another payload (ELF for example): | |||
* Enter the '''Payload''' menu. | * Enter the '''Payload''' menu. | ||
** Set the '''Add a payload''' option to '''An ELF executable payload'''. | |||
** Then, specify the file name and path to your payload file (which you built before). | |||
=== VGA support === | |||
In order to see something on your screen the graphic card has to be initialized by the [[VGA BIOS]] which is actually an [[Option ROM]]. | |||
[[VGA support]] is required for payloads such as GRUB or elf-memtest86+-5.01. | |||
It isn't required for operating systems such as GNU/Linux as it initializes the graphic card by itself. | |||
On some platforms there's support for [[native gfx init]]. A VGA BIOS isn't required. | |||
=== Compiling === | |||
You also need to build crossgcc (highly recommended because distributions patch gcc in ways that introduce bugs when building coreboot): | You also need to build crossgcc (highly recommended because distributions patch gcc in ways that introduce bugs when building coreboot): | ||
Line 111: | Line 152: | ||
== Flashing coreboot == | == Flashing coreboot == | ||
You can flash the coreboot image on a flash ROM chip using either an external EEPROM-programmer or a mainboard using the [http://www.flashrom.org flashrom] user-space utility. | You can [[flashing coreboot|flash]] the coreboot image on a flash ROM chip using either an external EEPROM-programmer or a mainboard using the [http://www.flashrom.org flashrom] user-space utility. |
Revision as of 07:57, 12 October 2015
This page describes how you can build a coreboot image for your specific mainboard.
Requirements
- gcc / g++ (gcc-multilib is ideal, makes building payloads a lot easier)
- make
- cmake (if using clang/llvm)
- ncurses-dev (for make menuconfig)
Optional:
- doxygen (for generating/viewing documentation)
- iasl (for targets with ACPI support)
- gdb (for better debugging facilities on some targets)
- flex and bison (for regenerating parsers)
Building a payload
First you need to download the source code for the payload of your choice and build it.
Instructions for building the various payloads are not covered on this page, please see Payloads and the wiki page for the respective payload for details.
The result of this step should be an ELF file (e.g. filo.elf, or coreinfo.elf) which you can use with coreboot (see below).
Most beginners want to use the default SeaBIOS payload. It runs Option ROMs, is able to discover boot devices and provides a very simple boot menu.
There's no need to build SeaBIOS by hand, it is done by coreboot.
Building coreboot
First, get the latest coreboot version from our git repository:
$ git clone http://review.coreboot.org/p/coreboot $ cd coreboot $ git submodule update --init --checkout
The last step is important! It checks out a sub-repository in the 3rdparty directory.
In the coreboot directory you can configure the build-time options of coreboot:
$ make menuconfig
OR
$ make nconfig (easier to navigate, uses ncurses)
In that menu (which may look familiar, as other projects such as the Linux kernel or busybox use the same system), select at least the following options:
- Enter the Mainboard menu.
- In Mainboard vendor select the vendor of your board.
- In Mainboard model select your exact mainboard name.
- In ROM chip size select the exact size of the flash ROM chip you want to flash the coreboot image on. (see output of
flashrom
command)
Intel boards
For Intel boards you have to provide files coreboot can't generate by itself:
Please have a look at Binary situation for a full overview. The files have to be extracted from your vendor bios.
- Enter the Chipset menu
- Do the following based on which blobs you have:
- Untick Build with a fake IFD (descriptor.bin)
- Tick Add gigabit ethernet firmware (gbe.bin)
- Tick Add Intel Management Engine firmware (me.bin)
AMD boards
For AMD boards you have to provide files coreboot can't generate by itself:
Please have a look at Binary situation for a full overview. The files have to be extracted from your vendor bios.
Choose the payload
Here's the full list of supported Payloads.
By default, the SeaBIOS payload will be downloaded and built during the coreboot build process.
If you want to use another payload (ELF for example):
- Enter the Payload menu.
- Set the Add a payload option to An ELF executable payload.
- Then, specify the file name and path to your payload file (which you built before).
VGA support
In order to see something on your screen the graphic card has to be initialized by the VGA BIOS which is actually an Option ROM.
VGA support is required for payloads such as GRUB or elf-memtest86+-5.01.
It isn't required for operating systems such as GNU/Linux as it initializes the graphic card by itself.
On some platforms there's support for native gfx init. A VGA BIOS isn't required.
Compiling
You also need to build crossgcc (highly recommended because distributions patch gcc in ways that introduce bugs when building coreboot):
$ make crossgcc
Or alternatively to build with more than one thread, invoke the cross compiler build script directly (in this example eight threads):
$ util/crossgcc/buildgcc -j 8
In case something fails, try to search for the relevant log (find . -name '*.log' | xargs grep Error
) and examine last few lines of it.
That's the bare minimum. Feel free to adjust the other settings to your needs (see Coreboot Options for the full list), then exit menuconfig and build the coreboot image:
$ make
The file build/coreboot.rom is your final coreboot image you can flash onto a ROM chip or add payloads to with cbfstool.
Compiling with Clang/LLVM
We have been working on building coreboot with clang/llvm and it basically works. Remaining issues can be reported upstream and then block this meta bug here:
META Compiling the Coreboot with clang
The default and recommended flow is still to use crossgcc.
Known issues
Make sure you really have all the requirements installed!
With certain versions of the gcc/ld toolchain shipped in some Linux distributions, it's possible that you'll see the following error when building coreboot:
src/arch/x86/coreboot_ram.ld:129 cannot move location counter backwards
This is a known bug in those versions of the toolchain. Before sending a complaint message to our mailing list, please try to switch to our reference cross-compilation toolkit then recompile the sources. To switch to the cross-compiler just run
$ make crossgcc
Then remove the .xcompile file and retry the compilation process:
$ rm .xcompile $ make
Development version
If you want to contribute a patch or report an issue about coreboot, you will need to set up your environment for full development.
You must run make crossgcc and rebuild coreboot before reporting an issue or contributing a patch.
To get set up to submit a patch please run make gitconfig, then register with gerrit.
Flashing coreboot
You can flash the coreboot image on a flash ROM chip using either an external EEPROM-programmer or a mainboard using the flashrom user-space utility.