Custom partitions do not take effect

Hi All:
I want to add a custom partition and set it to ext4 by default. I did the following, but why is there no new partition?
version:

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

device info:

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 953.9G  0 disk
├─nvme0n1p1  259:1    0 952.4G  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

device:
orin NX

Modify the file:

Linux_for_Tegra/tools/kernel_flash/flash_l4t_nvme_rootfs_ab.xml
flash_l4t_nvme_rootfs_ab.xml.txt (11.6 KB)

Flash command:
sudo ROOTFS_AB=1 ./flash.sh jetson-orin-nano-devkit-nvme internal

I refer to the following method:

Hi wxsrite,

Are you using the devkit or custom board for Orin NX?

It is not an expected flash command since you are modifying the partition layout for NVMe SSD but you specified internal.
Please use initrd flash script to flash external NVMe SSD instead.

Hi KevinFFF:
I added the following:
flash_l4t_external.xml

        <partition name="my_new_partition" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 419430400 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Optional.** Reserved for app. </description>
        </partition>

flash_l4t_external.txt (10.2 KB)

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external.xml -p “-c bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg” --network usb0 jetson-orin-nano-devkit external

......
[   0.0419 ] ERROR: Partition 'my_new_partition', 'A_kernel' have the same GPT ID: 2
Error: Return value 11
Command tegraparser_v2 --pt flash.xml.tmp
Error: /home/w/wifi-up/L4T-public-source/out/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/w/wifi-up/L4T-public-source/out/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up...

log.txt (129.2 KB)

Please help me see why?

Could you try to modify the following line to check if it could help?

-        <partition name="my_new_partition" type="data">
+        <partition name="my_new_partition" id="3" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 419430400 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Optional.** Reserved for app. </description>
        </partition>

Hi KevinFFF:

If you do the above, you will still get an error.

w@w:~/wifi-up/L4T-public-source/out/Linux_for_Tegra$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external-new.xml -p “-c bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg” --network usb0 jetson-orin-nano-devkit external
......
[   0.0337 ] tegrasign_v3.py --key None --getmode mode.txt
[   0.0338 ] Assuming zero filled SBK key
[   0.0337 ] Parsing partition layout
[   0.0349 ] tegraparser_v2 --pt flash.xml.tmp
[   0.0355 ] ERROR: Partition 'my_new_partition', 'A_kernel-dtb' have the same GPT ID: 3
Error: Return value 11
Command tegraparser_v2 --pt flash.xml.tmp
Error: /home/w/wifi-up/L4T-public-source/out/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/w/wifi-up/L4T-public-source/out/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up...

log.txt (137.2 KB)
flash_l4t_external-new.xml.txt (10.2 KB)

Could you try to remove --no-systemimg in your command and verify?

Or use flash_l4t_t234_nvme.xml instead of flash_l4t_external.xml.

Hi, KevinFFF:
flash_l4t_external-new.xml.txt (10.2 KB)

Using the above file, the following error is reported

error.txt (289.2 KB)
uart_log.txt (158.7 KB)

copying cfgfile(/home/w/wifi-up/L4T-public-source/out/Linux_for_Tegra/tools/kernel_flash/flash_l4t_external-new.xml) to flash.xml... done.

I’ve noticed that you are using Orin NX(T234) so that please use flash_l4t_t234_nvme.xml instead of flash_l4t_external.xml.
You can add your custom partition in flash_l4t_t234_nvme.xml.

Hi KevinFFF:
Thank you so much.

Use the following command to verify that it is indeed possible.

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

The verification results are as follows:
flash_l4t_t234_nvme.xml.txt (8.8 KB)
flash-ok-uart.txt (553.5 KB)
flash-ok.txt (1.9 MB)

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 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  ---This is a new partition
├─nvme0n1p15 259:15   0   400M  0 part
└─nvme0n1p16 259:16   0 479.5M  0 part
root@tegra:/home/robot# sudo parted -l
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
 3      134MB   135MB   786kB                A_kernel-dtb        msftdata
 4      135MB   168MB   33.2MB               A_reserved_on_user  msftdata
 5      168MB   302MB   134MB                B_kernel            msftdata
 6      302MB   303MB   786kB                B_kernel-dtb        msftdata
 7      303MB   336MB   33.2MB               B_reserved_on_user  msftdata
 8      336MB   420MB   83.9MB               recovery            msftdata
 9      420MB   421MB   524kB                recovery-dtb        msftdata
10      421MB   488MB   67.1MB  fat32        esp                 boot, esp
11      488MB   572MB   83.9MB               recovery_alt        msftdata
12      572MB   572MB   524kB                recovery-dtb_alt    msftdata
13      572MB   639MB   67.1MB               esp_alt             msftdata
14      639MB   1059MB  419MB                USR                 msftdata  ---This is a new partition
15      1059MB  1478MB  419MB                UDA                 msftdata
16      1478MB  1981MB  503MB                reserved            msftdata
 1      1981MB  1024GB  1022GB  ext4         APP                 msftdata

Another question is how to make the file system of the newly added partition ext4.

I would like to ask, why can’t I use the following file?

flash_l4t_external.xml

Can I add a custom partition by flashing the machine using the following command?
sudo ./flash.sh jetson-orin-nano-devkit-nvme internal

Okay, it seems you’ve added custom partition successfully.

You may need to customize it for your use case.
Please refer to the initrd and flash script to check how it format the partition.
Or you can simply run mkfs.ext4 command to format it as ext4.

You can compare the partition layout between them.
T234 uses flash_l4t_t234_nvme.xml instead.
flash_l4t_external.xml is used for other external devices like USB storage.

Please do not use jetson-orin-nano-devkit-nvme.conf as board config which is used for another module.

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