My device is booting from SD card. now I want to copy file system from SD card to emmc on the TX2 device.
can you help me?
Directly copying may not do what you expect. For one, the boot content itself may or may not be used from the SD card, and some of the metadata used for boot stages prior to Linux may need to be updated. Some parts of the “/boot/” content still get used, but other parts are not used in more recent distributions. Can you post the content of your current “/boot/extlinux/extlinux.conf”?
My thought is that perhaps you could mount the rootfs partition on the host PC in the “Linux_for_Tegra/rootfs/” location (you would be covering the original “rootfs/” content temporarily during the mount), and then flash. However, this would alter boot content on the SD card itself and the SD card would likely no longer work as a boot device. You would have to use other methods if you want to keep the original SD card unmodified.
One method to keep the original SD card and to do this would be to dd a copy of the SD card’s partition and then loopback mount the dd copy to the “Linux_for_Tegra/rootfs/” location.
During a normal flash metadata about the boot device is added to other partitions, and some of the boot options edit the content of “rootfs/”. Other than this, the rootfs is close to being a verbatim copy of the whatever you unpacked into “rootfs/”. From this the flash image is created.
If on your host PC the SD card is “/dev/mmcblk1” (and this will probably differ for different people’s systems), then the first partition would be “/dev/mmcblk1p1” (this would be the rootfs). A dd copy would go something like this:
sudo dd if=/dev/mccblk1p1 of=backup.img bs=65536
# Now chown the backup.img so your regular user owns the file.
The “bs=65536” is optional, it just adds more buffer and speeds up the dd clone.
The loopback mount prior to flash would go something like this:
sudo mount -o loop ./backup.img /where/ever/it/is/Linux_for_Tegra/rootfs/
# ...do the flash, e.g., something like:
sudo ./flash.sh jetson-tx2 mmcblk0p1
sudo umount /where/ever/it/is/Linux_for_Tegra/rootfs/
This would flash the metadata and non-rootfs partitions, along with making some boot related edits to the “rootfs/” content before flashing.