How to redefine the rootfs?

All of the steps with “rm” of “rootfs/” were unnecessary. While something else is mounted there that content is inaccessible and the system has only the mounted content available.

This was incorrect:

sudo mkdir rootfs
sudo tar xvf Tegra_Linux_Sample-Root-Filesystem_R32.7.2_aarch64.tbz2 -C rootfs
sudo ./flash.sh jetson-tx2 mmcblk0p1

After unpacking the rootfs content, but before flashing, you missed the step which installs NVIDIA driver content:
sudo ./apply_binaries.sh
(this only needs to be done once)

Without the apply_binaries.sh your native (not from a separate mount) content will not be valid.

Please note that the backup.img.raw of the clone will never be “the wrong size”, or at least it will be an exact match to the system it came from down to the last bit. If this is too large for some other system it is going to, then this can be dealt with, but other than convenience of size there should be no issue.

The “backup.img” (sparse) is not guaranteed of any size. Replacing NULL content with a formula which expands into empty ext4 space is what this is for. When that space expands, then it should be an exact match for the raw image. It isn’t really possible to completely estimate what its size will be, but the installed image, regardless of starting as raw or sparse, should be the same thing if you have not altered the raw image. The way you mounted the raw image in “rootfs/” it is possible there were minor edits.

Just prior to generation of system.img from “rootfs/” some “rootfs/boot/” content is altered by copying in things like kernel Image and the extlinux.conf which the system believes is correct for the arguments passed to the flash software. If this happens to be the same exact files which were already there, then then only possible difference will be a time stamp. If those are different, then it has just overwritten that content from the clone and turned it into the default content.

If you want an exact match each time, then you should only use the clone image as “bootloader/system.img” and “reuse” that image. It wouldn’t matter if you use the raw or sparse image there, but if it is raw, then you can choose to loopback mount this and edit it prior to the flash (you wouldn’t want to use the file as system.img while it is actively mounted).

It isn’t clear what it is you actually want to accomplish when comparing the two methods of flashing from a clone as “system.img” versus mounting on “rootfs/”.