No description
Find a file
Tobias Heider cfbb9c32a6 Makefile: Default to /usr/local PREFIX to not conflict with package
Signed-off-by: Tobias Heider <tobias.heider@canonical.com>
2026-02-05 12:09:44 +01:00
hwids Add microsoft,denali-oled dump from Jérôme de Bretagne 2026-01-21 00:08:15 +01:00
include efi-log: Call ourselves stubble 2026-02-02 12:36:38 +01:00
.gitignore Rename build products to ubustub 2025-08-01 16:35:10 +02:00
chid.c chid: MANUFACTURER + FAMILY is ambiguous, don't match 2025-08-12 12:15:27 +02:00
devicetree.c delete unused code and systemd features we do not require 2025-08-07 19:28:58 +02:00
edid.c Merge edid and edid-fundamental 2025-08-01 16:35:10 +02:00
efi-log.c efi-log: Call ourselves stubble 2026-02-02 12:36:38 +01:00
efi-string.c Remove -DSD_BOOT 2025-08-01 16:35:10 +02:00
elf2efi.py Do not set NX_COMPAT flag until linux.c is actually NX compatible 2025-08-11 10:06:31 +01:00
initrd.c boot: Clean up includes 2025-05-22 11:10:20 +02:00
LICENSE.LGPL2.1 Copy LGPL from systemd 2025-08-01 16:35:10 +02:00
linux.c Fixup loader. Actually pass path, restore when entry() returns 2025-08-21 16:20:34 +02:00
Make.defaults Make.defaults: stop forcing -fwide-exec-charset=UCS2 with clang 2026-01-30 12:00:45 +01:00
Makefile Makefile: Default to /usr/local PREFIX to not conflict with package 2026-02-05 12:09:44 +01:00
measure.c re-add command line measurement to PCR12 2025-08-07 19:28:58 +02:00
pe.c Default to matching included dtbs based on compatible. 2025-08-21 15:20:15 +02:00
README.md README: correct description of device-tree selection 2026-02-05 11:31:56 +01:00
sha1.c Remove unused includes and headers 2025-08-08 10:52:50 +02:00
smbios.c boot: Clean up includes 2025-05-22 11:10:20 +02:00
stub.c parse_cmdline: cmdline can be NULL, don't fail hard 2026-01-21 13:35:52 +01:00
uki.c Initial import from systemd. 2025-08-01 16:35:10 +02:00
util.c delete unused code and systemd features we do not require 2025-08-07 19:28:58 +02:00

Stubble

A minimal UEFI kernel boot stub that serves a single purpose:

Loading machine specific device trees embedded within a kernel image.

stubble 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.

Command-line parameters

  • debug: Enable debug logging
  • stubble.dtb_override=true/false: Enable or disable device-tree compat based dtb lookup. The default is true.

Dependencies

# apt install python3-pyelftools systemd-ukify

Building

Build the stub:

$ make

Device-tree selection

Stubble supports two mechanisms for selecting a device-tree:

If a device-tree has been installed by the firmware as an EFI configuration table, Stubble compares the compatible string of that device-tree to the compatible strings of the appended device-trees. If a match is found, the pre-installed device-tree is replaced by the one coming with with Stubble.

If no device-tree has been installed by the firmware, properties values (HWIDs) in the SMBIOS table are used to select one of the appended device-trees. This mechanism is used for boards that only come with ACPI tables but were the kernel does not support booting via ACPI.

The HWID based rules must be supplied as a directory with JSON files.

The .txt files in hwids/txt are generated with hwids.py and 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.

Bundling with kernel

Systemd's ukify tool can be used to append a kernel, device-trees in flattened device tree format (DTB), and hardware ID JSON files to the Stubble stub.

For a simple combined kernel+stubble image bundling a single DTB you can run:

$ ukify build --linux=/boot/vmlinuz --stub=stubble.efi --hwids=hwids/json \
--devicetree-auto=/boot/dtb --output=vmlinuz.efi

Add more --device-tree-auto= parameters for further device-trees.

Adding new devices

If you would like to add support for a device that please open a pull request adding the output of sudo fwupdtool hwids as a new file in hwids/txt.

Acknowledgements

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.