Ship initrd.img in MSI using build-time generation via powershell script#14424
Ship initrd.img in MSI using build-time generation via powershell script#14424
Conversation
Replace the install-time CreateInitrd/RemoveInitrd custom actions with a build-time step that generates initrd.img using the Windows built-in tar.exe (libarchive/bsdtar) and ships it directly in the MSI. The install-time approach had a race condition: wsl.exe could launch before the CreateInitrd custom action completed, causing ERROR_FILE_NOT_FOUND for initrd.img. Changes: - Add CMake custom command to generate initrd.img via tar.exe --format=newc - Add initrd.img as a regular file in the MSI tools component - Remove CreateInitrd/RemoveInitrd custom actions from WiX, DllMain, and wslinstall.def - Remove CreateCpioInitrd helper and its tests (no longer needed) - Update pipeline build targets to build initramfs instead of init
There was a problem hiding this comment.
Pull request overview
This PR shifts initrd.img handling from an MSI installer-time custom action to a build-time generated artifact that is shipped directly in the MSI, removing the associated helper implementation and tests.
Changes:
- Generate
initrd.imgduring the Linuxinitbuild via a newinitramfsCMake target and include it in MSI packaging. - Remove installer custom actions/exports (
CreateInitrd/RemoveInitrd) and the Windows-sideCreateCpioInitrdhelper. - Remove test coverage that previously validated initrd creation and lifecycle behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/linux/init/CMakeLists.txt |
Adds initramfs target to generate initrd.img via tar.exe --format=newc. |
msipackage/CMakeLists.txt |
Adds initrd.img to MSI inputs and makes msipackage depend on initramfs. |
msipackage/package.wix.in |
Ships initrd.img as a file in the tools component; removes related custom actions. |
src/windows/wslinstall/DllMain.cpp |
Removes MSI custom action implementations for initrd create/remove. |
src/windows/wslinstall/wslinstall.def |
Removes exported symbols for initrd create/remove actions. |
src/windows/common/filesystem.hpp |
Removes CreateCpioInitrd declaration. |
src/windows/common/filesystem.cpp |
Removes CreateCpioInitrd implementation. |
test/windows/SimpleTests.cpp |
Removes unit test for CreateCpioInitrd. |
test/windows/InstallerTests.cpp |
Removes installer lifecycle test for initrd.img. |
.pipelines/build-stage.yml |
Updates pipeline target list to build initramfs instead of init. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
test/windows/InstallerTests.cpp:499
- The PR removes the InitrdImgLifecycle installer test, but the change also makes
initrd.imga required packaged artifact (built duringinitramfsand shipped in the MSI). With this test gone, there doesn’t appear to be any remaining validation thattools\\initrd.imgis actually installed (and removed) as expected. Consider adding a lightweight check (e.g., existence + non-empty) as part of the install validation to keep coverage for this critical boot dependency.
TEST_METHOD(UpgradeInstallsTheMsiPackage)
{
// Remove the MSIX package
UninstallMsix();
VERIFY_IS_FALSE(IsMsixInstalled());
// Validate that upgrading the MSI installs the MSIX again
InstallMsi();
VERIFY_IS_TRUE(IsMsiPackageInstalled());
VERIFY_IS_TRUE(IsMsixInstalled());
VERIFY_IS_FALSE(IsMsixInstallerInstalled());
ValidatePackageInstalledProperly();
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
You can also share your feedback on Copilot code review. Take the survey.
| } | ||
| finally | ||
| { | ||
| $out.Close() |
There was a problem hiding this comment.
Is this needed ? The script would exit either way right ?
There was a problem hiding this comment.
You are right, probably not needed, but also not harmful
Replace the install-time CreateInitrd/RemoveInitrd custom actions with a build-time step that generates initrd.img using the a powershell script and ships it directly in the MSI.
Changes: