Closed
Conversation
Signed-off-by: vadik likholetov <vadikas@gmail.com>
- Modified files:
- targets/nvidia-jetson-orin/flake-module.nix
- modules/reference/hardware/jetpack/nvidia-jetson-orin/partition-template.nix
- modules/partitioning/deferred-disk-encryption.nix
What This Change Set Achieves
- Adds phase-1 full disk encryption (FDE) support for Orin AGX debug targets using deferred first-boot encryption.
- Keeps existing Orin targets intact; introduces additive -fde-phase1 target variants.
- Refactors flash flow so phase1 targets can produce working -flash-script / -flash-qspi artifacts.
- Preserves default installer-marker behavior globally, while bypassing marker only for phase1 targets.
Previously Added (same target file, same branch context)
- Logging enabled for all Orin targets (copied from x86 template style) in targets/nvidia-jetson-orin/flake-module.nix.
- GIVC enabled for AGX debug cross targets (agx-debug and agx-debug-nodemoapps) in targets/nvidia-jetson-orin/flake-module.nix.
Detailed Changes
- targets/nvidia-jetson-orin/flake-module.nix
- Added phase1 generator functions:
- generate-fde-phase1
- generate-fde-phase1-cross-from-x86_64
- New additive target variants for:
- nvidia-jetson-orin-agx-debug-fde-phase1
- nvidia-jetson-orin-agx-debug-nodemoapps-fde-phase1
- plus their -from-x86_64 variants.
- Phase1 target behavior:
- Disables sd-image format modules.
- Switches package output to system.build.ghafImage.
- Imports disko+verity partition modules.
- Enables deferred encryption.
- Overrides encrypted device path to "/dev/disk/by-partlabel/APP".
- Disables installer marker requirement for phase1 only.
- Cross image-builder compatibility tuning:
- Uses pkgs.buildPackages, enables binfmt, pins image-builder kernel packages to build-side kernel packages.
- Adds host/build platform overrides for disko builder config.
- Disk layout tuning for flash constraints:
- Forces disk image size/LV sizing (58G image, 44G root, 8G swap, 2G persist).
- Refactors flash package generation:
- Introduces flashableCrossTargets = crossTargets ++ fdePhase1CrossTargets.
- Flash artifacts are now emitted for both existing and phase1 cross targets.
- modules/partitioning/deferred-disk-encryption.nix
- Added new options:
- ghaf.storage.encryption.lvmPartitionDevice (nullable string override)
- ghaf.storage.encryption.requireInstallerMarker (bool, default true)
- Updated device selection logic:
- Uses override if provided, then verity path, then disko default.
- Marker handling is now conditional:
- Marker-check + marker-removal are wrapped under requireInstallerMarker.
- Result:
- Existing behavior unchanged by default.
- Phase1 can bypass installer marker safely and target APP.
- modules/reference/hardware/jetpack/nvidia-jetson-orin/partition-template.nix
- Refactored image handling to support two source layouts:
- Traditional sd-image (esp.offset/root.offset)
- Disko raw image (disk1.raw)
- For raw-image path:
- Detects ESP/APP partitions via fdisk.
- Extracts ESP and APP with dd.
- Added conv=sparse for root extraction to avoid temporary-space exhaustion.
- Added APP-size clamp to align with Jetson flash XML fixed upper bound:
- Prevents GPT generation failure (End sector for APP ... expected ... actual: 0).
Target/Artifact Matrix After Change
- Existing targets remain unchanged.
- New phase1 outputs include:
- ...-fde-phase1
- ...-fde-phase1-from-x86_64
- ...-fde-phase1-from-x86_64-flash-script
- ...-fde-phase1-from-x86_64-flash-qspi
- same for ...-agx-debug-nodemoapps...
Validation Performed
- Evaluated phase1 config options successfully:
- encryption enabled/deferred
- lvmPartitionDevice resolves to /dev/disk/by-partlabel/APP
- installer marker requirement false for phase1
- first-boot-encrypt initrd service enabled and wired
- Built successfully in Docker Compose:
- nvidia-jetson-orin-agx-debug-fde-phase1-from-x86_64
- nvidia-jetson-orin-agx-debug-nodemoapps-fde-phase1-from-x86_64
- ...-flash-script for both
- ...-flash-qspi evaluates and builds to initrd-flash output
- Fixed several intermediate blockers during validation:
- exec-format issues in image builder
- missing kernel module expectations in initrd
- flash temp-space issues
- APP GPT boundary mismatch
Runtime/Operational Guidance
- Recommended deployment flow for phase1:
- dd phase1 disk1.raw to USB.
- Flash only QSPI with ...-flash-qspi.
- Boot with USB attached.
- Why QSPI-only:
- Avoids potential APP label ambiguity between internal and external media during deferred encryption.
What Is Not Changed
- Non-phase1 targets do not inherit deferred-encryption behavior.
- Global default marker requirement remains enabled (true), preserving existing installer-based expectations outside phase1.
Signed-off-by: vadik likholetov <vadikas@gmail.com>
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.
Description of Changes
-fde-phase1variants (including-from-x86_64) while leaving existing targets unchanged.sdImageartifacts and diskodisk1.rawartifacts, enabling phase-1 flash workflows.What Changed
targets/nvidia-jetson-orin/flake-module.nixgenerate-fde-phase1andgenerate-fde-phase1-cross-from-x86_64.nvidia-jetson-orin-agx-debug-fde-phase1nvidia-jetson-orin-agx-debug-nodemoapps-fde-phase1-from-x86_64variants.system.build.ghafImage.modules/reference/hardware/jetpack/nvidia-jetson-orin/partition-template.nixsdImagepath (existing behavior)disk1.rawpath (phase-1 disko images)modules/partitioning/deferred-disk-encryption.nixghaf.storage.encryption.lvmPartitionDeviceghaf.storage.encryption.requireInstallerMarker(defaulttrue)Behavior / Compatibility
/dev/disk/by-partlabel/APP.Validation
falserequirement/dev/disk/by-partlabel/APPnvidia-jetson-orin-agx-debug-fde-phase1-from-x86_64nvidia-jetson-orin-agx-debug-nodemoapps-fde-phase1-from-x86_64-flash-scriptoutputs-flash-qspipackage derivationType of Change
Related Issues / Tickets
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify: