Skip to content

Add shared initrd handling for blsforme schemes - #68

Merged
ermo merged 1 commit into
fix/unique-kernel-detectionfrom
task/shared-initrd
Aug 10, 2026
Merged

Add shared initrd handling for blsforme schemes#68
ermo merged 1 commit into
fix/unique-kernel-detectionfrom
task/shared-initrd

Conversation

@tarkah

@tarkah tarkah commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Shared (version independent) initrd files can be deduplicated across multiple kernels. This adds support to identify when initrds are shared vs versioned and for the newer blsforme schemes, it places those assets beneath a "shared" directory that allows deduplication.

This adds logic to detect shared initrd files in two different ways:

  • kernel/{version}/foo-shared.initrd / -shared.initrd suffixed files in the versioned kernel directory.
  • kernel/initrd.d/foo.initrd / All .initrd extension files in the initrd.d directory.

Any filenames that get matched from initrd.d will take priority over filenames from a versioned kernel directory to handle migration from the older scheme to the newer initrd.d scheme.

Testing

I've installed the two packages that have shared initrd files:

image

And also tested our collision logic applies to these assets as well:

image

Boom!

@tarkah
tarkah force-pushed the task/shared-initrd branch 2 times, most recently from 1ece360 to ea05f44 Compare August 7, 2026 22:10
@tarkah
tarkah force-pushed the task/shared-initrd branch from ea05f44 to 7c75fee Compare August 7, 2026 22:10
@ermo

ermo commented Aug 7, 2026

Copy link
Copy Markdown
Member

Is it random which gets the .0 and which gets the .1 suffix, in the sense that "the contents of the files are hashed, and then the files are sorted according to their hash values"?

I guess I'm a little confused by .0+.1 combination in one boot entry, and the .1+.0 combination in the other? Is that just an implementation detail on its own, where it doesn't matter what the mapping suffix is, just that it represents "the correct file version for any bootable fstx"?

@tarkah

tarkah commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Is it random which gets the .0 and which gets the .1 suffix, in the sense that "the contents of the files are hashed, and then the files are sorted according to their hash values"?

I guess I'm a little confused by .0+.1 combination in one boot entry, and the .1+.0 combination in the other? Is that just an implementation detail on its own, where it doesn't matter what the mapping suffix is, just that it represents "the correct file version for any bootable fstx"?

Correct. Things can only be grouped by / deduplicated by hash, so hash is the only thing we can deterministically sort by to provide a stable determinstic suffix. Or at least it's the easiest way without a lot more complexity.

It has nothing to do with the order of entries or anything like that. It's entirely opaque & irrelevant when looking at it from how entries link to each asset, outside of it will point to the correct one for that entry.

@tarkah

tarkah commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

I guess we can use an indexset instead of a btreeset and then they'll retain an index relative to the order they were added, which might make more sense.

@tarkah
tarkah force-pushed the task/shared-initrd branch from 7c75fee to 1e64036 Compare August 8, 2026 19:03
@bhh32

bhh32 commented Aug 9, 2026

Copy link
Copy Markdown

@tarkah Looks really good! Nice job!

@tarkah
tarkah force-pushed the task/shared-initrd branch from 1e64036 to aae852b Compare August 10, 2026 15:47
@tarkah
tarkah force-pushed the task/shared-initrd branch from aae852b to 061f5f7 Compare August 10, 2026 15:53
Shared (version independent) initrd files can be
deduplicated across multiple kernels. This adds
support to identify when initrd are shared vs
versioned and for the newer blsforme schemes, it
places those assets beneath a "shared" directory
that allows deduplication. 

This adds logic to detect shared initrd files in
two different ways:

- `kernel/{version}/foo-shared.initrd` / `-shared.initrd`
  suffixed files in the versioned kernel directory.
- `kernel/initrd.d/foo.initrd` / All `.initrd` extension
  files in the `initrd.d` directory.

Any filenames that get matched from `initrd.d` will
take priority over filenames from a versioned kernel
directory to handle migration from the older scheme
to the newer `initrd.d` scheme.
@tarkah
tarkah force-pushed the task/shared-initrd branch from 061f5f7 to 4df6473 Compare August 10, 2026 16:17
@ermo
ermo merged commit 55da60a into main Aug 10, 2026
5 checks passed
@ermo
ermo deleted the task/shared-initrd branch August 10, 2026 16:22
@ermo ermo mentioned this pull request Aug 10, 2026
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.

3 participants