How to flash only BCT / pinmux?

Hello Jetson Team.

This topic was already discussed before but I just can’t find any reasonable answer to this.
My goal is to replace CAM0_MCLK which is extperiph1 at the moment with a GPIO.
(I need this because we actually bought an imager which uses a static level of MCLK as a hack for light control…)

I’ve used the pinmux excel sheet and generated the dtsi files and used the script to generate the cfg files.
I’m not sure if this whole process was correct but my problem is that I can’t flash the BCT files.
Flashing the whole TX2 is NOT an option as I need to do this for 6 TX2s actively in use by the team and the rootfs should not get lost.

My expectation was this:

sudo ./ -r -k BCT jetson-tx2 mmcblk0p1

The output:

zeps01@DE160841:/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2$ sudo ./ -r -k BCT jetson-tx2 mmcblk0p1
./ --chip 0x18 --applet "/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/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.0025 ] Generating RCM messages
[   0.0033 ] tegrarcm_v2 --listrcm rcm_list.xml --chip 0x18 --download rcm /media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/mb1_recovery_prod.bin 0 0
[   0.0038 ] RCM 0 is saved as rcm_0.rcm
[   0.0042 ] RCM 1 is saved as rcm_1.rcm
[   0.0042 ] List of rcm files are saved in rcm_list.xml
[   0.0042 ] 
[   0.0042 ] Signing RCM messages
[   0.0051 ] tegrasign_v2 --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0057 ] Assuming zero filled SBK key
[   0.0086 ] 
[   0.0086 ] Copying signature to RCM mesages
[   0.0092 ] tegrarcm_v2 --chip 0x18 --updatesig rcm_list_signed.xml
[   0.0099 ] 
[   0.0100 ] Boot Rom communication
[   0.0105 ] tegrarcm_v2 --chip 0x18 --rcm rcm_list_signed.xml --skipuid
[   0.0111 ] RCM version 0X180001
[   0.2241 ] Boot Rom communication completed
[   1.2302 ] 
[   1.2312 ] tegrarcm_v2 --isapplet
[   1.2321 ] Applet version 01.00.0000
[   1.7816 ] 
[   1.7830 ] Retrieving EEPROM data
[   1.7831 ] tegrarcm_v2 --oem platformdetails eeprom cvm /media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/cvm.bin
[   1.7841 ] Applet version 01.00.0000
[   2.4534 ] Saved platform info in /media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/cvm.bin
[   2.5306 ] 
Board ID(3310) version(B02) 
copying bctfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg)... done.
copying misc_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/tegra186-mb1-bct-misc-si-l4t.cfg)... done.
copying pinmux_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg)... done.
copying pmic_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/tegra186-mb1-bct-pmic-quill-p3310-1000-c04.cfg)... done.
copying pmc_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/tegra186-mb1-bct-pad-quill-p3310-1000-c03.cfg)... done.
copying prod_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/tegra186-mb1-bct-prod-quill-p3310-1000-c03.cfg)... done.
copying scr_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/minimal_scr.cfg)... done.
copying scr_cold_boot_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/mobile_scr.cfg)... done.
copying bootrom_config(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/tegra186-mb1-bct-bootrom-quill-p3310-1000-c03.cfg)... done.
copying dev_params(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/BCT/emmc.cfg)... done.
Existing bootloader(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/nvtboot_cpu.bin) reused.
	populating kernel to rootfs... done.
	populating initrd to rootfs... done.
	populating extlinux.conf.emmc to rootfs... done.
	populating /media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb to rootfs... done.
