how to build the system.img with ROS has installed

I want to build and flash the system.img , which has already installed ROS.
how can I do?


This is easy on command line. If you have downloaded the driver package (which is done automatically if you’ve ever flashed from JetPack or SDK Manager), then you will have a “Linux_for_Tegra/” subdirectory. Within that is “”. The most basic flash command is normally:

sudo ./ jetson-tx2 mmcblk0p1

When flashed like this an image is generated as “bootloader/system.img” every time you flash. If you instead use the “-r” option, then that image is not regenerated and it is assumed the image is already there. I recommend you keep a safe image copy somewhere, and then place your image as “bootloader/system.img”, followed by flash with the “-r” option. There is one more detail, but the basic command would be:

sudo ./ <b>-r</b> jetson-tx2 mmcblk0p1

The actual system.img file can be either a raw image (a large size) or a sparse image (a smaller size). I am assuming this is a raw image (which is good) since sparse images cannot be manipulated or edited (this version of a sparse image does not work with the open source sparse file system tools). The exact byte size of that image could be important if it isn’t the default size.

Find the exact byte size of the system.img. This will be divisible by 1024 at least twice, and possibly three times. If divisible twice, then this is the size in MiB. If this is divisible three times, then this is the size in GiB. Example:

30064771072 = 28 * 1024 * 1024 *1024 = 28GiB
30742151168 = 29318 * 1024 * 1024 = 29318MiB

You can add a size parameter in case the image isn’t default. Place the TX2 in recovery mode with the micro-B USB connected to the host. Then (I am assuming 28GiB):

sudo ./ <b>-r -S 28Gib</b> jetson-tx2 mmcblk0p1

Note that you should not use a different L4T release to flash an image versus the release the image was originally from. There are some exceptions for purely patch releases, but for example failure is expected if you use R32.1 to flash an image made for R28.2.

this way, i have to backup and flash the system.img which is 28GB ,it take to much time if I have lots of TX2

The docs do mention a method to flash multiple systems at the same time and you reuse this image so no new image is created after the original.

During normal flash “Linux_for_Tegra/rootfs/” has the sample rootfs added (a simple tar operation). Then from “Linux_for_Tegra/” NVIDIA drivers are added to this same directory via “sudo ./”. After that the “bootloader/system.img” is created from the actual flash by means of the “rootfs/” content. Other than flash editing “rootfs/boot/” content this is mostly an exact copy. You could put your content in “rootfs/” provided it started with a working operating system. It does not hurt to use the “sudo ./” operation again if you doubt the drivers being in place, but after that it is normal flash. Just beware that if JetPack or SDK Manager downloads the rootfs again for any reason, then your content might be overwritten. The basic flash command would then be:

sudo ./ jetson-tx2 mmcblk0p1