Move from shipping the initrd to generating it during install.#14119
Open
Move from shipping the initrd to generating it during install.#14119
Conversation
OneBlue
reviewed
Jan 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR transitions from shipping a pre-built initrd.img to generating it at runtime on first VM launch. This eliminates the Perl build dependency and reduces package size by removing redundancy (both init binary and initrd.img containing init were previously shipped).
Changes:
- Implemented C++ CPIO newc format generation to create initrd.img from the init binary at runtime
- Removed Perl scripts (bin2cpio.pl, CPIOImage.pm) and StrawberryPerl dependency from the build system
- Modified MSI packaging to exclude initrd.img and ensure cleanup during upgrades via WiX RemoveFile directive
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/bin2cpio/bin2cpio.pl | Removed - Perl script no longer needed |
| tools/bin2cpio/CPIOImage.pm | Removed - Perl module no longer needed |
| src/windows/common/filesystem.hpp | Added function declarations for CreateCpioInitrd and EnsureCpioInitrd |
| src/windows/common/filesystem.cpp | Implemented C++ CPIO newc format generation with thread-safe initrd creation |
| src/windows/service/exe/WslCoreVm.h | Added m_initrdPath member to track generated initrd path |
| src/windows/service/exe/WslCoreVm.cpp | Integrated runtime initrd generation during VM initialization |
| src/linux/init/CMakeLists.txt | Removed initramfs build target and dependencies |
| msipackage/CMakeLists.txt | Removed initramfs dependency and initrd.img from Linux binaries |
| msipackage/package.wix.in | Removed initrd.img from installation, added RemoveFile directive for upgrade compatibility |
| packages.config | Removed StrawberryPerl dependency |
| CMakeLists.txt | Removed Perl package and bin2cpio script references |
| .pipelines/build-stage.yml | Updated build target from initramfs to init |
| test/windows/InstallerTests.cpp | Added comprehensive test for initrd.img lifecycle covering upgrades, runtime generation, and cleanup |
| doc/docs/technical-documentation/boot-process.md | Updated documentation to reflect runtime generation approach |
253bbd8 to
5b96618
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
OneBlue
reviewed
Jan 30, 2026
OneBlue
approved these changes
Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think it's pretty wasteful to ship both the init binary and the initrd.img when we can easily create the initrd.img dynamically.
This change implements this by generating the initrd.img during installation. I timed this on my dev box and this takes around 50ms, so very quick. This allows us to remove the dependency on perl in our build system and reduces package size.