how to generate the SD card flashable image for tx2?

Is there an script for generating an SD card flashable image for tx2 like create-jetson-nano-sd-card-image.sh for nano. The “sudo dd if=/dev/mmcblk0 of=clone_of_SD.img bs=512” command is not for me cause my host linux runs on a virtual machine.

Not a complete answer, but perhaps useful…

During a normal flash the “Linux_for_Tegra/rootfs/” has the sample rootfs unpacked into it (using sudo so permissions are preserved…make sure your SD card partition is ext4 so it can preserve permissions). Then “Linux_for_Tegra/apply_binaries.sh” is run (with sudo), and this overlays NVIDIA-specific files into the “rootfs/” (this is when the sample rootfs changes from being a purely generic Ubuntu to becoming Linux4Tegra). This is almost the exact content an SD card partition would want.

If you are on your host PC and have the SD card first partition as “/dev/mmcblk0p1” (adjust for your case…numbering may differ) and mounted on “/mnt”, what I just described could be accomplished by unpacking the sample rootfs into “/mnt”, and then running (from the correct directory):

sudo ./apply_binaries.sh -r /mnt

When you actually go to flash (JetPack runs flash.sh and is only a front end to flash.sh which does the real work) boot configurations are written into “rootfs/boot/” and other boot locations. This is the part which you’d have to copy out of your running Jetson…the “/boot” content.

Or, you could do it a different way. You could clone the rootfs and copy the loopback mounted content into the SD card.

Or, you could mount your SD card on the “Linux_for_Tegra/rootfs/” directory, and then perform a full flash. The content which makes up the image flashed would end up exactly as you need it in rootfs, and when done, you simply umount the SD card and it is ready.

This doesn’t mean it’ll work as you expect, but that’s the mechanics and the choices.