From ProventusNova DeveloperWiki

How to Add a Custom Partition Layout to NVIDIA Jetson Platforms

Keywords: NVMe, partition, flash, custom layout, JetPack

Description

This wiki pages shows how to add a memory partition on NVIDIA'S Jetson Platforms. This procedure was tested on a NVIDIA Jetson Orin NX with CTI Boson carrier board running JetPack 6.2.1(L4T R36.4.4) and demonstrates how to add an additional 2GiB partition on NVMe storage.

Understanding the Flashing Process and Partition Layout

  • When flashing a Jetson platform that uses NVMe storage as the root device, the following command is typically used:
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external.xml -p '-c bootloader/generic/cfg/flash_t234_qspi.xml' --showlogs --network usb0 <board-config> internal

The flash_l4t_external.xml file is the Jetson Linux (L4T) partition configuration file. It defines how partitions are laid out on the target storage device — in this case, the NVMe drive.

  • After flashing the board you can check the partition layout by running lsusb. The output should look similar to this:
nvidia@nvidia:~$ lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,PARTLABEL
NAME           SIZE TYPE MOUNTPOINT PARTLABEL
loop0           16M loop            
zram0          1.9G disk [SWAP]     
zram1          1.9G disk [SWAP]     
zram2          1.9G disk [SWAP]     
zram3          1.9G disk [SWAP]     
nvme0n1      119.2G disk            
├─nvme0n1p1  117.8G part /          APP
├─nvme0n1p2    128M part            A_kernel
├─nvme0n1p3    768K part            A_kernel-dtb
├─nvme0n1p4   31.6M part            A_reserved_on_user
├─nvme0n1p5    128M part            B_kernel
├─nvme0n1p6    768K part            B_kernel-dtb
├─nvme0n1p7   31.6M part            B_reserved_on_user
├─nvme0n1p8     80M part            recovery
├─nvme0n1p9    512K part            recovery-dtb
├─nvme0n1p10    64M part /boot/efi  esp
├─nvme0n1p11    80M part            recovery_alt
├─nvme0n1p12   512K part            recovery-dtb_alt
├─nvme0n1p13    64M part            esp_alt
├─nvme0n1p14   400M part            UDA
└─nvme0n1p15 479.5M part            reserved
  • To add a new partition we need to modify the partition layout in this flash_l4t_external.xml file.
  • Important: Notice NVMe size of 119.2G.

Creating a custom partition layout

In this section you will find the steps for adding an extra partition called EXTRA_DATA with size 20 GiB to the partition layout file for flashing.

1. Create a copy of the original file in case we need the default partition configuration. Let's call it: flash_l4t_external_copy.xml

2. Add the following section code before the APP partition to create a new partition block called EXTRA_DATA.

<partition name="EXTRA_DATA" type="data">
    <allocation_policy> sequential </allocation_policy>
    <filesystem_type> basic </filesystem_type>
    <size> <EXTRA_DATA_SIZE> </size>
    <file_system_attribute> 0 </file_system_attribute>
    <allocation_attribute> 0x8 </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>

3. Define how much size will be assigned to the new partition. To calculate the size in bytes use the next formula:

SIZE (GiB) * 1024^3 = Size (BYTES)

For 20 GiB:

20 (GiB) * 1024^3 = 21474836480 bytes

Change EXTRA_DATA_SIZE for 21474836480.

4. Recalculate APP size to adjust for the extra partition added:

(119.8 GiB - 20 GiB ) * 1024^3 = 105011950387 bytes

5. Change APP size for 105011950387.

6. With this changes the file should look like this:

<partition name="EXTRA_DATA" type="data">
    <allocation_policy> sequential </allocation_policy>
    <filesystem_type> basic </filesystem_type>
    <size> 21474836480 </size>
    <file_system_attribute> 0 </file_system_attribute>
    <allocation_attribute> 0x8 </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="APP" id="1" type="data">
    <allocation_policy> sequential </allocation_policy>
    <filesystem_type> basic </filesystem_type>
    <size> 105011950387 </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>

Flashing with new partition layout

1. To flash, use the new XML file created:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external_copy.xml -p '-c bootloader/generic/cfg/flash_t234_qspi.xml' --showlogs --network usb0 <board-config> internal

2. Wait for board to flash and boot.

3. Run lsusb command. The output should look like this:

nvidia@nvidia:~$ lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,PARTLABEL
NAME           SIZE TYPE MOUNTPOINT PARTLABEL
loop0           16M loop            
zram0          1.9G disk [SWAP]     
zram1          1.9G disk [SWAP]     
zram2          1.9G disk [SWAP]     
zram3          1.9G disk [SWAP]     
nvme0n1      119.2G disk            
├─nvme0n1p1   97.8G part /          APP
├─nvme0n1p2    128M part            A_kernel
├─nvme0n1p3    768K part            A_kernel-dtb
├─nvme0n1p4   31.6M part            A_reserved_on_user
├─nvme0n1p5    128M part            B_kernel
├─nvme0n1p6    768K part            B_kernel-dtb
├─nvme0n1p7   31.6M part            B_reserved_on_user
├─nvme0n1p8     80M part            recovery
├─nvme0n1p9    512K part            recovery-dtb
├─nvme0n1p10    64M part /boot/efi  esp
├─nvme0n1p11    80M part            recovery_alt
├─nvme0n1p12   512K part            recovery-dtb_alt
├─nvme0n1p13    64M part            esp_alt
├─nvme0n1p14   400M part            UDA
├─nvme0n1p15 479.5M part            reserved
└─nvme0n1p16    20G part            EXTRA_DATA

You should see EXTRA_DATA partition with size 20G. For APP, the size is now 97.8G.

Need Further Support?

📞 Book Consultation Call: Show Calendar!

📩 Contact Via Email: support@proventusnova.com

🌐 Visit Our Website: ProventusNova.com