After compiling the custom kernel and .ko modules, flashing failed

log.txt (38.2 KB)

root@wpces:/home/wpces/Downloads/Linux_for_Tegra/bootloader# bash ./flashcmd.txt
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
Traceback (most recent call last):
  File "/home/wpces/Downloads/Linux_for_Tegra/bootloader/./tegraflash.py", line 1479, in <module>
    tegraflash_run_commands()
  File "/home/wpces/Downloads/Linux_for_Tegra/bootloader/./tegraflash.py", line 1293, in tegraflash_run_commands
    interpreter.onecmd(command)
  File "/usr/lib/python3.12/cmd.py", line 217, in onecmd
    return func(arg)
           ^^^^^^^^^
  File "/home/wpces/Downloads/Linux_for_Tegra/bootloader/./tegraflash.py", line 342, in do_secureflash
    self.chip_inst.tegraflash_secureflash(exports)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TFlashT264' object has no attribute 'tegraflash_secureflash'. Did you mean: 'tegraflash_flash'?
root@wpces:/home/wpces/Downloads/Linux_for_Tegra/bootloader# 

Modified the pinmux and GPIO in MB1, the flashing command is ./l4t_initrd_flash.sh jetson-agx-thor-devkit internal.

My custom device doesn’t involve secure boot, so why are the same flashing commands not working now?

Hi wpceswpces,

Do you mean the flashing is working before you update the custom kernel and .ko?

Please use sudo for the inird flash script.

Hi,KevinFFF

YES,However, I’m logged in as the root user, and I didn’t need to add sudo before. Why is it now reporting “secureflash”?I just tried adding sudo, but it didn’t help. Can you help me look into this issue? It’s quite urgent.

I would suggest you logged out for root user and add sudo for initrd flash script instead.

[   3.6587 ] Pre-processing config: tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000.dts
[   3.6587 ] Bct flags: CONFIG_ENABLE_SC7, MEM_BCT 
Error: Return value 1
Command dtc -I dts -O dtb -o tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000_cpp.dtb tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000_cpp.dts
cp: cannot stat 'signed/*': No such file or directory
cp: cannot stat 'signed/flash.xml.tmp': No such file or directory

From the log you shared, it may be caused from some files are not found.

I don’t get similar issue when I flash the official BSP package on the devkit.
Could you share the detailed steps how do you update custom kernel and .ko which may cause the issue?
You can also share the custom kernel and .ko to me.
I would like to verify it on the devkit locally.

grep -in secureflash flashcmd.txt

If there check context and maybe delete it?

Hi,whitesscott

I tried deleting “secure” inside the file, but it didn’t work. I even deleted the entire flashcmd.txt, but since this file is regenerated during the flashing process, it didn’t help either.

Hi,KevinFFF

In addition to the kernel and ko, I also modified the device tree, Pinmux, and GPIO multiplexing. However, I don’t think this should affect the flashing or the image packaging process. It seems like the image hasn’t been packaged yet. I’ve found similar issues, but on other platforms, and there was no response from you.

Jetpack 6 custom flash issue - Jetson & Embedded Systems / Jetson Orin NX - NVIDIA Developer Forums

If nothing else works you could try

mv Linux_for_Tegra Linux_for_Tegra_backup

tar -xpf Jetson_Linux_R38.2.1_aarch64.tbz2
cd Linux_for_Tegra/rootfs/
sudo tar -xpf ../../Tegra_Linux_Sample-Root-Filesystem_R38.2.1_aarch64.tbz2
cd ..
sudo ./apply_binaries.sh --openrm

Then copied my kernel and dtb from

Linux_for_Tegra_backup/ Linux_for_Tegra/


Created fresh images and kept them.

sudo ./l4t_initrd_flash.sh --no-flash --keep jetson-agx-thor-devkit internal

Then flash

sudo ./l4t_initrd_flash.sh --flash-only --reuse jetson-agx-thor-devkit internal

As you have multiple customizations, we need you helping to clarify what modification would cause the current issue. You can revert your change one-by-one to clarify.

Have you referred to each steps in Kernel Customization — NVIDIA Jetson Linux Developer Guide to build kernel especially for Building the NVIDIA Out-of-Tree Modules? Some users forget to update them and cause unexpected errors.

You could delete these to see if it would help.

cd Linux_for_Tegra

