Skip to content

Prepare to support UKIs - #523

Merged
arnaldo2792 merged 5 commits into
bottlerocket-os:developfrom
arnaldo2792:uki-support/kernel-kit
Aug 14, 2026
Merged

Prepare to support UKIs#523
arnaldo2792 merged 5 commits into
bottlerocket-os:developfrom
arnaldo2792:uki-support/kernel-kit

Conversation

@arnaldo2792

@arnaldo2792 arnaldo2792 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description of changes:

This series prepares the kernel kit to support Unified Kernel Images.

The first commit in the series prevents grub from being used with a variant that opt-in to use the new UKI format, and makes it provide the %{_cross_os}bootloader(efi) capability.

The second commit in the series prepares an extra copy of the shim that looks for systemd-boot instead of GRUB, and re-structures the spec to resolve either subpackage depending on the features enabled for the variant.

The remaining commits in the series drop a patch to don't measure PCR9 in the kernel. systemd-boot triggering PCR9 measurements in the kernel, but this patch prevented the kernel from actually updating the PCR. The side-effect is that in GRUB-based AMIs, PCR9 measurements will be as follows:

  • in x86_64, no changes, as the kernel lacks the support to measure PCR9 with GRUB
  • in aarch64, two PCR9 measurements: the kernel measures the cmdline once and user space measures again, with the updated parameters provided by bootconfig.

Testing done:

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Provide the bootloader(efi) RPM capability so newer versions of
twoliter and the core kit, which support UKI, can depend on it to
select GRUB as the EFI bootloader.

Conflict with the uki-image feature, since UKI images require
systemd-boot instead of GRUB.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
Comment thread packages/shim/shim.spec
Comment thread packages/shim/shim.spec Outdated
Comment thread packages/shim/shim.spec
Comment thread packages/shim/shim.spec
Comment thread packages/shim/shim.spec
Comment on lines +97 to +98
find %{_builddir}/build-grub -name '%{mokm_efi_image}' -exec \
cp {} "%{buildroot}%{efidir}/%{mokm_efi_image}" \;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] MokManager is copied only from build-grub but shipped in the base package

%install copies mm*.efi exclusively out of the build-grub tree, and the resulting file is packaged in the base %files list (line 104), which is installed alongside both subpackages.

Concerns:

  1. Asymmetric build coupling. MokManager doesn't depend on DEFAULT_LOADER, so both build trees produce it. Sourcing it only from build-grub couples the base package to that specific build. If a follow-up PR conditionally disables the grub build for UKI-only variants (e.g., wraps lines 77, 80-81 in %if !%{uki_only}), the base %files list still references %{efidir}/%{mokm_efi_image} and the build breaks non-obviously.
  2. find … -exec cp doesn't signal 'no match'. find returns 0 whether or not it matched. If the grub build silently stops producing mm*.efi in the future, the failure surfaces later at %files ("File not found") rather than at the copy step.

Suggested fix: either copy mm*.efi from build-systemd-boot (identical bits, decoupled from the grub build) or add a brief comment stating that MokManager is loader-independent and either build tree is acceptable, e.g.:

# MokManager is not affected by DEFAULT_LOADER; either build tree is fine.
find %{_builddir}/build-grub -name '%{mokm_efi_image}' -exec \
  cp {} "%{buildroot}%{efidir}/%{mokm_efi_image}" \;

Confidence: ~60%.

Comment thread packages/shim/shim.spec
Split shim into two subpackages: one that chain-loads GRUB (installed
at the current location, for backwards compatibility) and a new one
that chain-loads systemd-boot instead.

Older versions of twoliter don't understand the 'uki-image' feature,
so the GRUB subpackage's requirements are left unrestricted to remain
installable there. To prevent it from being pulled in on UKI images
with newer twoliter versions, it instead conflicts with the
uki-image feature; the systemd-boot subpackage conflicts with
no-uki-image accordingly.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
The patch prevented systemd-boot from measuring PCR9

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
The patch prevented systemd-boot from measuring PCR9

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
The patch prevented systemd-boot from measuring PCR9

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
@arnaldo2792
arnaldo2792 force-pushed the uki-support/kernel-kit branch from 7a7e783 to 860c8d6 Compare August 13, 2026 17:34
@arnaldo2792
arnaldo2792 marked this pull request as ready for review August 14, 2026 21:28
@arnaldo2792
arnaldo2792 merged commit c8522f1 into bottlerocket-os:develop Aug 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants