How to add a larger custom partition?

Hi All:
How to add a larger custom partition? thanks.

w@w:~/master/L4T-public-source/out/Linux_for_Tegra $ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_t234_nvme.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml"  --showlogs --network usb0 jetson-orin-nano-devkit external

robot@tegra:/sys/class/net/eth0$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 16M 1 loop
zram0 251:0 0 970M 0 disk [SWAP]
zram1 251:1 0 970M 0 disk [SWAP]
zram2 251:2 0 970M 0 disk [SWAP]
zram3 251:3 0 970M 0 disk [SWAP]
zram4 251:4 0 970M 0 disk [SWAP]
zram5 251:5 0 970M 0 disk [SWAP]
zram6 251:6 0 970M 0 disk [SWAP]
zram7 251:7 0 970M 0 disk [SWAP]
nvme0n1 259:0 0 953.9G 0 disk
├─nvme0n1p1 259:1 0 952G 0 part /
├─nvme0n1p2 259:2 0 128M 0 part
├─nvme0n1p3 259:3 0 768K 0 part
├─nvme0n1p4 259:4 0 31.6M 0 part
├─nvme0n1p5 259:5 0 128M 0 part
├─nvme0n1p6 259:6 0 768K 0 part
├─nvme0n1p7 259:7 0 31.6M 0 part
├─nvme0n1p8 259:8 0 80M 0 part
├─nvme0n1p9 259:9 0 512K 0 part
├─nvme0n1p10 259:10 0 64M 0 part
├─nvme0n1p11 259:11 0 80M 0 part
├─nvme0n1p12 259:12 0 512K 0 part
├─nvme0n1p13 259:13 0 64M 0 part
├─nvme0n1p14 259:14 0 400M 0 part
├─nvme0n1p15 259:15 0 479.5M 0 part
└─nvme0n1p16 259:16 0 400M 0 part ------new partition

I have a 1TB hard drive and I want to reserve 64GB for the file system(part /) and allocate the rest to custom partitions(nvme0n1p16). How can I do this?

file:
1、400M is ok:
flash_l4t_t234_nvme.xml.txt (9.2 KB)

2、failed.
flash_l4t_t234_nvme-v1.xml.txt (9.2 KB)
When I set it up in this way, an error occurred during flashing, as follows:

[   6.2430 ] Using ramcode 0
[   6.2430 ] Disabled BPMP dtb trim, using default dtb
[   6.2430 ]
[   6.2449 ] tegrahost_v2 --chip 0x23 0 --align mem_rcm_aligned.bct
[   6.2468 ] tegrahost_v2 --chip 0x23 0 --magicid MEM0 --ratchet_blob ratchet_blob.bin --appendsigheader mem_rcm_aligned.bct zerosbk
[   6.2477 ] adding BCH for mem_rcm_aligned.bct
[   6.2519 ] tegrasign_v3.py --key None --list mem_rcm_aligned_sigheader.bct_list.xml --pubkeyhash pub_key.key --sha sha512
[   6.2521 ] Assuming zero filled SBK key
[   6.2541 ] Warning: pub_key.key is not found
[   6.2533 ] tegrahost_v2 --chip 0x23 0 --updatesigheader mem_rcm_aligned_sigheader.bct.encrypt mem_rcm_aligned_sigheader.bct.hash zerosbk
[   6.2551 ] Copying signatures
[   6.2561 ] tegrahost_v2 --chip 0x23 0 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[   6.2583 ] tegraparser_v2 --generategpt --pt flash.xml.bin
[   6.2591 ] End sector for APP, expected at: 122159070, actual: 0
Error: Return value 4
Command tegraparser_v2 --generategpt --pt flash.xml.bin
Error: /home/w/master/L4T-public-source/out/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/w/master/L4T-public-source/out/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up...

log.txt (153.4 KB)

Hi wxsrite,

Are you using the devkit or custom board for Orin NX?
What’s the Jetpack version in use?

        <partition name="USR" type="data">