Making Boot image... done.
Existing sosfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/mb1_recovery_prod.bin) reused.
copying tegraboot(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/nvtboot.bin)... done.
Existing mb2blfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/nvtboot_recovery.bin) reused.
Existing mtspreboot(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/preboot_d15_prod_cr.bin) reused.
Existing mts(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/mce_mts_d15_prod_cr.bin) reused.
Existing mb1file(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/mb1_prod.bin) reused.
Existing bpffile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/bpmp.bin) reused.
copying bpfdtbfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/tegra186-a02-bpmp-quill-p3310-1000-c04-00-te770d-ucm2.dtb)... done.
Existing scefile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/camera-rtcpu-sce.bin) reused.
Existing spefile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/spe.bin) reused.
copying wb0boot(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/warmboot.bin)... done.
Existing tosfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/tos.img) reused.
Existing eksfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/eks.img) reused.
copying dtbfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)... done.
Reusing existing system.img... 
Existing tbcfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/cboot.bin) reused.
copying tbcdtbfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb)... done.
copying cfgfile(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/t186ref/cfg/flash_l4t_t186.xml) to flash.xml... done.
Existing flasher(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/nvtboot_recovery_cpu.bin) reused.
Existing flashapp(/media/data1/zeps01/JetPack3.1/64_TX2/Linux_for_Tegra_tx2/bootloader/ reused.
*** Updating :BCT with P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg ***
./ line 1618: [: -eq: unary operator expected
./ --sdram_config P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg --updatebct SDRAM --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 BCT P3310_A00_8GB_Samsung_8GB_lpddr4_204Mhz_A02_l4t.cfg;"  
option --updatebct not recognized
  Usage: tegraflash [--bct <file] [--cfg <file>] [--bl <file>] [--instance <number>]
                    [--chip <number>] [--dtb <file>] [--bldtb <file>] [--kerneldtb <file>] [--key <file>] [--cmd "commands"]
                    [--applet <file>] [--nct <file>] [--hostbin <dir>] [--out <dir>]
                    [--boardconfig <file>] [--skipuid] [--securedev] [--keyindex <number>] [--keep]
                    [--bl-load <addr>] [--dev_params <file>] [--sdram_config <file>]
                    [--bins <image_type> <file> [load_address][;...]]
                    [--misc_config <file>] [--mb1_bct <file>]
                    [--pinmux_config <file>] [--pmc <file>] [--scr_config <file>]
                    [--pmic_config <file>] [--br_cmd_config <file>] [--prod_config <file]
   --bct           : Bootrom Boot Config Table file
   --cfg           : Partition layout configuration file
   --bl            : Command line bootloader
   --bl-load       : Bootloader load/entry address
   --chip          : Chip Id
   --dtb           : DTB file to be used by both (old implementation, to deprecate in future)
   --bldtb         : DTB file to be used by cboot
   --kerneldtb     : DTB file to be used by kernel
   --key           : Key for signing required files
   --encrypt_key   : Key for encrypting required files
   --applet        : Applet to be sent to BootRom
   --nct           : NCT file
   --boardconfig   : File containing board configuration
   --skipuid       : Skip reading Chip UID
   --skipsanitize  : Skip SDMMC sanitize
   --securedev     : path for flashing fused devices
   --keyindex      : FSKP key index
   --cmd           : List of comma(;) separated commands
   --dev_params    : Boot device parameters
   --sdram_config  : Sdram configuration
   --bins          : List of binaries to be downloaded separated by commad(;)
   --misc_config   : Misc BCT configuration
   --pinmux_config : Pinmux BCT configuration
   --scr_config    : SCR BCT configuration
   --scr_cold_boot_config : SCR BCT configuration to be used in coldboot
   --pmc_onfig     : Pad voltage - DPD BCT configuration
   --pmic_config   : PMIC - Rails MMIO/I2C Commands BCT configuration
   --br_cmd_config : BootROM MMIO/I2C Commands BCT configuration
   --prod_config   : Pinmux prod setings BCT configuration
   --mb1_bct       : MB1 BCT file
   --mb1_cold_boot_bct: MB1 BCT file used in coldboot
   --hostbin       : Directory contaning host binaries
   --out           : Directory containing device files
   --keep          : Keep temporary directory
Failed to flash/read t186ref.

It seems the script is buggy when I would like to do this.
Is there a better way? Do I need to do this for changing this pinmuxing?
Or can I just do it with the device tree?

I actually entered this GPIO into the device tree and requested it. But sadly the output of the pin doesn’t change when setting it.

#define CAM0_MCLK	TEGRA_MAIN_GPIO(O, 0) //F9 -> GPIO3_PO.00

	gpio@2200000 {
		camera-control-output-low {
			gpios = <CAM0_RST_L 0 CAM0_PWDN 0 CAM0_LED_ENABLE 0 CAM0_MCLK 0>;
			label = "cam0-rst", "cam0-pwdn", "cam0-led", "cam0-mclk";


  1. The BCT only for the RAM information the pinmux should be in the bpmp-fw-dtb partition.
  2. Check if any duplicate define the same GPIO.

Thank you sir.
You were right. Also pinmuxing wasn’t even needed. The GPIO configuration was just wrong.
It works now