Error: Return value 4 from tegrahost_v2 while flashing a Jetson with a RaspberryPi4B

Hi,

I’m trying to flash a jetson with a RPi via USB. The scripts I’m using are provided by my organization, they are
executables for aarch64.

Here is the command I’m using:

sudo sh -c 'export PATH=/home/ubuntu/flashstuff/build/private/bin/aarch64:/home/ubuntu/flashstuff/build/private/working/runtime_dependencies/bin:$PATH; tegraflash.py "$@"' flash_magic --bl nvtboot_recovery_cpu.bin --sdram_config P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --odmdata 0x1090000 --applet mb1_recovery_prod.bin --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-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 --cmd 'flash; reboot' --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-trusty.img; eks eks.img; bootloader_dtb tegra186-quill-p3310-1000-c03-00-base.dtb'

Here is the output:

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.0033 ] tegrasign_v2 --key None --getmode mode.txt
[   0.0063 ] Assuming zero filled SBK key
[   0.0071 ] 
[   0.0073 ] Generating RCM messages
[   0.0108 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 0 --download rcm mb1_recovery_prod.bin 0 0
[   0.0150 ] RCM 0 is saved as rcm_0.rcm
[   0.0174 ] RCM 1 is saved as rcm_1.rcm
[   0.0174 ] List of rcm files are saved in rcm_list.xml
[   0.0175 ] 
[   0.0175 ] Signing RCM messages
[   0.0217 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0259 ] Assuming zero filled SBK key
[   0.0344 ] 
[   0.0344 ] Copying signature to RCM mesages
[   0.0377 ] tegrarcm_v2 --chip 0x18 0 --updatesig rcm_list_signed.xml
[   0.0429 ] 
[   0.0430 ] Parsing partition layout
[   0.0461 ] tegraparser_v2 --pt flash.xml.tmp
[   0.0511 ] 
[   0.0512 ] Creating list of images to be signed
[   0.0552 ] tegrahost_v2 --chip 0x18 0 --partitionlayout flash.xml.bin --list images_list.xml zerosbk
[   0.3005 ] 
[   0.3007 ] Generating signatures
[   0.3065 ] tegrasign_v2 --key None --list images_list.xml --pubkeyhash pub_key.key
[   0.3123 ] Assuming zero filled SBK key
[   0.8716 ] 
[   0.8717 ] Generating br-bct
[   0.8752 ] Updating dev and MSS params in BR BCT
[   0.8754 ] tegrabct_v2 --dev_param emmc.cfg --sdram P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --brbct br_bct.cfg --chip 0x18 0
[   0.9228 ] 
[   0.9229 ] Updating bl info
[   0.9262 ] tegrabct_v2 --brbct br_bct_BR.bct --chip 0x18 0 --updateblinfo flash.xml.bin --updatesig images_list_signed.xml
[   0.9331 ] 
[   0.9332 ] Updating smd info
[   0.9369 ] tegrabct_v2 --brbct br_bct_BR.bct --chip 0x18 --updatesmdinfo flash.xml.bin
[   0.9436 ] 
[   0.9438 ] Updating Odmdata
[   0.9483 ] tegrabct_v2 --brbct br_bct_BR.bct --chip 0x18 0 --updatefields Odmdata =0x1090000
[   0.9539 ] 
[   0.9540 ] Get Signed section of bct
[   0.9584 ] tegrabct_v2 --brbct br_bct_BR.bct --chip 0x18 0 --listbct bct_list.xml
[   0.9644 ] 
[   0.9700 ] tegrasign_v2 --key None --list bct_list.xml --pubkeyhash pub_key.key
[   0.9754 ] Assuming zero filled SBK key
[   0.9772 ] 
[   0.9773 ] Updating BCT with signature
[   0.9811 ] tegrabct_v2 --brbct br_bct_BR.bct --chip 0x18 0 --updatesig bct_list_signed.xml
[   0.9868 ] 
[   0.9869 ] Generating coldboot mb1-bct
[   0.9918 ] tegrabct_v2 --chip 0x18 0 --mb1bct mb1_cold_boot_bct.cfg --sdram P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --misc tegra186-mb1-bct-misc-si-l4t.cfg --scr mobile_scr.cfg --pinmux tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg --pmc tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg --pmic tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg --brcommand tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg --prod tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg
[   0.9965 ] MB1-BCT version: 0xf
[   0.9977 ] Copying Sdram info from 2 to 3 set
[   1.0408 ] Packing sdram param for instance[0]
[   1.0419 ] Packing sdram param for instance[1]
[   1.0429 ] Packing sdram param for instance[2]
[   1.0439 ] Packing sdram param for instance[3]

[   1.0449 ] Parsing config file :tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg 
[   1.0468 ] Appending platform config data of size :- 3032

[   1.0489 ] Parsing config file :mobile_scr.cfg 
[   1.0499 ] Appending platform config data of size :- 12240
[   1.0549 ] 
[   1.0551 ] Parsing config file :tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg 
[   1.0552 ] Appending platform config data of size :- 24
[   1.0553 ] 
[   1.0554 ] Parsing config file :tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg 
[   1.0555 ] Appending platform config data of size :- 672
[   1.0556 ] 
[   1.0557 ] Parsing config file :tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg 
[   1.0558 ] Appending platform config data of size :- 64
[   1.0560 ] 
[   1.0561 ] Parsing config file :tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg 
[   1.0562 ] Appending platform config data of size :- 1628
[   1.0563 ] 
[   1.0566 ] Updating mb1-bct with firmware information
[   1.0601 ] tegrabct_v2 --chip 0x18 --mb1bct mb1_cold_boot_bct_MB1.bct --updatefwinfo flash.xml.bin
[   1.0647 ] MB1-BCT version: 0xf
[   1.0707 ] 
[   1.0710 ] Updating mb1-bct with storage information
[   1.0757 ] tegrabct_v2 --chip 0x18 --mb1bct mb1_cold_boot_bct_MB1.bct --updatestorageinfo flash.xml.bin
[   1.0814 ] MB1-BCT version: 0xf
[   1.0878 ] 
[   1.0922 ] tegrahost_v2 --chip 0x18 --align mb1_cold_boot_bct_MB1.bct
[   1.0980 ] 
[   1.1035 ] tegrahost_v2 --appendsigheader mb1_cold_boot_bct_MB1.bct zerosbk
[   1.1077 ] 
Error: Return value 4
Command tegrahost_v2 --appendsigheader mb1_cold_boot_bct_MB1.bct zerosbk

I cannot find much on what return value 4 exactly means hence I cannot make an attempt to debug. Can I please get some help with this?

RPi has no possibility of succeeding. It is an arm64/aarch64 architecture, and the flash software can run only on a desktop PC architecture.