It seems you’ve added above USR partition in layout file.
Please try adding this partition under APP partition.

Hi KevinFFF:
The problem still exists, please help, thank you!

flash cmd:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_t234_nvme-v.xmltools/kernel_flash/flash_l4t_t234_nvme-v.xml -p “-c bootloader/t186ref/cfg/flash_t234_qspi.xml” --showlogs --network usb0 jetson-orin-nano-devkit external

copying tbcdtbfile(/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/tegra234-p3767-0000-p3768-0000-a0.dtb)... done.
copying cfgfile(/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/tools/kernel_flash/flash_l4t_t234_nvme-v.xml) to flash.xml... done.
Existing flashapp(/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/bootloader/tegraflash.py) reused.
copying overlay_dtb(/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/L4TConfiguration.dtbo)... done.
copying overlay_dtb(/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/tegra234-p3767-overlay.dtbo)... done.
copying overlay_dtb(/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/tegra234-p3768-overlay.dtbo)... done.
/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/bootloader/L4TConfiguration_updated.dts: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
/home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/bootloader/L4TConfiguration.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
./tegraflash.py  --bl uefi_jetson_with_dtb.bin  --odmdata gbe-uphy-config-8,hsstp-lane-map-3,hsio-uphy-config-0  --overlay_dtb L4TConfiguration.dtbo,tegra234-p3767-overlay.dtbo,tegra234-p3768-overlay.dtbo,  --bldtb tegra234-p3767-0000-p3768-0000-a0.dtb --applet mb1_t234_prod.bin --cmd "sign"  --cfg flash.xml --chip 0x23 --concat_cpubl_bldtb --cpubl uefi_jetson.bin --minratchet_config tegra234-mb1-bct-ratchet-p3767-0000.dts --device_config tegra234-mb1-bct-device-p3767-0000.dts --misc_config tegra234-mb1-bct-misc-p3767-0000.dts --pinmux_config tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi --gpioint_config tegra234-mb1-bct-gpioint-p3767-0000.dts --pmic_config tegra234-mb1-bct-pmic-p3767-0000-a02.dts --pmc_config tegra234-mb1-bct-padvoltage-p3767-dp-a03.dtsi --deviceprod_config tegra234-mb1-bct-cprod-p3767-0000.dts --prod_config tegra234-mb1-bct-prod-p3767-0000.dts --scr_config tegra234-mb2-bct-scr-p3767-0000.dts --wb0sdram_config tegra234-p3767-0000-wb0sdram-l4t.dts --br_cmd_config tegra234-mb1-bct-reset-p3767-0000.dts --uphy tegra234-mb1-bct-uphylane-si.dtsi --dev_params tegra234-br-bct-p3767-0000-l4t.dts,tegra234-br-bct_b-p3767-0000-l4t.dts --mb2bct_cfg tegra234-mb2-bct-misc-p3767-0000.dts  --bins "psc_fw pscfw_t234_prod.bin; mts_mce mce_flash_o10_cr_prod.bin; mb2_applet applet_t234.bin; mb2_bootloader mb2_t234.bin; xusb_fw xusb_t234_prod.bin; dce_fw display-t234-dce.bin; nvdec nvdec_t234_prod.fw; bpmp_fw bpmp_t234-TE980M-A1_prod.bin; bpmp_fw_dtb tegra234-bpmp-3767-0000-a02-3509-a02.dtb; sce_fw camera-rtcpu-sce.img; rce_fw camera-rtcpu-t234-rce.img; ape_fw adsp-fw.bin; spe_fw spe_t234.bin; tos tos-optee_t234.img; eks eks_t234.img"  --sdram_config tegra234-p3767-0000-sdram-l4t.dts --external_device  --boot_chain A
saving flash command in /home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/bootloader/flashcmd.txt
saving Windows flash command to /home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/bootloader/flash_win.bat
*** Sign and generate flashing ready partition images... ***
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.0293 ] tegrasign_v3.py --key None --getmode mode.txt
[   0.0294 ] Assuming zero filled SBK key
[   0.0270 ] Parsing partition layout
[   0.0292 ] tegraparser_v2 --pt flash.xml.tmp
[   0.0299 ] ERROR: Partition 'USR', 'A_kernel' have the same GPT ID: 2
Error: Return value 11
Command tegraparser_v2 --pt flash.xml.tmp
Error: /home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/w/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up...
w@w:~/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra (add_v1.0.8)$ 

