Flashing custom NixOS image on Jetson NX Orin

Hello! We are struggling to flash our NixOS image (with Linux kernel 5.10.104) into the Jetson NX Orin (devkit) using the nVidia scripts on JetPack 5.1.2. We are using the l4t_initrd_flash.sh script as the documentation suggests for production use.

It seems that this script doesn’t have --no-systemimg flag so we are passing it to the flash.sh script using -p flag. This seems to be ignored or at least the system re-creates and overwrites our system.img.

The command we run is:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -u secureboot/ecp256.pem --uefi-keys uefi_keys/uefi_keys.conf -p "-c ./bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg" -c ./tools/kernel_flash/flash_l4t_t234_nvme.xml --showlogs --network usb0 jetson-orin-nano-devkit nvme0n1p1

What is the correct / recommended way to flash our own system image?

You should first do

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 --no-flash -u secureboot/ecp256.pem --uefi-keys uefi_keys/uefi_keys.conf -p “-c ./bootloader/t186ref/cfg/flash_t234_qspi.xml” -c ./tools/kernel_flash/flash_l4t_t234_nvme.xml --showlogs --network usb0 jetson-orin-nano-devkit internal

to create both rootfs and bootloader images, and replace the old system.img with your own one, and do

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only

Thanks @DaveYYY . Here are observations after we followed your suggestion:

  • If we replace bootloader/system.img file with our own the system will still boot into nVIDIA Ubuntu
  • If we replace tools/kernel_flash/images/external/system.img the kernel panic is triggered (log attached)
  • If we further replace kernel/Image with our 5.10.104 kernel, we get an error “r8168: disagrees about version of symbol module_layout”
[   10.079697] Run /init as init process
[   10.096030] Root device found: PARTUUID=e0a4c8f6-14f5-4c54-a989-d87ed917089e
[   10.339792] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Opts: (null)
[   10.351369] Rootfs mounted over PARTUUID=e0a4c8f6-14f5-4c54-a989-d87ed917089e
[   10.364372] Switching from initrd to actual rootfs
[   10.374001] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[   10.384787] CPU: 1 PID: 1 Comm: chroot Not tainted 5.10.120-tegra #1
[   10.393874] Hardware name: Unknown NVIDIA Orin NX Developer Kit/NVIDIA Orin NX Developer Kit, BIOS 4.1-33958178 08/01/2023
[   10.407816] Call trace:
[   10.412797]  dump_backtrace+0x0/0x1d0
[   10.419254]  show_stack+0x30/0x40
[   10.424556]  dump_stack+0xd8/0x138
[   10.428053]  panic+0x17c/0x384
[   10.431199]  do_exit+0xaa8/0xab0
[   10.434521]  do_group_exit+0x4c/0xb0
[   10.438198]  __arm64_sys_exit_group+0x28/0x30
[   10.442679]  el0_svc_common.constprop.0+0x80/0x1d0
[   10.447604]  do_el0_svc+0x38/0xb0
[   10.451012]  el0_svc+0x1c/0x30
[   10.454154]  el0_sync_handler+0xa8/0xb0
[   10.458098]  el0_sync+0x16c/0x180
[   10.461510] SMP: stopping secondary CPUs
[   10.465679] Kernel Offset: 0x4747678c0000 from 0xffff800010000000
[   10.471952] PHYS_OFFSET: 0xffff8c8040000000
[   10.476252] CPU features: 0x08040006,4a80aa38
[   10.480731] Memory Limit: none
[   10.483878] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 ]---

How did you generate this NixOS image?
Are you sure it’s compatible with your device?

I think this is the right way of doing it.

Because you only replace the kernel image, but not kernel modules, so the version of these two does not match.