building_coreboot_from_source
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | building_coreboot_from_source [2023/04/16 12:04] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======= Building coreboot from source ======= | ||
+ | A step-by-step howto for a basic build of coreboot: | ||
+ | |||
+ | ===== Download, configure and build coreboot ===== | ||
+ | |||
+ | ==== Install tools and libraries required for coreboot ==== | ||
+ | |||
+ | === Trisquel 8.0 LTS " | ||
+ | |||
+ | $ sudo apt install -y bison build-essential curl flex git gnat-5 libncurses5-dev m4 zlib1g-dev cmake gcc-multilib iasl | ||
+ | |||
+ | //If you are using a different distribution you might need to install the basic gcc toolchain, wget, make and/or other packages.// | ||
+ | |||
+ | ==== Download coreboot source tree ==== | ||
+ | |||
+ | $ git clone https:// | ||
+ | $ cd coreboot | ||
+ | |||
+ | //This will download a ' | ||
+ | |||
+ | ==== Build the coreboot toolchain ==== | ||
+ | |||
+ | Please note that this can take a significant amount of time (e.g. ~6 minutes on a Vikings D8 with 8 cores) | ||
+ | |||
+ | $ make crossgcc-i386 CPUS=$(nproc) | ||
+ | |||
+ | " | ||
+ | |||
+ | $ make crossgcc-i386 CPUS=1 | ||
+ | |||
+ | //This builds one of the coreboot cross-compiler toolchains for x86 platforms. Because of the variability of compilers and the other required tools between the various operating systems that coreboot can be built on, coreboot supplies and uses its own cross-compiler toolchain to build the binaries that end up as part of the coreboot ROM. The toolchain provided by the operating system (the 'host toolchain' | ||
+ | |||
+ | ==== Build the payload - coreinfo ==== | ||
+ | |||
+ | $ make -C payloads/ | ||
+ | $ make -C payloads/ | ||
+ | |||
+ | //To actually do anything useful with coreboot, you need to build a payload to include in the rom. The idea behind coreboot is that it does the minimum amount possible before passing control of the machine to a payload. There are various payloads such as grub or SeaBIOS that are typically used to boot the operating system. Instead, we used coreinfo, a small demonstration payload that allows the user to look at various things such as memory and the contents of coreboot' | ||
+ | |||
+ | ==== Configure the mainboard ==== | ||
+ | |||
+ | This example configures a QEMU " | ||
+ | |||
+ | $ make menuconfig | ||
+ | select ' | ||
+ | Beside ' | ||
+ | Beside ' | ||
+ | select exit | ||
+ | | ||
+ | select ' | ||
+ | select ' | ||
+ | choose ' | ||
+ | select ' | ||
+ | enter ' | ||
+ | select exit | ||
+ | select exit | ||
+ | select ' | ||
+ | |||
+ | //This step configures coreboot' | ||
+ | |||
+ | //Anytime you change mainboards in Kconfig, you should always run "make distclean" | ||
+ | |||
+ | ==== Build coreboot ==== | ||
+ | |||
+ | $ make | ||
+ | |||
+ | At the end of the build, you should see: | ||
+ | |||
+ | Built emulation/ | ||
+ | |||
+ | This means your build was successful. The output from the build is in the build directory, so you'll find the rom file at ' | ||
+ | |||
+ | //You may notice that a number of other pieces are downloaded at the beginning of the build process. These are the git submodules used in various coreboot builds. By default, the BLOBs submodule is not downloaded. This git submodule may be required for other builds for microcode or other binaries. To enable downloading this submodule, select the option "Allow use of binary-only repository" | ||
+ | |||
+ | //This attempts to build the coreboot rom. The rom file itself ends up in the build directory as ' | ||
+ | |||
+ | ===== Test the image using QEMU ===== | ||
+ | |||
+ | ==== Install QEMU ==== | ||
+ | |||
+ | $ sudo apt install -y qemu | ||
+ | |||
+ | //QEMU is a processor emulator which we can use to show coreboot.// | ||
+ | |||
+ | ==== Run QEMU ==== | ||
+ | |||
+ | No need to mention that this won't work in a headless system configuration. | ||
+ | |||
+ | Start QEMU, and point it to the ROM you just built: | ||
+ | |||
+ | $ qemu-system-x86_64 -bios build/ | ||
+ | |||
+ | You should now see the serial output of coreboot in the original console window and a new window will appear running the coreinfo payload. | ||
+ | |||
+ | Here's the command line broken down: | ||
+ | |||
+ | qemu-system-x86_64 | ||
+ | |||
+ | This starts the QEMU emulator with the i440FX host PCI bridge and PIIX3 PCI to ISA bridge. | ||
+ | |||
+ | < | ||
+ | |||
+ | Use the bios rom image that we just built. If this is left off, the standard SeaBIOS image that comes with QEMU is used. | ||
+ | |||
+ | < | ||
+ | |||
+ | Send the serial output to the console. This allows you to view the coreboot debug output. |
building_coreboot_from_source.txt · Last modified: 2023/04/16 12:04 by thum