Adding a large custom partition fails

Hi,
When I changed the custom partition to 900G, the flash failed.Please help me find the reason, thank you!
Add a custom partition
flash_l4t_t234_nvme-v2.xml

        <partition name="USR" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 900 GB </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x808 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <align_boundary> 16384 </align_boundary>
            <description> Reserved for user app. </description>
        </partition>

flash cmd:

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

failed info:

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
[ 2]: l4t_flash_from_kernel: Successfully create gpt for emmc
[ 2]: 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, 8f9c15f324262cca7636df7b7a0bc64fda930ecd
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.0190197 s, 888 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 1878250159 blocks) or continue with the current setting?
Error: Can't have the end before the start! (start sector=122159072 length=-1)
[ 8]: l4t_flash_from_kernel: Error: partprobe failed. This indicates that:
 -   the xml indicates the gpt is larger than the device storage
 -   the xml might be invalid
 -   the device might have a problem.
 Please make correction.
Flash failure
Cleaning up...

log.txt (259.8 KB)

flash_l4t_t234_nvme-v2.xml.txt (9.3 KB)

I don’t think it is a good idea to just give a string “900GB” to your size…

Hi WayneWWW:
Because we only want to reserve 64G for the system, the rest are our own customized partitions. Separating the system and our own content will help us manage our own related files and programs.

How about you start with other smaller size first and also please do not just put something like “900GB”. You should calculate the size.

Hi WayneWWW:
Can I do the reverse, by setting the system partition to 64G and leaving the rest for custom partitions, how do I modify this?

robot@tegra:~$ more /etc/nv_tegra_release
# R35 (release), REVISION: 4.1, GCID: 33958178, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug  1 19:57:35 UTC 2023
robot@tegra:~$ 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 931.5G  0 disk
├─nvme0n1p1  259:1    0 930.1G  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

My previous comment was just trying to say that you cannot just write a “XXX GB” thing in your xml.

We don’t suupport that. You should calculate that XXX GB is equal to how many bytes and write it into xml…

example:

Hi, WayneWWW:
I made the following changes, but it still gives an error. Please help me find the reason. Thank you!

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

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
[ 2]: l4t_flash_from_kernel: Successfully create gpt for emmc
[ 2]: 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, 099348700e302cbe25df245fed482859b0093450
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.018006 s, 938 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 1819307439 blocks) or continue with the current setting?
Error: Can't have the end before the start! (start sector=134217696 length=-1)
[ 9]: l4t_flash_from_kernel: Error: partprobe failed. This indicates that:
 -   the xml indicates the gpt is larger than the device storage
 -   the xml might be invalid
 -   the device might have a problem.
 Please make correction.
Flash failure
Cleaning up...

log_01.txt (259.6 KB)

flash_l4t_t234_nvme-v2.xml.txt (9.3 KB)

device type=“external” instance=“0” sector_size=“512” num_sectors="134217728 "

This line in your xml indicates you only want 64GB for your nvme.

But you also want rootfs = 64GB with that -S parameter. It means other partitions do not have sufficient space.

Please either give larger sector number or give less -S parameter.

Hi, WayneWWW:

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

I changed it to -s 50GiB, but the problem still exists.

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, 9e1ce9b7038e9c236a2831579cd822eb2e878783
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.0176537 s, 957 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 1866191535 blocks) or continue with the current setting?
Error: Can't have the end before the start! (start sector=134217696 length=-1)
[ 8]: l4t_flash_from_kernel: Error: partprobe failed. This indicates that:
 -   the xml indicates the gpt is larger than the device storage
 -   the xml might be invalid
 -   the device might have a problem.
 Please make correction.
Flash failure
Cleaning up...

log_02.txt (256.7 KB)
flash_l4t_t234_nvme-v2.xml.txt (9.3 KB)

Could you put your custom partition after APP partition in the xml?

Hi WayneWWW:

copying tbcdtbfile(/home/w/master/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/tegra234-p3767-0000-p3768-0000-a0.dtb)... done.
copying cfgfile(/home/w/master/L4T-public-source/out/Linux_for_Tegra/tools/kernel_flash/flash_l4t_t234_nvme-v2.xml) to flash.xml... done.
Existing flashapp(/home/w/master/L4T-public-source/out/Linux_for_Tegra/bootloader/tegraflash.py) reused.
copying overlay_dtb(/home/w/master/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/L4TConfiguration.dtbo)... done.
copying overlay_dtb(/home/w/master/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/tegra234-p3767-overlay.dtbo)... done.
copying overlay_dtb(/home/w/master/L4T-public-source/out/Linux_for_Tegra/kernel/dtb/tegra234-p3768-overlay.dtbo)... done.
/home/w/master/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/master/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  --cust_info custinfo_out.bin --external_device  --boot_chain A
saving flash command in /home/w/master/L4T-public-source/out/Linux_for_Tegra/bootloader/flashcmd.txt
saving Windows flash command to /home/w/master/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.0463 ] tegrasign_v3.py --key None --getmode mode.txt
[   0.0465 ] Assuming zero filled SBK key
[   0.0461 ] Parsing partition layout
[   0.0474 ] tegraparser_v2 --pt flash.xml.tmp
[   0.0484 ] 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/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:
log-1.txt (252.7 KB)

xml file:

w@w:~/master/L4T-public-source/out/Linux_for_Tegra (d4xx_addr)$ more  tools/kernel_flash/flash_l4t_t234_nvme-v2.xml                                                          <partition_layout version="01.00.0000">
    <device type="external" instance="0" sector_size="512" num_sectors="134217728 " >
        <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> APPSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x808 </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> 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> 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>

duplicate topic as How to add a larger custom partition?

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