jetson-orin: use XML-aware splicing for flash partition layout#1849
jetson-orin: use XML-aware splicing for flash partition layout#1849
Conversation
| in | ||
| pkgs.runCommand "flash.xml" { } ( | ||
| '' | ||
| head -n ${toString partitionTemplateReplaceRange.firstLineCount} ${xmlFile} >"$out" |
There was a problem hiding this comment.
that seemed a bit fragile, hence the PR
|
still waiting for the image to build.... |
|
Image build & flashing works. |
TanelDettenborn
left a comment
There was a problem hiding this comment.
This PR breaks NX QSPI flash. I have done a quick skim but have not been able to pinpoint the root cause. Dropping this comment now to ensure this is not merged to mainline.
@TanelDettenborn do you have a chance to dump out the xml it produced vs. the original one? |
|
@TanelDettenborn I wasn't able to test |
|
I should have been more precise with my words. Technically, the QSPI flash on the NX is failing, but it doesn't even reach the actual flashing phase. To reproduce the issue, execute: I've compared the XML files, and the only difference appears to be the XML declaration. The new version explicitly defines |
Add splice-flash-xml.py, a Python script that replaces the <device type="sdmmc_user"> partitions in NVIDIA's flash XML with a custom layout defined in JSON. This replaces fragile line-count based head/tail splicing that breaks when the upstream BSP XML changes. Convert partition-template.nix to use the new script. The partition layout is now defined as structured Nix data serialized to JSON. Partition sizes are injected at build time from sdImage metadata via --set instead of flash-time sed substitution. Features: --set PARTITION.FIELD=VALUE override partition child element values --remove-device remove sdmmc_user device (QSPI-only) Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
|
Root cause: Fixed in #1811 by writing the declaration manually: with open(output, "w") as f:
f.write('<?xml version="1.0"?>\n')
tree.write(f, xml_declaration=False, encoding="unicode")
f.write("\n") |
TanelDettenborn
left a comment
There was a problem hiding this comment.
Smoke tested NX and flash is working.
If testing does not turn up anything, LGTM.
|
Tested on Orin AGX nix build .#packages.x86_64-linux.nvidia-jetson-orin-agx-debug-from-x86_64-flash-script
|
Add splice-flash-xml.py, a Python script that replaces the partitions in NVIDIA's flash XML with a custom layout defined in JSON. This replaces fragile line-count based head/tail splicing that breaks when the upstream BSP XML changes.
Convert partition-template.nix to use the new script. The partition layout is now defined as structured Nix data serialized to JSON. Partition sizes are injected at build time from sdImage metadata via --set instead of flash-time sed substitution.
This has been split from #1847
Description of Changes
Type of Change
Related Issues / Tickets
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify: