Start_L4T_Docs.html contains a section “Flashing Multiple Tegra Devices”. It’s pretty straightforward, essentially using the existing subcommands to run the flashing sequence against a specified USB device instead of against the only one that’s attached.
My problem is that it does not work.
Cutting and pasting the multi_flash_tegra.sh script launches multiple processes, but they all fail.
I manually executed a flashing command by hand:
$ sudo ./tegraflash.py --bl nvtboot_recovery_cpu.bin --sdram_config P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --odmdata 0x1090000 --applet mb1_recovery_prod.bin --cmd "flash; reboot" --cfg flash.xml --chip 0x18 --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-c03.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 --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-c01-00-te770d-ucm2.dtb; tlk tos.img; eks eks.img; bootloader_dtb tegra186-quill-p3310-1000-c03-00-base.dtb" --instance /dev/bus/usb/002/
...
[ 0.2759 ] Copying signatures
[ 0.2767 ] tegrahost_v2 --chip 0x18 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[ 0.2920 ]
[ 0.2921 ] Boot Rom communication
[ 0.2931 ] tegrarcm_v2 --instance /dev/bus/usb/002/059 --chip 0x18 --rcm rcm_list_signed.xml
[ 0.2939 ] BR_CID: 0x81801001642ca6c61c00000004010040
[ 0.2944 ] RCM version 0X180001
[ 0.2948 ] Boot Rom communication completed
[ 1.3011 ]
[ 1.3022 ] tegrarcm_v2 --instance /dev/bus/usb/002/059 --isapplet
[ 1.3032 ] USB communication failed.Check if device is in recovery
[ 1.3032 ]
[ 1.3040 ] tegradevflash_v2 --instance /dev/bus/usb/002/059 --iscpubl
[ 1.3049 ] Cannot Open USB
[ 1.3049 ]
[ 31.4673 ] Retrieving board information
[ 31.4684 ] tegrarcm_v2 --instance /dev/bus/usb/002/059 --oem platformdetails chip chip_info.bin
[ 31.4694 ] USB communication failed.Check if device is in recovery
[ 31.4694 ]
[ 31.4703 ] tegradevflash_v2 --instance /dev/bus/usb/002/059 --oem platformdetails chip chip_info.bin
[ 31.4716 ] Cannot Open USB
[ 31.4716 ]
Error: Return value 8
Command tegradevflash_v2 --instance /dev/bus/usb/002/059 --oem platformdetails chip chip_info.bin
That’s the failure.
I disconnected the other TX2s and moved this one to being plugged directly in the the PC.
The above command still fails, BUT, since it’s now the only TX2 attached, I immediately reran the command leaving off the --instance parameter, and it worked.
That’s the only difference between working and not-working: the presence or absence of the --instance parameter.
Is this a known issue?
Flashing is about 4-5 minutes per TX2 and we’d like to parallelize that to keep our production time down.
I searched via devtalk’s search and Google and could only turn up one post asking about this for TX1s, with an answer of “it can’t be done”. I assume that post predates the instructions in the documentation I mentioned above.
Interesting!
stracing reveals that the first process in the sequence opens the USB device successfully, twice:
[pid 30311] open("/dev/bus/usb/002/062", O_RDWR) = 3
...
[pid 30311] close(3 <unfinished ...>
[pid 30250] <... read resumed> "B", 1) = 1
[pid 30310] write(1, "--skipuid ", 10) = 10
[pid 30311] <... close resumed> ) = 0
...
[pid 30311] open("/dev/bus/usb/002/062", O_RDWR <unfinished ...>
[pid 30310] <... write resumed> ) = 1
[pid 30250] read(4, "R", 1) = 1
[pid 30310] write(1, "[", 1 <unfinished ...>
[pid 30250] write(1, "R", 1R <unfinished ...>
[pid 30311] <... open resumed> ) = 3
Every other process is getting ENOENT:
[pid 30335] open("/dev/bus/usb/002/062", O_RDWR <unfinished ...>
[pid 30334] <... write resumed> ) = 1
[pid 30250] close(5 <unfinished ...>
[pid 30335] <... open resumed> ) = -1 ENOENT (No such file or directory)
After this /dev/bus/usb/002/063 exists, so there’s some problem where the TX2 re-enumerates and the “–instance” handling doesn’t know to account for that.
strace of a successful run:
[pid 30965] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 30970] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 30970] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 30972] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 30972] open("/dev/bus/usb/002/063", O_RDWR) = 5
[pid 30974] open("/dev/bus/usb/002/063", O_RDWR) = 5
[pid 30974] open("/dev/bus/usb/002/063", O_RDWR) = 5
[pid 31050] open("/dev/bus/usb/002/063", O_RDWR) = 5
[pid 31050] open("/dev/bus/usb/002/063", O_RDWR) = 5
[pid 31052] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 31052] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 31054] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 31054] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 31056] open("/dev/bus/usb/002/063", O_RDWR <unfinished ...>
[pid 31065] open("/dev/bus/usb/002/032", O_RDWR <unfinished ...>
[pid 31065] open("/dev/bus/usb/002/031", O_RDWR) = 5
[pid 31065] open("/dev/bus/usb/002/030", O_RDWR) = 5
[pid 31065] open("/dev/bus/usb/002/004", O_RDWR) = 5
[pid 31065] open("/dev/bus/usb/002/003", O_RDWR) = 5
[pid 31065] open("/dev/bus/usb/002/002", O_RDWR) = 5
[pid 31065] open("/dev/bus/usb/002/001", O_RDWR) = 5
[pid 31082] open("/dev/bus/usb/002/064", O_RDWR <unfinished ...>
[pid 31084] open("/dev/bus/usb/002/064", O_RDWR <unfinished ...>
[pid 31084] open("/dev/bus/usb/002/064", O_RDWR <unfinished ...>
[pid 31086] open("/dev/bus/usb/002/064", O_RDWR <unfinished ...>
[pid 31090] open("/dev/bus/usb/002/064", O_RDWR) = 5
[pid 31132] open("/dev/bus/usb/002/064", O_RDWR) = 5
[pid 31134] open("/dev/bus/usb/002/064", O_RDWR <unfinished ...>
[pid 31136] open("/dev/bus/usb/002/064", O_RDWR <unfinished ...>
shows the existing instance being opened, and its incremented version later on, and a bunch of other USB devices.