Skip to content

Comments

nvidia-jetpack: move pre-flash commands into writeShellApplication#1740

Merged
brianmcgillion merged 1 commit intotiiuae:mainfrom
vunnyso:vs-improvePT
Feb 11, 2026
Merged

nvidia-jetpack: move pre-flash commands into writeShellApplication#1740
brianmcgillion merged 1 commit intotiiuae:mainfrom
vunnyso:vs-improvePT

Conversation

@vunnyso
Copy link
Collaborator

@vunnyso vunnyso commented Feb 10, 2026

Description of Changes

This makes runtime dependencies explicit, improves readability and avoids relying on implicit tool paths.

Type of Change

  • New Feature
  • Bug Fix
  • Improvement / Refactor

Related Issues / Tickets

Checklist

  • Clear summary in PR description
  • Detailed and meaningful commit message(s)
  • Commits are logically organized and squashed if appropriate
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • Author has run make-checks and it passes
  • All automatic GitHub Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing Instructions

Applicable Targets

  • Orin AGX aarch64
  • Orin NX aarch64
  • Lenovo X1 x86_64
  • Dell Latitude x86_64
  • System 76 x86_64

Installation Method

  • Requires full re-installation
  • Can be updated with nixos-rebuild ... switch
  • Other:

Test Steps To Verify:

  1. ...

@emrahbillur
Copy link
Contributor

Status:
Still fails to flash AGX devices. Just rename the NIXOS_SD named partition to something else and flash and it will fail again.

@emrahbillur
Copy link
Contributor

There are two different issues with our flashing case.

  1. The initrdflash-script that is defined as new default script in jetpack-nixos does not support hardware.nvidia-jetpack.flashScriptOverrides.preFlashCommands as the previous regular flashscript. Vunny has solved the initial problem with this nice PR by simply moving ghaf preFlashCommands to writeShellApplication in this PR. I did a similar solution in my github:/emrahbillur/feb-flashscript-fix by simply adding these into mkRcmBootScript so that any initrdflash-script will support preFlashCommands and postFlashCommands.

Both solutions work as a charm.

  1. The flash script fails to flash the root.img. This is failing in both in this PR and in my local github:/emrahbillur/ghaf-support-for-nx/flashscript-fix branch.
    The failing point is the generation of flash.idx from the flash.xml. This is done in line
    tegraparser_v2 --pt flash.xml.bin --generateflashindex /tmp/tmp.CHWmAXOCNF/bootloader/signed/flash.xml.tmp flash.idx
    At this point the tegraparser_v2 does not solve our root.img or something else happens. So the flashing of root.img is skipped as seen in logs. The line of flash.idx does not have a filename or index data when I stop the script after flash.idx is created.

16896 bytes (16.5KB) copied, 0.002543 seconds, 6.3MB/s
Step 65/67... Writing esp.img (size=268435456) to esp on /dev/mmcblk0 (offset=20480)
65536+0 records in
65536+0 records out
268435456 bytes (256.0MB) copied, 2.044675 seconds, 125.2MB/s
Step 66/67... Skipping flash.idx entry:APP (devnum=1, instnum=3) (offset=268468224)
Moving secondary_gpt to end: 63585648640 - 16896 = 63585631744
Step 67/67... Writing patched (size=16896) to secondary_gpt on /dev/mmcblk0 (offset=63585631744)
4+1 records in
4+1 records out
16896 bytes (16.5KB) copied, 0.005947 seconds, 2.7MB/s
Finished flashing device
Flashing platform firmware successful. Rebooting now.
Device reported flashing succeeded. Device should be rebooting.

@emrahbillur
Copy link
Contributor

Now with this PR or with my branch solution all the qspi flashes might be solved but the AGX devices (AGX, AGX64, AGX Industrial) still fail.
To confirm this just rename root partition from NIXOS_SD to anything else. flash the device again. Then you can observe
[ OK ] Found device /dev/disk/by-label/NIXOS_SD.
[ OK ] Reached target Initrd Root Device.
Starting File System Check on /dev/disk/by-label/NIXOS_SD...
[FAILED] Failed to start File System Check on /dev/disk/by-label/NIXOS_SD.
after flash.

@emrahbillur
Copy link
Contributor

I suggest merging this to solve at least the QSPI issues of other devices. I'll create a new PR for flashing root.img fix.

@emrahbillur
Copy link
Contributor

60, 3:0:secondary_gpt, 67091968, 16896, gpt_secondary_3_0.bin, 16896, fixed-<reserved>-0, 7b33fbbaaada747480b0fa6940ad0061453689b7
61, 1:3:master_boot_record, 0, 512, mbr_1_3.bin, 512, fixed-<reserved>-0, 694898d1c345bdb31b377790ed7fc0b0db184bf7
62, 1:3:primary_gpt, 512, 19968, gpt_primary_1_3.bin, 16896, fixed-<reserved>-0, acef633286974f73135e23031cf56bfcf8e01789
63, 1:3:esp, 20480, 268435456, esp.img, 268435456, fixed-<reserved>-2, f71e2feeb2a4fc98b3e274e2e1477f7d624c91f3
64, 1:3:APP, 268468224, 11668762112, , , fixed-<reserved>-1, 
65, 1:3:secondary_gpt, 61203267072, 16896, gpt_secondary_1_3.bin, 16896, fixed-<reserved>-0, 133c0c309c368cdcbb6eec69de60c04358964e51

This is the flash.idx generated with no root.img in APP line.

@vunnyso
Copy link
Collaborator Author

vunnyso commented Feb 11, 2026

I suggest merging this to solve at least the QSPI issues of other devices. I'll create a new PR for flashing root.img fix.

I agree, we can merge this PR and the remaining issues can be addressed in a separate PR.

@brianmcgillion
Copy link
Collaborator

#1729 fixed the flashing command

This makes runtime dependencies explicit, improves readability and
avoids relying on implicit tool paths.

Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
@brianmcgillion brianmcgillion merged commit 42640ca into tiiuae:main Feb 11, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants