A minimal alternative to systemd-stub(7) that serves a single purpose:
Automatically loading machine specific device trees embedded within the kernel image.
ubustub is compatible with systemd-stub(7) and ukify(1). It is designed to seamlessly integrate with Ubuntu's current bootloader and boot security model. The resulting kernel image can be signed and verified and loaded by grub like any other kernel.
Before loading the kernel, the stub generates hwids of the running machine derived from smbios and compares them to an embedded lookup table in the .hwids section of the kernel image. If a match is found it loads the corresponding device tree from the .dtbauto section before jumping tothe bundled kernel.
# apt install python3-pyelftools systemd-ukify
Build the stub:
$ make
For a simple combined kernel+ubustub image bundling a single DTB you can run:
$ ukify build --linux=/boot/vmlinuz --stub=ubustub.efi --hwids=hwids/json --dtbauto=/boot/dtb --output=vmlinuz.efi
The .txt files in hwids/txt have been generated with fwupdtool hwids.
The can be converted to .json files by running hwid2json.py from the
hwids directory. The compatible field of the resulting JSON files has
to be filled in manually.
This project is originally based on
systemd-stub
from the systemd project.
The .dtbauto feature in systemd was contributed by
anonymix007.
It is inspired by the dtbloader
project by Nikita Travkin and
DtbLoader.efi
from the aarch64-laptops project.