Yocto Support for NVIDIA® Jetson™ with JetPack 6 Integration - Flashing Jetson Platform

From RidgeRun Developer Wiki



Previous: Setting up Yocto Index Next: Accessing the Board





eMMC boot

1. Save the following script to deploy.sh

#!/bin/bash

image=$1
machine=$2

scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
deployfile=${image}-${machine}.tegraflash.tar.gz
tmpdir=`mktemp`

rm -rf $tmpdir
mkdir -p $tmpdir
echo "Using temp directory $tmpdir"
pushd $tmpdir
cp $scriptdir/build/tmp/deploy/images/${machine}/$deployfile .
tar -xvf $deployfile
set -e
sudo ./doflash.sh
popd
echo "Removing temp directory $tmpdir"
rm -rf $tmpdir

2. Connect the USB port to the host machine and put the target board in recovery mode.

3. Use the script as follows:

./deploy.sh <IMAGE> <MACHINE>

for example:

./deploy.sh core-image-sato-dev jetson-tx2

SD Card Boot

Orin Nano

Setting up

Before getting started, you will need:

  • A suitable USB cable. In the case of the AGX Orin Nano devkit, you'll need a USB-C cable (or a USB C to USB A cable depending on the ports available on your host machine).
  • A free USB port on your host machine. It is preferable connecting directly to a port instead of using a USB hub.
  • dtc command in your PATH, since the NVIDIA tools use that command when preparing the boot files for some Jetsons. This command is included in the device-tree-compiler package.
  • The GNU cpp command in your PATH.
  • A MicroSDHC/SDXC card, preferably 16GB or larger.
  • SDcard reader/writer

An important note to make is that flashing typically does not work from a virtual machine. You should be running the flashing tools directly on a Linux host.

Avoiding Sudo (Optional)

Using sudo during the flashing process is avoidable by adding yourself to suitable groups and installing a udev rules files to grant access to the Jetsons via USB. These steps work specifically for Ubuntu and other distros may required extra steps or a different configuration. You'll need to add yourself to the following groups:

  • disk for SDCard writing.
  • plugdev for USB flashing.

With the next script [1], the udev rules and group changes will be made to access the Orin Nano device while in recovery mode:

#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
    echo "You may need to run this script as sudo if you see permission errors"
fi
if [ ! -z "${SUDO_USER}" ]; then
    user=${SUDO_USER}
else
    user=`whoami`
fi
set -e
cat << EOF > /etc/udev/rules.d/99-oe4t.rules
# Jetson TK1
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7140", GROUP="plugdev"
# Jetson TX1
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7721", GROUP="plugdev"
# Jetson TX2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7c18", GROUP="plugdev"
# Jetson TX2i
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7018", GROUP="plugdev"
# Jetson TX2-4GB
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7418", GROUP="plugdev"
# Jetson AGX Xavier
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7019", GROUP="plugdev"
# Jetson Xavier NX
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7e19", GROUP="plugdev"
# Jetson Nano
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7f21", GROUP="plugdev"
# Jetson Orin AGX (P3701-0000 Developer Kit module), (P3701-0005 with 64GB), (P3701-0008 with 64GB)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7023", GROUP="plugdev"
# Jetson Orin AGX (P3701-0004 with 32GB)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7223", GROUP="plugdev"
# Jetson Orin NX (P3767-0000 with 16GB)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7323", GROUP="plugdev"
# Jetson Orin NX (P3767-0001 with 8GB)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7423", GROUP="plugdev"
# Jetson Orin Nano (P3767-0003 and P3767-0005 with 8GB)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7523", GROUP="plugdev"
# Jetson Orin Nano (P3767-0004 with 4GB)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7623", GROUP="plugdev"
EOF
udevadm control --reload
echo "udev settings applied, please disconnect/reconnect your device"
set +e
groups ${user} | grep "plugdev" > /dev/null 2>&1
rc=$?
if [ $rc -ne 0 ]; then
    echo "Please add ${user} to plugdev using:"
    echo "sudo usermod -a -G plugdev  ${user}"
    echo "Then apply to your user by logging back into the session or running"
    echo "newgrp plugdev"
fi

To run the script:

