# Support of Orin Nano Devkit Nvme on Jetpack 5.0

**URL:** <https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087>\
**Category:** Board Integrations\
**Tags:** yocto, kirkstone, jetpack-5\
**Created:** [August 8, 2024, 6:22pm UTC](https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087 "2024-08-08T18:22:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paroque28](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/paroque28/32/1487_2.png) [@paroque28](https://hub.mender.io/u/paroque28)\
**Post date:** [August 8, 2024, 6:22pm UTC](https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087/1 "2024-08-08T18:22:47Z")

</div>

Hi,

I’m working on integrating Orin Nano with an NVMe. Initially, I ran:

At first I just ran `kas build meta-mender-community/kas/jetson-orin-nano-devkit.yml`  
and modified the machine to match `jetson-orin-nano-devkit-nvme`

But I got the following error:

```bash
ERROR: Failure expanding variable MENDER_STORAGE_TOTAL_SIZE_MB_DEFAULT:tegra, expression was ${@tegra_mender_calc_total_size(d)} which triggered exception ValueError: invalid literal for int() with base 10: ''
The variable dependency chain for the failure is: MENDER_STORAGE_TOTAL_SIZE_MB_DEFAULT:tegra

```

I don’t have an SD card. I fixed the issue by hardcoding a size for NVMe, and the build succeeded 🙂

What’s the proper fix for this?

Then, when I tried flashing the device, I got this:

```auto
== Step 4: Writing partitions on external storage device at 2024-08-08T20:19:29+02:00 ==
Waiting for USB storage device nvme0n1 from 0353fe09...[/dev/sda]
...
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
No partition definitions found in initrd-flash.xml
ERR: write failure to external storage at 2024-08-08T20:19:31+02:00

```

Any suggestions on what to do next?

Thanks,  
Pablo

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [August 9, 2024, 8:34am UTC](https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087/2 "2024-08-09T08:34:54Z")

</div>

Hi @paroque28,

Thanks for reaching out! My hunch is that some board specific override needs adjusting here, but I don’t have experience on the Nvidia boards unfortunately. Maybe @dwalkes or @zach-welch-aquabyte can give a pointer here?

Side note, I’ll try to add a test build for `jetson-orin-nano-devkit-emmc` so we can note this down for further reference.

Greets,  
Josef

EDIT: what modifications did you add to make the build pass @paroque28? I’ve gotten past the initial hurdles by setting `EMMC_SIZE` as below, but the root filesystem creation still fails.

```auto
EMMC_SIZE = "33554432"

```

---

<div class="post-metadata">

**Author:** ![paroque28](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/paroque28/32/1487_2.png) [@paroque28](https://hub.mender.io/u/paroque28)\
**Post date:** [August 9, 2024, 7:12pm UTC](https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087/3 "2024-08-09T19:12:44Z")

</div>

@TheYoctoJester

This was the right combination for making this build work:

```auto
TEGRAFLASH_NO_INTERNAL_STORAGE = "0"

PARTITION_LAYOUT_TEMPLATE_DEFAULT = "flash_t234_qspi.xml"

PARTITION_LAYOUT_EXTERNAL="flash_l4t_t234_nvme.xml"

# PARTITION_LAYOUT_EXTERNAL = "flash_l4t_nvme_rootfs_ab.xml"

# Mender tegra_mender_calc_total_size workaround

# Setting MENDER_STORAGE_TOTAL_SIZE_MB to 16Gb and no EMMC

EMMC_SIZE = "0"

MENDER_STORAGE_TOTAL_SIZE_MB = "16384"

# Mender Kas variables

UBOOT_EXTLINUX = "1"

USE_REDUNDANT_FLASH_LAYOUT_DEFAULT = "1"

```

You can mark this as solved

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [August 9, 2024, 8:11pm UTC](https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087/4 "2024-08-09T20:11:13Z")

</div>

@paroque28 thanks a lot for sharing! This means the build is working fine now and flashing succeeds?

---

<div class="post-metadata">

**Author:** ![paroque28](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/paroque28/32/1487_2.png) [@paroque28](https://hub.mender.io/u/paroque28)\
**Post date:** [August 10, 2024, 1:11pm UTC](https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087/5 "2024-08-10T13:11:18Z")

</div>

Yes exactly flashing was successful. I still need to test the upgrades.

---

<div class="post-metadata">

**Author:** ![paroque28](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/paroque28/32/1487_2.png) [@paroque28](https://hub.mender.io/u/paroque28)\
**Post date:** [August 27, 2024, 1:12pm UTC](https://hub.mender.io/t/support-of-orin-nano-devkit-nvme-on-jetpack-5-0/7087/6 "2024-08-27T13:12:50Z")

</div>

Also just want to add here that the following changes (tegra\_bootfiles) were also needed to make the data partition work:

```auto
do_install:append() {
    if [-f ${SH_CUSTOM_CONFIG_FRAGMENT}]; then 
        cat ${SH_CUSTOM_CONFIG_FRAGMENT} >> ${D}${datadir}/tegraflash/tegra19x-mb1-pinmux-p3668-a01.cfg
    fi
    cp ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL} ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL}.bak

    # 1. Remove the <partition name="reserved"> block (optional)
    sed -i '/<partition name="reserved"/,/<\/partition>/d' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL}

    # 2. Extract the <partition name="UDA"> block and modify <allocation_attribute>
    sed -n '/<partition name="UDA"/,/<\/partition>/p' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL} > uda_block.xml
    sed -i '/<partition name="UDA"/,/<\/partition>/d' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL}
    sed -i 's/<allocation_attribute> 8/<allocation_attribute> 0x808/' uda_block.xml
   
    # 3. Remove the id attribute from the <partition name="A_kernel"> block
    sed -i '/<partition name="A_kernel"/,/<\/partition>/s/id="[0-9]*"//g' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL}

    # 4. Extract the <partition name="APP"> block and modify <allocation_attribute>
    sed -n '/<partition name="APP"/,/<\/partition>/p' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL} > app_block.xml
    sed -i '/<partition name="APP"/,/<\/partition>/d' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL}
    sed -i 's/0x808/0x8/' app_block.xml

    # 5. Clone <partition name="APP"> block to create <partition name="APP_b"> and append it to app_block.xml
    sed -e 's/name="APP"/name="APP_b"/g' \
    -e 's/id="1"/id="2"/g' \
    -e 's/APPUUID/APPUUID_b/g' \
    -e 's/APPFILE/APPFILE_b/g' \
    -e 's|id as it is physically put to the end of the device, so that it|id as it is defined after `primary_GPT` so that it|' \
    -e 's/nvme0n1p1/nvme0n1p2/' \
    app_block.xml > app_b_block.xml
    cat app_b_block.xml >> app_block.xml

    # 6. Reinsert the modified APP and APP_b blocks before the <partition name="A_kernel"> block
    awk -i inplace -v INPLACE_SUFFIX=.bak '/<partition name="A_kernel"/{system("cat app_block.xml");}1' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL}

    # 7. Reinsert the modified <partition name="UDA"> block before the <partition name="secondary_gpt"> block
    awk -i inplace -v INPLACE_SUFFIX=.bak '/<partition name="secondary_gpt"/{system("cat uda_block.xml");}1' ${D}${datadir}/tegraflash/${PARTITION_LAYOUT_EXTERNAL}
}

```

As there is no nvme\_rootfs\_ab.xml file available.  
I followed this recommendation:

> **[ROOTFS\_AB=1 does not create APP\_B partition](https://forums.developer.nvidia.com/t/rootfs-ab-1-does-not-create-app-b-partition/267929/6?u=pablo.aarch64)**
>
> Hi, I’ve solved my problem by changing the configuration file. There is no configuration file that exists for AB partition on the orin nano devkit with nvme SSD. the nvme SSD is the only medium I can install images on because there’s no SD card...

Plus these variables:

```auto

# Mender tegra_mender_calc_total_size workaround
EMMC_SIZE = "0"
MENDER_STORAGE_TOTAL_SIZE_MB = "51200"
MENDER_DATA_PART_SIZE_MB = "1024"
# MENDER_STORAGE_DEVICE="/dev/nvme0n1"
MENDER_STORAGE_DEVICE_BASE="/dev/nvme0n1p"
MENDER_DATA_PART_NUMBER="15"

# Asuming 512 bytes sectors and 440 Gb
TEGRA_EXTERNAL_DEVICE_SECTORS = "937426944"

```
