Any fast way for cloning AGX Xavier?

On your host PC which has performed a flash you will find this directory which contains the flash software:
~/nvidia/nvidia_sdkm/JetPack...version.../Linux_for_Tegra/

This contains the “flash.sh” script (JetPack/SDKM is just a front end, and these lower level scripts are what actually perform a flash…or a clone).

If your AGX is in recovery mode and has the USB-C connected, then this would create a clone (beware this takes a lot of disk space on the host PC, you should probably have about 50GB spare before you start):
sudo ./flash.sh -r -k APP -G my_backup.img jetson-xavier mmcblk0p1
(note that you would change “jetson-xavier” if the model is different, e.g., a commercial module would have a different name versus a dev kit model, but the carrier board won’t matter)

The above would produce two files:

  • my_backup.img, a “sparse” file;
  • my_backup.img.raw, a “raw” file.

Both files can be used for flashing, and the sparse file is smaller, so it is faster at flashing. A raw file can be used to create a smaller sparse file using the “mksparse” program with a NULL fill parameter.

Only the raw file can be loopback mounted, edited, examined, so on. I normally throw away the sparse file, and when no longer working with the raw file I will run bzip2 -9 on it (takes a very long time to copy such a large file, or to compress it).

Regardless of which clone you use, if you replace “Linux_for_Tegra/bootloader/system.img” with this clone, and then tell flash.sh flash, but to not generate the system.img, it will then use your exact image. There are other changes you need if this is not a dev kit booting from eMMC, but basically the “-r” option takes care of reusing system.img and not overwriting it with a newly generated image. For example:
sudo ./flash.sh -r jetson-xavier mmcblk0p1

4 Likes