# 1) Remove initrd-flash staging outputs
sudo rm -rf tools/kernel_flash/images/*

# 2) Remove tegraflash-generated leftovers in bootloader/
sudo rm -f  bootloader/flashcmd.txt \
            bootloader/flash.idx \
            bootloader/images_list.xml \
            bootloader/tegraflash*.log \
            bootloader/tegraflash*.txt

# 3) Remove common generated blobs (optional but often helpful)
sudo rm -f bootloader/*sigheader* bootloader/*.encrypt bootloader/*signed* \
           bootloader/br_bct*.bin bootloader/bct*.cfg bootloader/*.bct 

Hi,whitesscott

Thank you for your reply. I’ve re-exported the modifications and set up a new environment. Currently, the new setup allows for flashing, but the reason why the flashing didn’t work before is quite strange.

1 Like

Hi,KevinFFF

Oh no, it happened again! I only replaced part of the content in the mb1 pinmux and mb1 GPIO .dtsi files.But I manually copied and modified the relevant pin sections, not directly copying from the Excel-generated file. It’s really strange. Is there a verification mechanism for this?

i tried this Just now, but it didn’t make a difference. T T

If l4t_initrd_flash.sh has reverted to failing on tegraflash_secureflash error, what are the pinmux and GPIO changes in mb1 ?

Hi,whitesscott

It doesn’t work when I copy the pins modified from the Pinmux_Template to the existing dtsi by myself. I’m not sure if there’s any validation. What I did was comment out the unused pins before pinmux_unused_lowpower and then place the new configuration above it, but it results in a secureflash error. However, if I directly copy and overwrite the dtsi generated by Pinmux_Template, everything works fine.

Can you post the parts of the pinmux*.dts{i} that you change and that you add?

Does your dts{i} compile? Maybe post the /tmp/dtc-pinmux.log if it fails.

dtc -I dts -O dtb -o /tmp/pinmux_test.dtb -Wno-unit_address_vs_reg
path/to/your-pinmux.dtsi 2>&1 | tee /tmp/dtc-pinmux.log

Hi,whitesscott

Will the pinmux for MB1 be compiled? Is it compiled when generating the image before flashing? Because I couldn’t find the mb1-bct-xxxxxx.dtb file under the bootloader directory.

I saw this in one of your logs. I can’t find tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000_cpp.dts

[   1.1410 ] Generating mb1-bct
[   1.1410 ] Pre-processing config: tegra264-mb1-bct-device-common-l4t.dts
[   1.1410 ] Bct flags: MEM_BCT 
[   1.1484 ] Pre-processing config: tegra264-mb1-bct-cprod-p3834-xxxx-p4071-0000.dts
[   1.1485 ] Bct flags: MEM_BCT 
[   1.1567 ] Pre-processing config: tegra264-mb1-bct-gpioint-p3834-xxxx-p4071-0000.dts
[   1.1567 ] Bct flags: MEM_BCT 
[   1.1625 ] Pre-processing config: tegra264-mb1-bct-misc-p3834-xxxx-p4071-0000.dts
[   1.1625 ] Bct flags: MEM_BCT 
[   1.1734 ] Pre-processing config: tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000.dts
[   1.1735 ] Bct flags: MEM_BCT 
Error: Return value 1
Command dtc -I dts -O dtb -o tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000_cpp.dtb tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000_cpp.dts
[   1.1823 ] tegrarcm_v2 --chip 0x26 0 --ismb2applet
[   1.1825 ] File rcm_state open failed
[   1.1827 ] ERROR: failed to read rcm_state

Hi,whitesscott

[   0.0307 ] Reading fuses
[   0.0307 ] --no_flash option specified. Skip checkinging on applet status
[   0.0310 ] tegrasign_v3.py --key None --getmode mode.txt
[   0.0311 ] Assuming zero filled SBK key
[   0.0310 ] Parsing partition layout
[   0.0316 ] tegraparser_v2 --pt readinfo_t264_min_prod.xml.tmp
[   0.0322 ] Pre-processing config: tegra264-br-bct-diag-boot.dts
[   0.0323 ] Bct flags: MEM_BCT 
[   0.0380 ] Pre-processing config: tegra264-p3834-0008-sdram-bct-l4t.dts
[   0.0381 ] Bct flags: MEM_BCT 
[   1.0388 ] Generating br-bct
[   1.0394 ] Updating dev and MSS params in BR BCT
[   1.0395 ] tegrabct_v2 --dev_param tegra264-br-bct-diag-boot_cpp.dtb --sdram tegra264-p3834-0008-sdram-bct-l4t_cpp.dtb --brbct br_bct.cfg --chip 0x26 0
[   1.0399 ] Field: SecureDebugControlEcid value: 0x0
[   1.0402 ] Field: SecureDebugControlNoneEcid value: 0x0
[   1.0402 ] Field: preprod_dev_sign value: 0x0
[   1.0403 ] File br_bct.cfg saved.
[   1.2176 ] Generating mb1-bct
[   1.2176 ] Pre-processing config: tegra264-mb1-bct-device-common-l4t.dts
[   1.2176 ] Bct flags: MEM_BCT 
[   1.2254 ] Pre-processing config: tegra264-mb1-bct-cprod-p3834-xxxx-p4071-0000.dts
[   1.2254 ] Bct flags: MEM_BCT 
[   1.2321 ] Pre-processing config: tegra264-mb1-bct-gpioint-p3834-xxxx-p4071-0000.dts
[   1.2322 ] Bct flags: MEM_BCT 
[   1.2388 ] Pre-processing config: tegra264-mb1-bct-misc-p3834-xxxx-p4071-0000.dts
[   1.2388 ] Bct flags: MEM_BCT 
[   1.2508 ] Pre-processing config: tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000.dts
[   1.2508 ] Bct flags: MEM_BCT 
[   1.2622 ] Pre-processing config: tegra264-mb1-bct-pmic-p3834-0008-p4071-0000.dts
[   1.2622 ] Bct flags: MEM_BCT 
[   1.2689 ] Pre-processing config: tegra264-mb1-bct-prod-p3834-xxxx-p4071-0000.dts
[   1.2689 ] Bct flags: MEM_BCT 
[   1.2746 ] Pre-processing config: tegra264-p3834-0008-sdram-bct-warmboot-l4t.dts
[   1.2746 ] Bct flags: MEM_BCT 
[   2.2486 ] Pre-processing config: tegra264-mb1-bct-padvoltage-p3834-xxxx-p4071-0000.dts
[   2.2487 ] Bct flags: MEM_BCT 
[   2.2559 ] tegrabct_v2 --chip 0x26 0 --mb1bct mb1_bct.cfg --misc tegra264-mb1-bct-misc-p3834-xxxx-p4071-0000_cpp.dtb --wb0sdram tegra264-p3834-0008-sdram-bct-warmboot-l4t_cpp.dtb --pinmux tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000_cpp.dtb --pmc tegra264-mb1-bct-padvoltage-p3834-xxxx-p4071-0000_cpp.dtb --pmic tegra264-mb1-bct-pmic-p3834-0008-p4071-0000_cpp.dtb --prod tegra264-mb1-bct-prod-p3834-xxxx-p4071-0000_cpp.dtb --gpioint tegra264-mb1-bct-gpioint-p3834-xxxx-p4071-0000_cpp.dtb --device tegra264-mb1-bct-device-common-l4t_cpp.dtb --deviceprod tegra264-mb1-bct-cprod-p3834-xxxx-p4071-0000_cpp.dtb
[   2.2563 ] MB1-BCT version: 0.2
[   2.2565 ] /mb1_bct/fmon/fsi_threshold_low: 3756
[   2.2565 ] /mb1_bct/fmon/fsi_threshold_high: 4244
[   2.2566 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@0/: [0].sku_info 0
[   2.2568 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@0/: [0].vmin_threshold 15
[   2.2570 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@0/: [0].vmax_threshold 114
[   2.2571 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@1/: [1].sku_info 163
[   2.2573 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@1/: [1].vmin_threshold 21
[   2.2574 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@1/: [1].vmax_threshold 114
[   2.2576 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@2/: [2].sku_info 160
[   2.2578 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@2/: [2].vmin_threshold 21
[   2.2579 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@2/: [2].vmax_threshold 114
[   2.2580 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@3/: [3].sku_info 224
[   2.2581 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@3/: [3].vmin_threshold 13
[   2.2582 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@3/: [3].vmax_threshold 117
[   2.2583 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@4/: [4].sku_info 226
[   2.2584 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@4/: [4].vmin_threshold 21
[   2.2584 ] /mb1_bct/vmon/vdd_soc/soc_vmon_config@4/: [4].vmax_threshold 114

I also couldn’t find the tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000_cpp.dts, but I think you’re right. I checked the normal flashing log, and this part of the log is different.

Look at your input dts/dtsi and search for literal #include:

grep -R --line-number '^\s*#\s*include' bootloader/ | head -50

found the file that is supposed to create the *_cpp.dts" file.

bootloader/tegraflash_impl_t264.pympl_t264.py
    def run_cpp_tool(self, input_file, bct_flags = []):
        """ Run cpp tool on input DTS file and produce preprocessed DTS file
        """

        file_name, _ = os.path.splitext(input_file)
        out_file = file_name + "_cpp.dts"
        # run cpp tool to process any c header includes in DTS
        # do NOT use self.exec_file
        command = ["cpp"]
        command.extend(["-nostdinc"])
        command.extend(["-x", "assembler-with-cpp"])
        command.extend(["-D", "IN_DTS_CONTEXT"])

        # Print bct_flags
        info_print("Bct flags: %s " % (", ".join(bct_flags)))

        # Process additional bct flags
        for bct_flag in bct_flags:
            command.extend(["-D", bct_flag])

        command.extend([input_file])
        command.extend([out_file])
        run_command(command, False)

        return out_file
1 Like