when i cloning TX2 image, suppose the backup file name is backup.img, then under Linux_for_Tegra directory there would be two image files backup.img and backup.img.raw, so may i know what’s the difference between two files? and if i want to restore image, only backup.image.raw is needed or both two? thanks!
The “raw” image is the exact clone of the partition. This can be loopback mounted, examined, edited, or used for cloning when renamed “system.img” and put in the “bootloader/” subdirectory (you’d use the “-r” option to reuse an image when flashing from command line).
The “backup.img” is a “sparse” version of this. It reduces size by a kind of “poor man’s compression” to leave out empty space. The “raw” image is the exact byte size of the partition, the “sparse” image is smaller by an amount approximately equal to the unused space. Sparse images cannot be loopback mounted, nor can they be edited. Open source tools for working with sparse images cannot work with this version of a sparse image, and so far the only way I know of for using this is to rename it as “system.img”, put it in the right place, and use it for flash.
Both raw and sparse images are interchangeable when named “system.img” for purposes of flash. The smaller sparse image is faster to flash.
The “bootloader/mksparse” program in the driver package is what creates a sparse image from a raw image. For Jetsons the fill pattern is NULL (“0”).
I throw away the sparse image since it is not useful without flashing it. I keep the raw image because I can examine it, modify it, so on. When not used I run “bzip2 -9” on the raw image…though that takes significant time considering how large it is.