1. Save the script as udev-rules.sh or any desired name.

2. Grant execution permissions to the file.

chmod +x udev-rules.sh

3. Run the script with sudo.

sudo ./udev-rules.sh

After changing groups or the udev rules, your system may need a reboot for the changes to apply.

Flashing an SDCard and the Orin Nano

1. Unpacking the tegraflash package:

By successfully running any bitbake build of any Jetson machine configuration, a default tegraflash image is added. This tarball contains all the tools, files and scripts required to flash the device and writing an SDCard with the desired image. In the $BUILDDIR/tmp/deploy/images/${MACHINE}/ directory you should see a file named:

<image-type>-${MACHINE}.rootfs.tegraflash.tar.gz

The default compression method on the master branch changed as of Feb 10 2025, so the file may end with .tar.zst instead of .tar.gz.

To either flash the Orin Nano, or create an SD Card image, move the tarball mentioned to an empty directory and use the tar to unpack the tegraflash package. Make sure to change the ${MACHINE} and <image-type> spaces to the desired image and target machine (in this case, the variable ${MACHINE} should be jetson-orin-nano-devkit):

mkdir ~/orin-image
cd ~/orin-image
cp $BUILDDIR/tmp/deploy/images/${MACHINE}/<image-type>-${MACHINE}.rootfs.tegraflash.tar.gz .
tar -xvf <image-type>-${MACHINE}.rootfs.tegraflash.tar.gz

2. Setting up for flashing

  • Start with your Orin Nano unplugged.
  • Connect the USB Cable from your Orin Nano to your host machine.
  • Connect a jumper between the 3rd and 4th pins from the right hand side of the "button header" underneath the back of the module. These pins should be named FC REC and GND.
  • Power on the Orin Nano.

Note: In this case, the SD Card flashing will be done separately from the target device flashing.

Verify that the Orin Nano is correctly connected and in recovery mode, use the following command:

lsusb -d 0955:

You should see a similar output to this:

Bus 001 Device 006: ID 0955:7523 NVIDIA Corp. APX

3. Flashing the Orin Nano

With everything being set up correctly, use the doflash.sh script to flash only the boot partitions in the SPI flash with the next command:

./doflash.sh --spi-only

In the SDcard-based devices development kits, like the Jetson Orin Nano, some or all of the bootloader content is stored in a SPI flash device on the Jetson module. To ensure the bootloader contents are compatible with the layout on the SD card you create, you must USB flash first to program the SPI flash at least once.

4. Writing an SD Card

  • Insert the card into the reader/writer on your host.
  • Verify the name of your card in the host system. Choosing a wrong device could be fatal to your host's filesystem.
  • Run the dosdcard.sh script to flash the SD card. Make sure to change to the appropriate device's name.
./dosdcard.sh /dev/<sdcard-name>

The script will prompt a writing confirmation, you should type yes.

5. Booting the Orin Nano

Once everything is finished, take your target device out of recovery mode, connect a mouse, keyboard, and monitor, and the boot process should start.

NVMe, USB boot

Orin Nano

1. In the host computer, disable automatic mounting of removable media in your desktop settings. On recent Ubuntu (GNOME), go to Settings -> Removable Media, and check the box next to "Never prompt or start programs on media insertion."

2. Update the /org/gnome/desktop/media-handling/automount setting via dconf. Check the setting with:

dconf read /org/gnome/desktop/media-handling/automount

If it reports true, set it with:

dconf write /org/gnome/desktop/media-handling/automount false

3. Add this line at the end of the local.conf file:

TNSPEC_BOOTDEV:jetson-orin-nano-devkit-nvme = "nvme0n1p1"

4. Put the device into recovery mode and connect it to the host computer.

5. Go to the path where the flashing script is located with this command:

cd $YOCTO_DIR/build/tmp/work/<MACHINE>-poky-linux/<IMAGE>/1.0/tegraflash/

6. Flash the board with the following command:

sudo ./initrd-flash

Wait for this command to report a success status.

7. Unplug the USB cable from the board and reboot it.


Previous: Setting up Yocto Index Next: Accessing the Board



References

  1. OE4T Support Page (Matt Maddison and Claus Stovgaard). Retrieved November 3, 2025, from [1]