|
|
Line 4: |
Line 4: |
|
| |
|
| == Building in nix-shell == | | == Building in nix-shell == |
| Note: the following was tested and working on NixOS 21.11 (Porcupine) while compiling the QEMU target for Coreboot v4.15 as well as Coreboot master (7b168c92f6).
| | Coreboot as of 24.02 comes with a Nix shell expression for x86 at <code>util/nixshell//devshell-i386.nix</code>. |
| | |
| To build your own coreboot bios:
| |
| | |
| Create a <code>shell.nix</code>, and run <code>nix-shell</code>
| |
| | |
| <syntaxhighlight lang="nix">
| |
| {
| |
| pkgs ? import <nixpkgs> { },
| |
| }:
| |
| | |
| # NOTE we need mkShellNoCC
| |
| # mkShell would add the regular gcc, which has no ada (gnat)
| |
| # https://github.com/NixOS/nixpkgs/issues/142943
| |
| pkgs.callPackage (
| |
| {
| |
| mkShellNoCC,
| |
| qemu,
| |
| pkg-config,
| |
| gnat11,
| |
| m4,
| |
| flex,
| |
| bison,
| |
| zlib,
| |
| ncurses,
| |
| }:
| |
| mkShellNoCC {
| |
| strictDeps = true;
| |
| # host/target agnostic programs
| |
| depsBuildBuild = [
| |
| qemu # override and change `hostCpuTargets` if cross-compiling
| |
| ];
| |
| # compilers & linkers & dependecy finding programs
| |
| nativeBuildInputs = [
| |
| pkg-config
| |
| gnat11 # gcc with ada
| |
| m4
| |
| flex
| |
| bison # Generate flashmap descriptor parser
| |
| ];
| |
| # libraries
| |
| buildInputs = [
| |
| zlib
| |
| ncurses # make menuconfig
| |
| ];
| |
| }
| |
| ) { }
| |
| </syntaxhighlight> | |
| | |
| Now we can build coreboot:
| |
|
| |
|
| <syntaxHighlight lang=bash> | | <syntaxHighlight lang=bash> |
Line 66: |
Line 17: |
| git submodule update --init --checkout --depth 1 | | git submodule update --init --checkout --depth 1 |
| du -sh . # ~700 MByte | | du -sh . # ~700 MByte |
| | |
| | nix-shell --pure util/nixshell/devshell-i386.nix |
|
| |
|
| # configure | | # configure |
| # set mainboard model, chip size, ... | | # set mainboard model, chip size, ... |
| make menuconfig MENUCONFIG_COLOR=blackbg # blackbg = dark mode | | make menuconfig MENUCONFIG_COLOR=blackbg # blackbg = dark mode |
|
| |
| # build toolchain for a x86 target
| |
| # Note: the i386 toolchain is used for all x86 platforms including x86_64.
| |
| # See https://doc.coreboot.org/tutorial/part1.html
| |
| # to list all targets: make help
| |
| make crossgcc-i386 CPUS=$(nproc)
| |
|
| |
|
| # build firmware | | # build firmware |