-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildVerityUKI: introduce func for verity image build
Signed-off-by: Paul Meyer <[email protected]>
- Loading branch information
1 parent
3b4dd9d
commit a40c7ed
Showing
3 changed files
with
60 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ lib, jq }: | ||
|
||
let | ||
roothashPlaceholder = "61fe0f0c98eff2a595dd2f63a5e481a0a25387261fa9e34c37e3a4910edf32b8"; | ||
in | ||
|
||
nixos-config: | ||
|
||
(nixos-config.override { | ||
# Inject the `roothash` parameter into the kernel command line, | ||
# using a placeholder for the verity root hash. | ||
boot.kernelParams = lib.optional (roothashPlaceholder != "") "roothash=${roothashPlaceholder}"; | ||
}).image.overrideAttrs | ||
(oldAttrs: { | ||
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ jq ]; | ||
# Replace the placeholder with the real root hash. | ||
# The real root hash is only known after we build the image, so this | ||
# is injected into the derivation that builds the image. | ||
# Only replace first occurrence, or integrity of erofs will be compromised. | ||
postInstall = '' | ||
realRoothash=$(${lib.getExe jq} -r "[.[] | select(.roothash != null)] | .[0].roothash" $out/repart-output.json) | ||
sed -i "0,/${roothashPlaceholder}/ s/${roothashPlaceholder}/$realRoothash/" $out/${oldAttrs.pname}_${oldAttrs.version}.raw | ||
''; | ||
}) |
This file contains 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
This file contains 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