2017-12-21 17:13:26 +00:00
|
|
|
# linuxboot
|
2018-01-27 20:12:16 +00:00
|
|
|
The LinuxBoot project allows you to replace your server's firmware with Linux.
|
2018-01-20 16:23:56 +00:00
|
|
|
|
2018-01-27 20:12:16 +00:00
|
|
|
Supported server mainboards
|
|
|
|
===
|
|
|
|
* qemu emulated Q35 systems
|
|
|
|
* [Intel S2600WF](https://trmm.net/S2600wf)
|
|
|
|
* [Dell R630](https://trmm.net/NERF)
|
2018-02-06 22:12:45 +00:00
|
|
|
* Winterfell Open Compute node (works well)
|
2018-04-12 18:03:06 +00:00
|
|
|
* Leopard Open Compute node (works well)
|
|
|
|
* Tioga Pass Open Compute node (works well)
|
2018-02-06 22:12:45 +00:00
|
|
|
* Monolake Open Compute node (not tested)
|
2018-01-27 20:12:16 +00:00
|
|
|
|
|
|
|
Build instructions
|
|
|
|
===
|
2018-06-29 22:22:29 +00:00
|
|
|
Make sure you have installed the dependencies `uuid-dev`, `nasm`, and
|
|
|
|
`acpica-tools` (or equivalent for your distribution).
|
|
|
|
|
2018-01-27 20:12:16 +00:00
|
|
|
You need to provide:
|
|
|
|
* The vendor UEFI firmware for the mainboard
|
|
|
|
* A Linux kernel built with the `CONFIG_EFI_BDS` option enabled
|
|
|
|
* An `initrd.cpio` file with enough tools to `kexec` the rest of the system.
|
|
|
|
|
|
|
|
For the `initrd`, the [Heads firmware](http://osresearch.net/) or
|
|
|
|
[u-root](https://github.com/u-root/u-root) systems work well.
|
|
|
|
Both will build minimal runtimes that can fit into the few megabytes
|
|
|
|
of space available.
|
|
|
|
|
2018-01-27 20:15:19 +00:00
|
|
|
For everything except qemu, you'll need to copy the vendor ROM dump
|
|
|
|
to `boards/$(BOARD)/$(BOARD).rom`. Due to copyright restrictions, we can't
|
|
|
|
bundle the ROM images in this tree and you must supply your own ROM from
|
|
|
|
your own machine. qemu can built its own ROM from the `edk2` tree,
|
|
|
|
so this is not necessary.
|
|
|
|
|
2018-01-27 20:12:16 +00:00
|
|
|
Configure the build system:
|
|
|
|
|
2018-01-27 20:15:19 +00:00
|
|
|
cp path/to/s2600wf.rom boards/s2600wf/
|
2018-01-27 20:12:16 +00:00
|
|
|
make \
|
|
|
|
BOARD=s2600wf \
|
|
|
|
KERNEL=../path/to/bzImage \
|
|
|
|
INITRD=../path/to/initrd.cpio.xz \
|
|
|
|
config
|
2018-01-27 20:15:19 +00:00
|
|
|
make
|
2018-01-27 20:12:16 +00:00
|
|
|
|
|
|
|
This will write the values into the `.config` file so that you don't
|
2018-01-27 20:15:19 +00:00
|
|
|
need to specify them each time. If all goes well you will end up with
|
|
|
|
a file in `build/$(BOARD)/linuxboot.rom` that can be flashed to your machine.
|
2018-01-27 20:17:01 +00:00
|
|
|
It will take a while since it also clones the LinuxBoot patched version
|
2018-01-27 20:19:48 +00:00
|
|
|
of [`tianocore/edk2` UDK2018 branch](https://github.com/linuxboot/edk2/tree/UDK2018)
|
|
|
|
and build it.
|
2018-01-27 20:12:16 +00:00
|
|
|
|
|
|
|
|
2018-01-27 20:15:19 +00:00
|
|
|
Emulating with qemu
|
|
|
|
===
|
2018-01-20 16:23:56 +00:00
|
|
|
|
2018-01-27 20:15:19 +00:00
|
|
|
If you want to experiment with LinuxBoot you can run it under qemu.
|
|
|
|
No ROM file is necessary, although you still need a Heads or NERF runtime
|
|
|
|
kernel/initrd pair. You can launch the emulator by running:
|
2018-01-27 20:12:16 +00:00
|
|
|
|
|
|
|
make run
|
|
|
|
|
|
|
|
This will use your current terminal as the serial console, which
|
|
|
|
will likely mess with the settings. After killing qemu by closing
|
|
|
|
the window you will need to run `stty sane` to restore the terminal
|
|
|
|
settings (echo is likely turned off, so you'll have to type this in
|
|
|
|
the blind).
|
|
|
|
|
|
|
|
|
|
|
|
Adding a new mainboard
|
2018-01-20 16:23:56 +00:00
|
|
|
===
|
|
|
|
|
2018-01-27 20:12:16 +00:00
|
|
|
Copy `Makefile.board` from one of the other mainboards and edit it to match
|
|
|
|
your new board's ROM layout. The qemu one is not the best example since it has
|
|
|
|
to match the complex layout of OVMF; most real mainboards are not this messy.
|
|
|
|
|
|
|
|
You'll need to figure out which FVs have to be preserved, how much space
|
|
|
|
can be recovered from the ME region, etc. The per-board makefile needs
|
|
|
|
to set the following variables:
|
|
|
|
|
|
|
|
* `FVS`: an ordered list of IFD, firmware volumes and padding
|
|
|
|
* `linuxboot-size`: the final size of the ROM image in bytes (we should verify this against the real ROM instead)
|
|
|
|
|
|
|
|
|
|
|
|
More info
|
|
|
|
===
|
|
|
|
* https://www.linuxboot.org/
|
|
|
|
* https://trmm.net/LinuxBoot_34c3
|
2018-01-20 16:23:56 +00:00
|
|
|
|