During a normal flash where a new image is generated the file “Linux_for_Tegra/bootloader/system.img.raw
” is first created (well, really it is created as “system.img
”, and then renamed as “system.img.raw
”). Once system.img.raw
is created the flash software would use the command mentioned by @JerryChang (“mksparse
” with a NULL fill pattern) to create the sparse file “system.img
”.
Note that the flash software does not care if “bootloader/system.img
” is raw or sparse, it works either way and flashes the same content. However, the raw “system.img.raw
” is much larger than “system.img
” (but the size of “system.img
” approaches “system.img.raw
” as the filesystem fills), so it flashes faster. On the other hand, you can’t loopback mount or examine a “sparse” image, but you can do so with a “raw” image.
If you place your own file as “bootloader/system.img
”, regardless of how or where you got this (it could be a clone, it could be an edited clone, it could be from a previous flash), and if you use the “-r
” option when manually flashing via “flash.sh
”, then your image is used for the rootfs. All other partitions are flashed normally.
As an option to flash.sh
there is “-S <size>
” for specifying a size when generating a new image (or it seems useful as well when you are reusing a custom image not of default size…not sure if that is mandatory or not). Note that size is specified in integral multiples of either MiB
or GiB
, where an MiB
is “1024x1024 = 1048576
” bytes, and a GiB
is “1024x1024x1024 = 1073741824
” bytes. This would be the exact byte size of “system.img.raw
”.
So if you used this command your raw image (and the partition size of rootfs, if there is enough room), then the partition would be 11GiB (or “11x1073741824
” bytes):
sudo ./flash.sh -S 11GiB jetson-tx2 mmcblk0p1
If you were to reuse a clone and avoid creating a new image (meaning you’ve copied either the raw or sparse clone to file name “bootloader/system.img
”), and if that image is 11811160064
bytes (11 GiB
), then this command would work (note the addition of “-r
”):
sudo ./flash.sh -S 11GiB -r jetson-tx2 mmcblk0p1
This doesn’t mean you can fit everything into 11GiB, it is just the command used. If you’ve customized an image and you know it fits in 10GiB
, then you could use that.
Remember that what is actually flashed is always the size of the “raw” image, and that “mksparse
” is just a tool to avoid flashing actual empty disk space content as a way to save time (and on the host PC to save space, although if you didn’t delete the raw image, then it actually consumes more space total).