Skip to content

Support UKI enabled base image customization.#265

Merged
liulanze merged 2 commits into
mainfrom
user/lanzeliu/uki-base-customization
Jun 9, 2025
Merged

Support UKI enabled base image customization.#265
liulanze merged 2 commits into
mainfrom
user/lanzeliu/uki-base-customization

Conversation

@liulanze
Copy link
Copy Markdown
Contributor

@liulanze liulanze commented Jun 8, 2025

In prepareUki(), when copyUkiFiles() is called, it attempts to find the kernel and its initramfs under the boot partition. Once found, they are placed under UkiBuildDir for later use when building the UKI with ukify. Additionally, getKernelToInitramfsMap() also heavily depends on the kernel and initramfs being present in the boot partition. This function is invoked twice: during both prepareUki() and createUki(). Therefore, cleanupBootPartition() should not have to be released into main yet, as we are still in the process of making the boot partition optional.

Another issue blocking main from customizing a UKI-enabled base image is the ability to read the latest kernel arguments from an existing UKI. I have extended the logic - following the structure of extractKernelCmdline() in partitionutils.go - to make UKI customization more robust, enabling kernel-to-args mapping to be extracted from either grub.cfg or an existing UKI.


Checklist

  • Tests added/updated
  • Documentation updated (if needed)
  • Code conforms to style guidelines

@liulanze liulanze requested a review from a team as a code owner June 8, 2025 23:06
Comment thread toolkit/tools/pkg/imagecustomizerlib/customizeuki.go
Comment thread toolkit/tools/pkg/imagecustomizerlib/customizeuki.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/customizeuki.go
@liulanze liulanze requested review from cwize1 and gmileka June 9, 2025 19:39
@liulanze liulanze force-pushed the user/lanzeliu/uki-base-customization branch from 63c7889 to d38a247 Compare June 9, 2025 19:41
Comment thread toolkit/tools/pkg/imagecustomizerlib/customizeuki.go
@liulanze liulanze requested a review from himaja-kesari June 9, 2025 19:59
@liulanze liulanze merged commit c91781d into main Jun 9, 2025
8 checks passed
@liulanze liulanze deleted the user/lanzeliu/uki-base-customization branch June 9, 2025 23:33
liulanze added a commit that referenced this pull request Jun 25, 2025
<!-- Description: Please provide a summary of the changes and the
motivation behind them. -->

In `prepareUki()`, when `copyUkiFiles()` is called, it attempts to find
the `kernel` and its `initramfs` under the boot partition. Once found,
they are placed under `UkiBuildDir` for later use when building the
`UKI` with `ukify`. Additionally, `getKernelToInitramfsMap()` also
heavily depends on the `kernel` and `initramfs` being present in the
boot partition. This function is invoked twice: during both
`prepareUki()` and `createUki()`. Therefore, `cleanupBootPartition()`
should not have to be released into main yet, as we are still in the
process of making the boot partition optional.

Another issue blocking main from customizing a UKI-enabled base image is
the ability to read the latest kernel arguments from an existing UKI. I
have extended the logic - following the structure of
`extractKernelCmdline()` in `partitionutils.go` - to make UKI
customization more robust, enabling `kernel-to-args` mapping to be
extracted from either `grub.cfg` or an existing UKI.

---

- [x] Tests added/updated
- [x] Documentation updated (if needed)
- [x] Code conforms to style guidelines
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