log.txt (103.1 KB)

xml file:

w@w:~/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra (add_v1.0.8)$ more tools/kernel_flash/flash_l4t_t234_nvme-v.xml
<partition_layout version="01.00.0000">
    <device type="external" instance="0" sector_size="512" num_sectors="NUM_SECTORS" >
        <partition name="master_boot_record" type="protective_master_boot_record">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 512 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
        </partition>
        <partition name="primary_gpt" type="primary_gpt">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 19968 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
        </partition>
        <partition name="A_kernel" id="2" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 134217728 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> LNXFILE </filename>
        </partition>
        <partition name="A_kernel-dtb" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 786432 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> DTB_FILE </filename>
        </partition>
        <partition name="A_reserved_on_user" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 33161216 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
        </partition>
        <partition name="B_kernel" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 134217728 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> LNXFILE </filename>
        </partition>
        <partition name="B_kernel-dtb" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 786432 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> DTB_FILE </filename>
        </partition>
        <partition name="B_reserved_on_user" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 33161216 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
        </partition>
        <partition name="RECNAME" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> RECSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> RECFILE </filename>
        </partition>
        <partition name="RECDTB-NAME" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 524288 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> RECDTB-FILE </filename>
        </partition>
        <partition name="esp" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 67108864 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> ESP_FILE </filename>
            <partition_type_guid> C12A7328-F81F-11D2-BA4B-00A0C93EC93B </partition_type_guid>
            <description> **Required.** EFI system partition with L4T Launcher. </description>
        </partition>
        <partition name="RECNAME_alt" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> RECSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
        </partition>
        <partition name="RECDTB-NAME_alt" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 524288 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
        </partition>
        <partition name="esp_alt" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 67108864 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** EFI system partition for fail-safe ESP update. </description>
        </partition>
        <partition name="UDA" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 419430400 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <align_boundary> 16384 </align_boundary>
            <description> **Required.** This partition may be mounted and used to store user
              data. </description>
        </partition>
        <partition name="reserved" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 502792192 </size> <!-- Recalculate the size if RECSIZE changed -->
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** Reserve space in case there is any partition change
              required in the future, for example, adding new partitions or increasing size
              of some partitions. </description>
        </partition>
        <partition name="APP" id="1" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 68719476736 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <align_boundary> 16384 </align_boundary>
            <percent_reserved> 0 </percent_reserved>
            <unique_guid> APPUUID </unique_guid>
            <filename> APPFILE </filename>
            <description> **Required.** Contains the rootfs. This partition must be assigned
              the "1" for id as it is physically put to the end of the device, so that it
              can be accessed as the fixed known special device `/dev/nvme0n1p1`. </description>
        </partition>
        <partition name="USR" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> APPSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x808 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> Reserved for user app. </description>
        </partition>
        <partition name="secondary_gpt" type="secondary_gpt">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 0xFFFFFFFFFFFFFFFF </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
        </partition>
    </device>
</partition_layout>
w@w:~/rs2sdk-f/L4T-public-source/out/Linux_for_Tegra (add_v1.0.8)$

It seems the the -c option in flash command wrong here.

For this error, please specify id="19" for your custom partition.
I suggest 19 since there’re 18 paritions by default.

Please share the full flash log as file here and let us know the following info.

  1. the APPSIZE you used for USR partition
  2. what’s the NUM_SECTORS in your case? It seems you didn’t specify it in your command.

Hi KevinFFF:

flash:

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_t234_nvme-v.xml -p “-c bootloader/t186ref/cfg/flash_t234_qspi.xml” --showlogs --network usb0 jetson-orin-nano-devkit external

