Skip to content

Prepare to support UKIs - #1007

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

Prepare to support UKIs#1007
arnaldo2792 merged 9 commits into
bottlerocket-os:developfrom
arnaldo2792:uki-support/core-kit

Conversation

@arnaldo2792

Copy link
Copy Markdown
Contributor

Description of changes:

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

Build systemd-boot and systemd-stub for systemd-257. A patch for systemd was needed to prevent it from building these binaries for the wrong CPU architectures (32 bits).

The release package was updated to conditionally include grub, since now there is another package that provides a bootloader.

Given that in-place upgrades aren't supported for the time being, signpost is skipped entirely as a binary. However, the library component was updated to find the correct FAT partition that includes the UKI to mount it at /boot. This is needed for other parts of the system, like the FIPS check.

User-space PCR9 measurements are skipped for UKI-based images, since PCR9 is measured at the kernel level when systemd-boot is used.

Testing done:

As part of: bottlerocket-os/bottlerocket-kernel-kit#523

  • Booted UKI
  • Confirmed cmdline measurements are skipped in UKI images and ran in GRUB based images
  • /boot partition mounted for both formats
  • Build fails when in-place-upgrades + uki are used

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.

@arnaldo2792
arnaldo2792 force-pushed the uki-support/core-kit branch from 7871ec2 to 96f69ca Compare August 11, 2026 01:07
@arnaldo2792

Copy link
Copy Markdown
Contributor Author

(Force push to fix commit messages)

@arnaldo2792
arnaldo2792 force-pushed the uki-support/core-kit branch from 96f69ca to 43887e4 Compare August 11, 2026 01:08
@arnaldo2792

Copy link
Copy Markdown
Contributor Author

(Forced push to fix commit messages, for real)

@arnaldo2792

Copy link
Copy Markdown
Contributor Author

(Forced push includes missing systemd service)

Comment on lines +5 to +6
# Note that this file is measured into TPM PCR 5 before parsing: editing
# it changes PCR 5 and invalidates anything sealed against it.

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.

I'd suggest this being the first line of the file, seems like a significant callout. Maybe a "DO NOT EDIT" line, or "WARNING" line too?

Comment thread packages/systemd-257/systemd-257.spec Outdated
Comment thread packages/systemd-257/loader.conf Outdated
Comment thread packages/systemd-257/systemd-257.spec Outdated
Comment thread sources/api/prairiedog/src/main.rs Outdated
Comment thread sources/api/prairiedog/src/main.rs Outdated
Comment thread sources/updater/signpost/src/state.rs Outdated
Comment thread sources/updater/signpost/src/state.rs Outdated
Comment thread sources/updater/signpost/src/state.rs Outdated
Comment thread sources/api/prairiedog/src/main.rs Outdated
Comment thread sources/api/prairiedog/src/main.rs
Comment thread packages/systemd-257/systemd-257.spec Outdated
Comment thread packages/release/measure-cmdline.service
Comment thread packages/os/os.spec
Comment thread packages/release/measure-cmdline.service
@arnaldo2792
arnaldo2792 force-pushed the uki-support/core-kit branch from 337e9c8 to 53b84ce Compare August 13, 2026 17:40
Comment thread packages/systemd-257/systemd-257.spec Outdated
Comment on lines +96 to +97
Patch9019: 9019-boot-remove-SMBIOS-Type-11-kernel-cmdline-extra-mech.patch
Patch9020: 9020-boot-vmspawn-finish-removing-SMBIOS-cmdline-extra-bi.patch

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.

Do these need to be 2 separate patches? Looks like they're modifying the same file.

@piyush-jena

Copy link
Copy Markdown
Contributor

Tested jointly with #999 . Stress tested and no issues found. Assuming that the sign offs in the patches will be added.

@arnaldo2792
arnaldo2792 marked this pull request as ready for review August 14, 2026 21:31
arnaldo2792 and others added 9 commits August 14, 2026 21:44
Enable systemd-boot and systemd-stub in the systemd-257 spec to
provide the bootloader and EFI stub required for Unified Kernel
Images (UKI).

Add a patch to skip building 32-bit (ia32) EFI binaries on
architectures that do not need them, and ship a loader.conf
with sensible default settings.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
Add EnvironmentFile=-/usr/share/bottlerocket/image-format.env to
prepare-boot.service so prairiedog can read image-format variables
at boot preparation time.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
On UKI-based images, the kernel command line is measured into PCR9
as part of the UKI PE binary at boot, so the separate user-space
measurement in measure-cmdline.service is redundant. Gate the
service with an ExecCondition on UKI_IMAGE so it only runs on
non-UKI images.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
Prior to the introduction of systemd-boot, GRUB was the only supported
bootloader and was always explicitly required. With systemd-boot now
available, the bootloader must be selected based on the format of the
built image.

Require the (bootloader-efi) capability, which is satisfied by either
grub or systemd-boot, whichever is installed based on the variant's
enabled feature flags.

Default to grub when the (uki-image) bconds are absent, preserving
backwards compatibility with older twoliter versions.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
UKIs do not yet support in-place upgrades. Skip installing signpost
on UKI-based variants, since marking partitions with successful boots
only applies to the GRUB-based boot format.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
Add xbootldr_partition(), which scans the OS disk's GPT for a
partition of the XBOOTLDR type GUID and returns its path. Returns
None when no such partition exists, which is the case on GRUB
images, and fails if more than one is found since there would be no
way to choose between them.

A prior pass introduced generic disk- and partition-type-searching
abstractions (disk.rs, partition_types.rs) to support this lookup,
but a single-purpose function is simpler and sufficient for the one
caller that needs it, so those files are removed in favor of this
helper living alongside the rest of the partition-table logic in
state.rs.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
prepare_boot previously always mounted the active partition set's
ext4 boot partition. On UKI images, the boot partition is XBOOTLDR,
a FAT filesystem that systemd-boot's firmware loader must be able to
read.

Scan the disk layout and check the UKI_IMAGE environment variable,
which prepare-boot.service sets from image-format.env. If it is a
UKI image, look up the XBOOTLDR partition and mount it as vfat with
the mount options systemd-boot expects (umask, shortname, iocharset,
and an SELinux context, since FAT has no extended attributes to
carry a label). Otherwise, fall back to the existing ext4 mount of
the active set's boot partition.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
Backport of upstream bb19b6104978b5ede792fa3f0cfc74272f20bf9c.

Signed-off-by: Maher Homsi <maherhom@amazon.com>
The FIPS kernel integrity check hardcoded /boot/.vmlinuz.hmac, which
does not exist on UKI images where the kernel is embedded in the EFI
binary.

Add two oneshot units, generate-fips-hmac-path-uki.service and
generate-fips-hmac-path-vmlinuz.service, that inspect UKI_IMAGE in
/usr/share/bottlerocket/image-format.env and write the matching HMAC
path to /etc/fips-hmac-path.env. Both are gated on fips=1 and ordered
before fipscheck.target and check-kernel-integrity.service, which now
reads ${HMAC_PATH} from that file instead of a fixed path.

Signed-off-by: Arnaldo Garcia Rincon <agarrcia@amazon.com>
@arnaldo2792
arnaldo2792 force-pushed the uki-support/core-kit branch from 968cc95 to 72a14e4 Compare August 14, 2026 21:55
@arnaldo2792
arnaldo2792 merged commit 3e52210 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.

7 participants