Error when flashing image of Jetson TX2 to another Jetson TX2 "0000000000000004: Size is more than actual size"

Hello,

I followed this tutorial: Jetson/TX2 Cloning - eLinux.org

System Information:
Jetpack 3.3
Host: Ubuntu 16.04, Laptop (not a VM)

Cloning the Jetson TX2 is not a problem. I don’t get any errors.

But when I try to flash the Image to another Jetson TX2 with the command:
$ sudo ./flash.sh -r -k APP jetson-tx2 mmcblk0p1
I get the following output:

###############################################################################

L4T BSP Information:

R28 (release), REVISION: 2.1, GCID: 11272647, BOARD: t186ref, EABI: aarch64,

DATE: Thu May 17 07:29:06 UTC 2018

###############################################################################

Target Board Information:

Name: jetson-tx2, Board Family: t186ref, SoC: Tegra 186,

OpMode: production, Boot Authentication: ,

###############################################################################
./tegraflash.py --chip 0x18 --applet “/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin” --cmd “dump eeprom boardinfo cvm.bin” --skipuid
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0014 ] Generating RCM messages
[ 0.0021 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 --download rcm /home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin 0 0
[ 0.0027 ] RCM 0 is saved as rcm_0.rcm
[ 0.0030 ] RCM 1 is saved as rcm_1.rcm
[ 0.0030 ] List of rcm files are saved in rcm_list.xml
[ 0.0030 ]
[ 0.0030 ] Signing RCM messages
[ 0.0036 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[ 0.0043 ] Assuming zero filled SBK key
[ 0.0072 ]
[ 0.0072 ] Copying signature to RCM mesages
[ 0.0078 ] tegrarcm_v2 --chip 0x18 --updatesig rcm_list_signed.xml
[ 0.0087 ]
[ 0.0087 ] Boot Rom communication
[ 0.0093 ] tegrarcm_v2 --chip 0x18 --rcm rcm_list_signed.xml --skipuid
[ 0.0098 ] RCM version 0X180001
[ 0.0108 ] Boot Rom communication completed
[ 1.0178 ]
[ 1.0201 ] tegrarcm_v2 --isapplet
[ 1.0221 ] Applet version 01.00.0000
[ 1.0396 ]
[ 1.0419 ] Retrieving EEPROM data
[ 1.0421 ] tegrarcm_v2 --oem platformdetails eeprom cvm /home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/cvm.bin
[ 1.0440 ] Applet version 01.00.0000
[ 1.0759 ] Saved platform info in /home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/cvm.bin
[ 1.1535 ]
copying bctfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg)… done.
copying misc_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-misc-si-l4t.cfg)… done.
copying pinmux_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg)… done.
copying pmic_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg)… done.
copying pmc_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg)… done.
copying prod_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg)… done.
copying scr_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/minimal_scr.cfg)… done.
copying scr_cold_boot_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/mobile_scr.cfg)… done.
copying bootrom_config(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg)… done.
copying dev_params(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/BCT/emmc.cfg)… done.
Existing bootloader(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
populating kernel to rootfs… done.
populating initrd to rootfs… done.
populating extlinux.conf.emmc to rootfs… done.
populating /home/ubuntu/64_TX2/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb to rootfs… done.
done.
Making Boot image… done.
Existing sosfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/mb1_recovery_prod.bin) reused.
copying tegraboot(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/nvtboot.bin)… done.
Existing mb2blfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/nvtboot_recovery.bin) reused.
Existing mtspreboot(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/preboot_d15_prod_cr.bin) reused.
Existing mts(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/mce_mts_d15_prod_cr.bin) reused.
Existing mb1file(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/mb1_prod.bin) reused.
Existing bpffile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/bpmp.bin) reused.
copying bpfdtbfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb)… done.
Existing scefile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/camera-rtcpu-sce.bin) reused.
Existing spefile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/spe.bin) reused.
copying wb0boot(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/warmboot.bin)… done.
Existing tosfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/tos.img) reused.
Existing eksfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/eks.img) reused.
copying dtbfile(/home/ubuntu/64_TX2/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)… done.
Reusing existing system.img…
done.
Existing tbcfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/cboot.bin) reused.
copying tbcdtbfile(/home/ubuntu/64_TX2/Linux_for_Tegra/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)… done.
copying cfgfile(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/t186ref/cfg/flash_l4t_t186.xml) to flash.xml… done.
Existing flasher(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/nvtboot_recovery_cpu.bin) reused.
Existing flashapp(/home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/tegraflash.py) reused.
*** Updating [APP] with system.img ***
./tegraflash.py --bl nvtboot_recovery_cpu.bin --chip 0x18 --applet mb1_recovery_prod.bin --sdram_config P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --misc_config tegra186-mb1-bct-misc-si-l4t.cfg --pinmux_config tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg --pmic_config tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg --pmc_config tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg --prod_config tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg --scr_config minimal_scr.cfg --scr_cold_boot_config mobile_scr.cfg --br_cmd_config tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg --dev_params emmc.cfg --cfg flash.xml --bins “mb2_bootloader nvtboot_recovery.bin; mts_preboot preboot_d15_prod_cr.bin; mts_bootpack mce_mts_d15_prod_cr.bin; bpmp_fw bpmp.bin; bpmp_fw_dtb tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb; tlk tos.img; eks eks.img; bootloader_dtb tegra186-quill-p3310-1000-c03-00-base.dtb” --cmd “write APP system.img; reboot”
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0062 ] Generating RCM messages
[ 0.0069 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 --download rcm mb1_recovery_prod.bin 0 0
[ 0.0075 ] RCM 0 is saved as rcm_0.rcm
[ 0.0078 ] RCM 1 is saved as rcm_1.rcm
[ 0.0078 ] List of rcm files are saved in rcm_list.xml
[ 0.0078 ]
[ 0.0078 ] Signing RCM messages
[ 0.0085 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[ 0.0092 ] Assuming zero filled SBK key
[ 0.0121 ]
[ 0.0121 ] Copying signature to RCM mesages
[ 0.0127 ] tegrarcm_v2 --chip 0x18 --updatesig rcm_list_signed.xml
[ 0.0137 ]
[ 0.0137 ] Boot Rom communication
[ 0.0144 ] tegrarcm_v2 --chip 0x18 --rcm rcm_list_signed.xml
[ 0.0151 ] BootRom is not running
[ 1.0215 ]
[ 1.0230 ] tegrarcm_v2 --isapplet
[ 1.0243 ] Applet version 01.00.0000
[ 1.0397 ]
[ 1.0414 ] tegrasign_v2 --key None --getmode mode.txt
[ 1.0429 ] Assuming zero filled SBK key
[ 1.0431 ]
[ 1.0432 ] Parsing partition layout
[ 1.0447 ] tegraparser_v2 --pt flash.xml.tmp
[ 1.0470 ]
[ 1.0471 ] Creating list of images to be signed
[ 1.0486 ] tegrahost_v2 --chip 0x18 --partitionlayout flash.xml.bin --list images_list.xml zerosbk
[ 1.0679 ]
[ 1.0680 ] Generating signatures
[ 1.0689 ] tegrasign_v2 --key None --list images_list.xml --pubkeyhash pub_key.key
[ 1.0696 ] Assuming zero filled SBK key
[ 1.2957 ]
[ 1.2957 ] Reading BCT from device for further operations
[ 1.2957 ] Generating blob
[ 1.2966 ] tegrahost_v2 --align blob_nvtboot_recovery_cpu.bin
[ 1.2974 ]
[ 1.2982 ] tegrahost_v2 --appendsigheader blob_nvtboot_recovery_cpu.bin zerosbk
[ 1.2992 ]
[ 1.3000 ] tegrasign_v2 --key None --list blob_nvtboot_recovery_cpu_sigheader.bin_list.xml
[ 1.3006 ] Assuming zero filled SBK key
[ 1.3055 ]
[ 1.3065 ] tegrahost_v2 --updatesigheader blob_nvtboot_recovery_cpu_sigheader.bin.encrypt blob_nvtboot_recovery_cpu_sigheader.bin.hash zerosbk
[ 1.3074 ]
[ 1.3083 ] tegrahost_v2 --align blob_nvtboot_recovery.bin
[ 1.3090 ]
[ 1.3096 ] tegrahost_v2 --appendsigheader blob_nvtboot_recovery.bin zerosbk
[ 1.3105 ]
[ 1.3114 ] tegrasign_v2 --key None --list blob_nvtboot_recovery_sigheader.bin_list.xml
[ 1.3120 ] Assuming zero filled SBK key
[ 1.3144 ]
[ 1.3154 ] tegrahost_v2 --updatesigheader blob_nvtboot_recovery_sigheader.bin.encrypt blob_nvtboot_recovery_sigheader.bin.hash zerosbk
[ 1.3162 ]
[ 1.3170 ] tegrahost_v2 --align blob_preboot_d15_prod_cr.bin
[ 1.3177 ]
[ 1.3184 ] tegrahost_v2 --appendsigheader blob_preboot_d15_prod_cr.bin zerosbk
[ 1.3193 ]
[ 1.3201 ] tegrasign_v2 --key None --list blob_preboot_d15_prod_cr_sigheader.bin_list.xml
[ 1.3208 ] Assuming zero filled SBK key
[ 1.3226 ]
[ 1.3235 ] tegrahost_v2 --updatesigheader blob_preboot_d15_prod_cr_sigheader.bin.encrypt blob_preboot_d15_prod_cr_sigheader.bin.hash zerosbk
[ 1.3243 ]
[ 1.3251 ] tegrahost_v2 --align blob_mce_mts_d15_prod_cr.bin
[ 1.3258 ]
[ 1.3266 ] tegrahost_v2 --appendsigheader blob_mce_mts_d15_prod_cr.bin zerosbk
[ 1.3306 ]
[ 1.3318 ] tegrasign_v2 --key None --list blob_mce_mts_d15_prod_cr_sigheader.bin_list.xml
[ 1.3326 ] Assuming zero filled SBK key
[ 1.3835 ]
[ 1.3846 ] tegrahost_v2 --updatesigheader blob_mce_mts_d15_prod_cr_sigheader.bin.encrypt blob_mce_mts_d15_prod_cr_sigheader.bin.hash zerosbk
[ 1.3875 ]
[ 1.3884 ] tegrahost_v2 --align blob_bpmp.bin
[ 1.3891 ]
[ 1.3899 ] tegrahost_v2 --appendsigheader blob_bpmp.bin zerosbk
[ 1.3914 ]
[ 1.3923 ] tegrasign_v2 --key None --list blob_bpmp_sigheader.bin_list.xml
[ 1.3929 ] Assuming zero filled SBK key
[ 1.4058 ]
[ 1.4067 ] tegrahost_v2 --updatesigheader blob_bpmp_sigheader.bin.encrypt blob_bpmp_sigheader.bin.hash zerosbk
[ 1.4081 ]
[ 1.4089 ] tegrahost_v2 --align blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb
[ 1.4096 ]
[ 1.4103 ] tegrahost_v2 --appendsigheader blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb zerosbk
[ 1.4117 ]
[ 1.4124 ] tegrasign_v2 --key None --list blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb_list.xml
[ 1.4131 ] Assuming zero filled SBK key
[ 1.4239 ]
[ 1.4246 ] tegrahost_v2 --updatesigheader blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.encrypt blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.hash zerosbk
[ 1.4260 ]
[ 1.4267 ] tegrahost_v2 --align blob_tos.img
[ 1.4275 ]
[ 1.4282 ] tegrahost_v2 --appendsigheader blob_tos.img zerosbk
[ 1.4290 ]
[ 1.4299 ] tegrasign_v2 --key None --list blob_tos_sigheader.img_list.xml
[ 1.4306 ] Assuming zero filled SBK key
[ 1.4324 ]
[ 1.4333 ] tegrahost_v2 --updatesigheader blob_tos_sigheader.img.encrypt blob_tos_sigheader.img.hash zerosbk
[ 1.4343 ]
[ 1.4353 ] tegrahost_v2 --align blob_eks.img
[ 1.4361 ]
[ 1.4367 ] tegrahost_v2 --appendsigheader blob_eks.img zerosbk
[ 1.4375 ]
[ 1.4384 ] tegrasign_v2 --key None --list blob_eks_sigheader.img_list.xml
[ 1.4391 ] Assuming zero filled SBK key
[ 1.4392 ]
[ 1.4402 ] tegrahost_v2 --updatesigheader blob_eks_sigheader.img.encrypt blob_eks_sigheader.img.hash zerosbk
[ 1.4409 ]
[ 1.4418 ] tegrahost_v2 --align blob_tegra186-quill-p3310-1000-c03-00-base.dtb
[ 1.4425 ]
[ 1.4432 ] tegrahost_v2 --appendsigheader blob_tegra186-quill-p3310-1000-c03-00-base.dtb zerosbk
[ 1.4444 ]
[ 1.4453 ] tegrasign_v2 --key None --list blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb_list.xml
[ 1.4460 ] Assuming zero filled SBK key
[ 1.4546 ]
[ 1.4554 ] tegrahost_v2 --updatesigheader blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.hash zerosbk
[ 1.4566 ]
[ 1.4575 ] tegrahost_v2 --generateblob blob.xml blob.bin
[ 1.4582 ] number of images in blob are 9
[ 1.4584 ] blobsize is 3749384
[ 1.4585 ] Added binary blob_nvtboot_recovery_cpu_sigheader.bin.encrypt of size 190048
[ 1.4599 ] Added binary blob_nvtboot_recovery_sigheader.bin.encrypt of size 79600
[ 1.4601 ] Added binary blob_preboot_d15_prod_cr_sigheader.bin.encrypt of size 63024
[ 1.4604 ] Added binary blob_mce_mts_d15_prod_cr_sigheader.bin.encrypt of size 2076832
[ 1.4610 ] Added binary blob_bpmp_sigheader.bin.encrypt of size 529440
[ 1.4614 ] Added binary blob_tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2_sigheader.dtb.encrypt of size 466160
[ 1.4619 ] Added binary blob_tos_sigheader.img.encrypt of size 62976
[ 1.4621 ] Added binary blob_eks_sigheader.img.encrypt of size 1488
[ 1.4623 ] Added binary blob_tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt of size 279664
[ 1.4635 ]
[ 1.4636 ] Sending bootloader and pre-requisite binaries
[ 1.4644 ] tegrarcm_v2 --download blob blob.bin
[ 1.4650 ] Applet version 01.00.0000
[ 1.4834 ] Sending blob
[ 1.4835 ] [… ] 027%
[ 1.4835 ] [… ] 055%
[ 1.4835 ] [… ] 083%
[ 1.4835 ] […] 100%
[ 2.3164 ]
[ 2.3176 ] tegrarcm_v2 --boot recovery
[ 2.3185 ] Applet version 01.00.0000
[ 2.3369 ]
[ 2.3381 ] tegrarcm_v2 --isapplet
[ 2.9930 ]
[ 2.9951 ] tegradevflash_v2 --iscpubl
[ 2.9969 ] CPU Bootloader is not running on device.
[ 2.9976 ]
[ 4.4700 ] Writing partition
[ 4.4716 ] tegradevflash_v2 --write APP /home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/system.img
[ 4.4733 ] Bootloader version 01.00.0000
[ 4.4917 ] Writing partition APP with /home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/system.img
[ 4.4929 ] 0000000000000004: Size is more than actual size
[ 4.5070 ]
[ 4.5070 ]
Error: Return value 4
Command tegradevflash_v2 --write APP /home/ubuntu/64_TX2/Linux_for_Tegra/bootloader/system.img
Failed to flash/read t186ref.

Does anyone understand this?
Please let me know if you need further information.

What is the exact size of the clone (the “.img.raw” clone, not the “something.img” clone)? This value should be evenly divisible by 1024 either twice or three times. Examples:

  • 15032385536 is divisible three times by 1024 and is 14, a.k.a., "14GiB".
  • 14973665280 is divisible twice by 1024 and is 14280, a.k.a., "14280MiB".

The “-S size” parameter of flash.sh is used for setting non-default sizes. If the image is 15032385536 bytes, then “flash.sh -S 14GiB …” is how the command starts to allow for this; if 14973665280 bytes is the image size, then “flash.sh -S 14580MiB …” is how the command starts for this.

If your image (assuming the raw image, not the sparse image) is not evenly divisible by 1024 twice or three times, then the image is not valid. If you are using an image from one release on a different release, then odds are high the combination is not valid. If your image is from the same release of software doing the flash, then the “-S size” parameter should do the trick.

Do note that the “.img” file, which is smaller than the “.img.raw” file, will not have a predictable size other than being smaller than the “.img.raw” file if the filesystem is not full.