nvme has 1T space, of which 950 GB = 512x1987580800(NUM_SECTORS )
APP 68719476736 = 64G

After the device was flashed, it did not restart automatically.
After the power outage, the equipment cannot be started.
device-start-failed.txt (163.6 KB)

Please help me find the reason, thank you!

The flashing process has the following errors:

Waiting for target to boot-up...
Waiting for device to expose ssh ......RTNETLINK answers: File exists
RTNETLINK answers: File exists
Waiting for device to expose ssh ...Run command: flash on fc00:1:1:0::2
SSH ready
blockdev: cannot open /dev/mmcblk0boot0: No such file or directory
[ 0]: l4t_flash_from_kernel: Starting to create gpt for emmc
Active index file is /mnt/internal/flash.idx
Number of lines is 58
max_index=57
[ 1]: l4t_flash_from_kernel: Successfully create gpt for emmc
[ 1]: l4t_flash_from_kernel: Starting to create gpt for external device
Active index file is /mnt/external/flash.idx
Number of lines is 19
max_index=18
writing item=1, 9:0:primary_gpt, 512, 19968, gpt_primary_9_0.bin, 16896, fixed-<reserved>-0, 5cacf3d46046b19e8cdb0d71925d2d8427b12cc2
Writing primary_gpt partition with gpt_primary_9_0.bin
Offset is not aligned to K Bytes, no optimization is applied
dd if=/mnt/external/gpt_primary_9_0.bin of=/dev/nvme0n1 bs=1 skip=0  seek=512 count=16896
16896+0 records in
16896+0 records out
16896 bytes (17 kB, 16 KiB) copied, 0.0180409 s, 937 kB/s
Writing primary_gpt partition done
Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Warning: Not all of the space available to /dev/nvme0n1 appears to be used, you can fix the GPT to use all of the space (an extra 12828463 blocks) or continue with the current setting?
Writing secondary_gpt partition with gpt_secondary_9_0.bin
Offset is not aligned to K Bytes, no optimization is applied
dd if=/mnt/external/gpt_secondary_9_0.bin of=/dev/nvme0n1 bs=1 skip=0  seek=1017641352704 count=16896
16896+0 records in
16896+0 records out
16896 bytes (17 kB, 16 KiB) copied, 0.0195843 s, 863 kB/s
Writing secondary_gpt partition done
Error: The backup GPT table is not at the end of the disk, as it should be.  Fix, by moving the backup to the end (and removing the old backup)?
Fix/Ignore? Fix
Fix/Ignore? Not all of the space available to /dev/nvme0n1 appears to be used, you can fix the GPT to use all of the space (an extra 12828463 blocks) or continue with the current setting?
Fix
Model: KINGSTON OM8SEP41024Q-A01 (nvme)
Disk /dev/nvme0n1: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name                Flags
 2      20.5kB  134MB   134MB                A_kernel            msftdata
......

flash_l4t_t234_nvme-v2.xml.txt (9.3 KB)

log:
flash_1-5.2_0_20241115-180417.log (40.7 KB)
serial-log.txt (958.9 KB)
flash-log.txt (289.7 KB)

It seems you booting into recovery kernel due to kernel panic.

Why I calculate it as 1992294400 sectors for 950GiB?

Please try using the following XML instead.
flash_l4t_t234_nvme-v2.xml.txt (9.3 KB)

and the following command to flash.

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_t234_nvme-usr.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" --showlogs --network usb0 jetson-orin-nano-devkit internal

Hi KevinFFF:

sudo ./flash.sh jetson-orin-nano-devkit-nvme internal

I have a way to use the following command to perform the flash operation. Which files need to be modified?
In order to reduce the total size of the flash file, I deleted the rootfs. When packaging, this was not packaged.

Please check the flash log to know which partition layout XML is in use.

Do you mean that you remove whole APP partition?
I’m not clear about what you customize, but above command and the layout have been verified on my setup.
Please just refer to it and customize for your use case.

