Coreboot: Difference between revisions
imported>Milahu m remove outdated section: compiler version |
imported>Milahu + Skip building toolchain |
||
Line 55: | Line 55: | ||
qemu-system-x86_64 -bios build/coreboot.rom -serial stdio | qemu-system-x86_64 -bios build/coreboot.rom -serial stdio | ||
</syntaxHighlight> | </syntaxHighlight> | ||
== Skip building toolchain == | |||
We can use our system toolchain to build coreboot firmware, but this is not recommended per [https://doc.coreboot.org/tutorial/part1.html coreboot docs]: | |||
<blockquote> | |||
you can possibly use your system toolchain, but the results are not reproducible, and may have issues, so this is not recommended | |||
</blockquote> | |||
To use the system toolchain, in <code>make menuconfig</code>, enable <code>General Setup > Allow building with any toolchain</code> | |||
== Building as derivation == | == Building as derivation == | ||
Line 62: | Line 72: | ||
== See also == | == See also == | ||
* https://doc.coreboot.org/tutorial/part1.html | |||
* https://www.coreboot.org/Build_HOWTO | * https://www.coreboot.org/Build_HOWTO | ||
* https://www.coreboot.org/Lesson1 | * https://www.coreboot.org/Lesson1 |
Revision as of 12:35, 26 October 2021
Building in nix-shell
To build your own coreboot bios:
Create a shell.nix
, and run nix-shell
# shell.nix
# NOTE we need mkShellNoCC
# mkShell would add the regular gcc, which has no ada (gnat)
# https://github.com/NixOS/nixpkgs/issues/142943
with import <nixpkgs> { };
mkShellNoCC {
buildInputs = [
gnat11 # gcc with ada
#gnatboot # gnat1
ncurses # make menuconfig
#bison # generate parsers
#flex
#clang
zlib
#acpica-tools # iasl
pkgconfig
qemu # test the image
];
shellHook = ''
# TODO remove?
NIX_LDFLAGS="$NIX_LDFLAGS -lncurses"
'';
}
Now we can build coreboot:
git clone https://review.coreboot.org/coreboot.git --depth 1
cd coreboot
du -sh . # 200 MByte
git submodule update --init --checkout --depth 1
du -sh . # 700 MByte
# configure
# set mainboard, flash size, ...
make menuconfig
# build toolchain
# this can take some hours
make crossgcc CPUS=$(nproc)
# build firmware
make
# test firmware
qemu-system-x86_64 -bios build/coreboot.rom -serial stdio
Skip building toolchain
We can use our system toolchain to build coreboot firmware, but this is not recommended per coreboot docs:
you can possibly use your system toolchain, but the results are not reproducible, and may have issues, so this is not recommended
To use the system toolchain, in make menuconfig
, enable General Setup > Allow building with any toolchain
Building as derivation
coreboot is pretty picky about the toolchain it is built with and thus using the toolchain it comes with is the easiest path to success. There are commented Nix expressions that build coreboot here.