Is it possible to clone an entire emmc?Not just the app (rootfs) part.

background :Batch production equipment with tx2, We need to flash all the tx2’s the same.

only restore APP partition cannot start the kernel on another device.

opt@opt-desktop:~$ sudo gdisk -l /dev/mmcblk0
[sudo] password for opt:
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/mmcblk0: 61071360 sectors, 29.1 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 00000000-0000-0000-0000-000000000000
Partition table holds up to 31 entries
Main partition table begins at sector 2 and ends at sector 9
First usable sector is 4104, last usable sector is 61071327
Partitions will be aligned on 8-sector boundaries
Total free space is 1 sectors (512 bytes)

Number Start (sector) End (sector) Size Code Name
1 4104 58724359 28.0 GiB 0700 APP
2 58724360 58732551 4.0 MiB 0700 mts-bootpack
3 58732552 58740743 4.0 MiB 0700 mts-bootpack_b
4 58740744 58741767 512.0 KiB 0700 cpu-bootloader
5 58741768 58742791 512.0 KiB 0700 cpu-bootloader_b
6 58742792 58743815 512.0 KiB 0700 bootloader-dtb
7 58743816 58744839 512.0 KiB 0700 bootloader-dtb_b
8 58744840 58750983 3.0 MiB 0700 secure-os
9 58750984 58757127 3.0 MiB 0700 secure-os_b
10 58757128 58761223 2.0 MiB 0700 eks
11 58761224 58769415 4.0 MiB 0700 adsp-fw
12 58769416 58777607 4.0 MiB 0700 adsp-fw_b
13 58777608 58778815 604.0 KiB 0700 bpmp-fw
14 58778816 58780023 604.0 KiB 0700 bpmp-fw_b
15 58780024 58781023 500.0 KiB 0700 bpmp-fw-dtb
16 58781024 58782023 500.0 KiB 0700 bpmp-fw-dtb_b
17 58782024 58786119 2.0 MiB 0700 sce-fw
18 58786120 58790215 2.0 MiB 0700 sce-fw_b
19 58790216 58802503 6.0 MiB 0700 sc7
20 58802504 58814791 6.0 MiB 0700 sc7_b
21 58814792 58818887 2.0 MiB 0700 FBNAME
22 58818888 59081031 128.0 MiB 0700 BMP
23 59081032 59343175 128.0 MiB 0700 BMP_b
24 59343176 59408711 32.0 MiB 0700 SOS
25 59408712 59474247 32.0 MiB 0700 SOS_b
26 59474248 59605319 64.0 MiB 0700 kernel
27 59605320 59736391 64.0 MiB 0700 kernel_b
28 59736392 59737415 512.0 KiB 0700 kernel-dtb
29 59737416 59738439 512.0 KiB 0700 kernel-dtb_b
30 59738440 60262727 256.0 MiB 0700 CAC
31 60262728 61071326 394.8 MiB 0700 UDA

Each of the non-rootfs partitions are signed. I could be wrong, but I believe only the rootfs can be used among the different TX2s as signature would need to change for the non-rootfs partitions. However, an unsigned version can be put in the flash program and this gets signed during flash. Not what you wanted to hear I am sure, but depending on release some versions did allow batch flashing.

You do need to make sure the flash software which installs a clone to a new TX2 uses the same release as that which was used to flash the original TX2. Exceptions exist for minor patch releases. For example, R28.x is incompatible with the flash software of R32.x. R28.2 is compatible with R28.2.1.

If the rootfs size is non-default, then you also need to be sure to specify the size on the command line to avoid truncation.

When you clone you get both a sparse image (the “.img” file), and a raw image (the “.img.raw” file). The raw image will have an exact byte size divisible by 1024 either twice or three times. Twice is the size in MiB, and three times (if divisible evenly) is the size in GiB. E.g., 28GiB corresponds to a raw image size of 30064771072 bytes. 29318MiB corresponds to a raw image size of 30742151168 bytes. The “-S” parameter to “flash.sh” specifies this, and if the image you have placed in “Linux_for_Tegra/system.img” is 30742151168 bytes, then an example command to flash is:

sudo ./flash.sh -S 29318MiB jetson-tx2 mmcblk0p1

Note that if the non-signed content for other partitions or device tree are in the correct place, that these too are flashed and signed during the flash.

There is no option to simply write the entire eMMC as a single image.

Someone else should be able to suggest how to batch flash, but this would depend on knowing which release you are using. You might also mention how much is custom for the non-rootfs partitions and device tree.

thank you very much. I’ll try “sudo ./flash.sh -S 29318MiB jetson-tx2 mmcblk0p1” command.

background: tx2 jetpack4.2

questions:
1、When you say release versions , should you mean software release?I use jetpack4.2 on all tx2, and I think they should all be the same.I used SDK manager to install the system before reloading the rootfs
2、What does ‘signed’ mean?
3、“sudo gdisk -l /dev/mmcblk0” displays the same result as the cloned device. Does this mean non-signed content for other partitions or device tree are in the correct place?
4、I have change the device tree. It supports dp hdmi dual display, 3 usb, and PCIE.Do I need to brush in the device tree?I don’t think the device tree and rootfs errors should affect my kernel boot

NVIDIA Jetson TX2 - Jetpack 4.2 [L4T 32.1.0]

  • Up Time: 0 days 0:28:45 Version: 1.7.8
  • Board: Author: Raffaello Bonghi
    • Name: NVIDIA Jetson TX2 e-mail: raffaello@rnext.it
    • Type: TX2
    • Jetpack: 4.2 [L4T 32.1.0]
    • GPU-Arch: 6.2
    • SN: 0423918014865
  • Libraries:
    • CUDA: NOT_INSTALLED
    • cuDNN: NOT_INSTALLED
    • TensorRT: NOT_INSTALLED
    • VisionWorks: NOT_INSTALLED
    • OpenCV: NOT_INSTALLED compiled CUDA: NO
  • Hostname: opt-desktop
  • Interfaces
    • eth0: 192.168.1.148
    • l4tbr0: 192.168.55.1

thank you very much. It’s work.
1、cloning
sudo ./flash.sh -r -k APP -G backup.img jetson-tx2 mmcblk0p1
2、flash as same release version
sudo ./flash.sh -S 29318MiB jetson-tx2 mmcblk0p1
3、cp
sudo cp backup.img ./bootloader/system.img
sudo cp backup.img.raw ./bootloader/system.img.raw
4、restore system
sudo ./flash.sh -r -S 29318MiB jetson-tx2 mmcblk0p1

Regarding versions, yes, if you use the same JetPack to flash a new unit with the clone as that which was used to produce the original system which provided the clone, then this will do the right thing. If you look at the JetPack versions here, then you’ll note that the L4T version flashed by that JetPack is listed:
https://developer.nvidia.com/embedded/jetpack-archive
(you have to go there, log in, and then click to go there again since redirect does not work)

JetPack 4.2 will always produce a flash of L4T R32.1.

Just remember to always check the size of the clone’s raw image before flashing. If it isn’t default, then you need the “-S”. It never hurts to specifically name the correct size if you don’t know what the default is.

thank very much.That helps