Do you mean that it can work sometimes but it can not work sometimes?
If so, have you compared both pass and fail log?

I’ve also checked your serial console log.

Eeprom data validation failed(Device Error)
TegraI2cStartRequest: No ACK received
Failed to read eeprom (No Response)

Do you have EEPROM on the custom carrier board?

And I notice that you are using debug UEFI binary?

Hi KevinFFF:

Sorry, I deleted the question just now. I will add it. In addition, I know the reason. It is because: the sizes of the two 1T hard drives are different.

There is no problem below,Its disk size is 953G.

There is a problem below,Its disk size is 931G

log(1000G):
serial-error.txt (166.7 KB)
log-error.txt (258.9 KB)
flash_l4t_t234_nvme.xml.txt (9.3 KB)

So how can I dynamically implement my function based on the disk size?

How should the following file be modified?
flash_l4t_t234_nvme.xml

How did you calculate the following?
Why I calculate it as 1992294400 sectors for 950GiB ?

Yes, I use 950GiB since you said it has 953.9GB in original post.
You can just configure it as following:

-    <device type="external" instance="0" sector_size="512" num_sectors="1992294400" >
+    <device type="external" instance="0" sector_size="512" num_sectors="EXT_NUM_SECTORS" >

And specify the sectors number in the flash command with -T parameter like the following:

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --showlogs --external-device nvme0n1p1 -p "-T 1992294400" -c ./tools/kernel_flash/flash_l4t_t234_nvme.xml --external-only --append --network usb0 jetson-orin-nano-devkit external

In this way, you can specify the correct sector number in flash command based on the NVMe SSD you are using.

Hi,Kevin FFF:
This is a flash error.

w@w:~/master/L4T-public-source/output_5.1.4/Linux_for_Tegra (5.1.4)$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --showlogs --external-device nvme0n1p1 -p "-T 1992294400" -c ./tools/kernel_flash/flash_l4t_t234_nvme.xml --external-only --append --network usb0 jetson-orin-nano-devkit external > ~/1.txt 2>&1

1.txt (44.4 KB)

[   6.6383 ] tegrahost_v2 --chip 0x23 0 --align mem_rcm_aligned.bct
[   6.6399 ] tegrahost_v2 --chip 0x23 0 --magicid MEM0 --ratchet_blob ratchet_blob.bin --appendsigheader mem_rcm_aligned.bct zerosbk
[   6.6410 ] adding BCH for mem_rcm_aligned.bct
[   6.6452 ] tegrasign_v3.py --key None --list mem_rcm_aligned_sigheader.bct_list.xml --pubkeyhash pub_key.key --sha sha512
[   6.6453 ] Assuming zero filled SBK key
[   6.6473 ] Warning: pub_key.key is not found
[   6.6462 ] tegrahost_v2 --chip 0x23 0 --updatesigheader mem_rcm_aligned_sigheader.bct.encrypt mem_rcm_aligned_sigheader.bct.hash zerosbk
[   6.6477 ] Copying signatures
[   6.6486 ] tegrahost_v2 --chip 0x23 0 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[   6.6504 ] tegraparser_v2 --generategpt --pt flash.xml.bin
[   6.6512 ] Number of sctors is zero for external: 0 device
Error: Return value 4
Command tegraparser_v2 --generategpt --pt flash.xml.bin
Error: /home/w/master/L4T-public-source/output_5.1.4/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/w/master/L4T-public-source/output_5.1.4/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up...

[   6.6512 ] Number of sctors is zero for external: 0 device

You can remove -p "-T 1992294400" in the flash command.
And specify num_sectors="1992294400 " in flash_l4t_t234_nvme.xml instead.

I have multiple disks of different sizes, and I need to dynamically change the number of blocks. Otherwise, I can’t use a configuration file to flash the hard disk.

Please just calculate the number sectors for your disk manually and you can specify them with -T parameter in the flash command since we don’t know the size of each NVMe SSD you have.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.