Building custom Kernel for Orin Nano and Orin NX and flashing it on custom carrier board , JP 6.0

Hi,
I have followed the following steps and created the custom kernel in a linux 22.04 LTS VM.

sudo apt install wget lbzip2 build-essential bc zip libgmp-dev libmpfr-dev libmpc-dev vim-common libncurses-dev bison flex libssl-dev libelf-dev

Download Toolchain

https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2

To extract the toolchain, enter these commands:
$ mkdir $HOME/l4t-gcc
$ cd $HOME/l4t-gcc
$ tar xf <toolchain_archive aarch64–glibc–stable-2022.08-1.tar.bz2>

Setting the CROSS_COMPILE Environment Variable:
export CROSS_COMPILE=$HOME/l4t-gcc/aarch64–glibc–stable-2022.08-1/bin/aarch64-buildroot-linux-gnu-

To Build Kernel:
Download
https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/sources/public_sources.tbz2
tar xjf public_sources.tbz2 -C ${HOME}/nvidia-jetson/
mkdir -p ${HOME}/nvidia-jetson/build
tar -xjf ${HOME}/nvidia-jetson/Linux_for_Tegra/source/kernel_src.tbz2 -C ${HOME}/nvidia-jetson/build
tar -xjf ${HOME}/nvidia-jetson/Linux_for_Tegra/source/kernel_oot_modules_src.tbz2 -C ${HOME}/nvidia-jetson/build
tar -xjf ${HOME}/nvidia-jetson/Linux_for_Tegra/source/nvidia_kernel_display_driver_source.tbz2 -C ${HOME}/nvidia-jetson/build

cd ${HOME}/nvidia-jetson/build
make -C kernel clean
make clean
make -C kernel
export KERNEL_HEADERS=$PWD/kernel/kernel-jammy-src
make modules
export INSTALL_MOD_PATH=${HOME}/nvidia-jetson/Linux_for_Tegra/rootfs
make dtbs

Rootfs
https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/release/tegra_linux_sample-root-filesystem_r36.3.0_aarch64.tbz2

tar xf Jetson_Linux_R36.3.0_aarch64.tbz2 -C ${HOME}/nvidia-jetson/
sudo tar xpf Tegra_Linux_Sample-Root-Filesystem_R36.3.0_aarch64.tbz2 -C
${HOME}/nvidia-jetson/Linux_for_Tegra/rootfs
cd ${HOME}/nvidia-jetson/Linux_for_Tegra
sudo ./tools/l4t_flash_prerequisites.sh
sudo ./apply_binaries.sh

#JetPack 6 Compiling Source Code - RidgeRun Developer Wiki

Installing everything:

export INSTALL_MOD_PATH=${HOME}/nvidia-jetson/Linux_for_Tegra/rootfs
sudo -E make -C kernel install

cp ${HOME}/nvidia-jetson/build/kernel/kernel-jammy-src/arch/arm64/boot/Image ${HOME}/nvidia-jetson/Linux_for_Tegra/kernel/Image

sudo -E make modules_install

copy dtb to proper place:
cp nvidia-oot/device-tree/platform/generic-dts/dtbs/* …/Linux_for_Tegra/kernel/dtb

Final command to Flash
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 jetson-orin-nano-devkit internal
The attached is the output I get :
flashing sequence.txt (274.6 KB)

Now I am not sure what I have missed?
Can some one please help.

Hi @shanbhagm

A couple of questions:

  • Did you create a custom device tree for this?
  • Did you first flash your device using the SDKManager? Some users experience several issues flashing their devices with a VM so I want to make sure that you were able to flash the device before the customizations. For instance, check the following recommendations: Jetson Orin Nano (Super) boot from NVMe - using a VM to configure this

Regards,

Ricardo González Víquez
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com
Website: www.ridgerun.com

Thanks for the response Ricardo.

I have not created any custom device tree. How can I do it?

Using SDK Manager I can flash the device with JP 6.0:.

In the dts file I have changed the following to work with SDK Manager for my custom carrier board:
/home/developer/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/bootloader/generic/BCT/tegra234-mb2-bct-misc-p3767-0000.dts

  • cvb_eeprom_read_size = <0x100>
  • cvb_eeprom_read_size = <0x0>

Even in a flashed Jetson Orin if I replace my built kernel in /boot folder in nvme and reboot the device boots.

Questions:
With this kernel, where is the standard DTS for Orin Nano and NX(name and path of file)? I need to make sure the DTS has the EEPROM changes.

Hi @shanbhagm

So to understand things, you are able to flash your device with the SDKManager but not with the flash command? Analyzing better your flashing command, I notice that it differs a bit from the recommended one by NVIDIA in their documentation. You may want to test with:

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

Regarding the device tree files, the standard dts for an Orin NX is located at hardware/nvidia/t23x/nv-public/nv-platform/tegra234-p3768-0000+p3767-0001-nv.dts

In order to create a custom device tree. You could create a new file over the hardware/nvidia/t23x/nv-public/nv-platform/ directory and add it to its Makefile in order to get it compile. Then you can make your customizations based on the standard DTS file. You could also backup a copy of the standard DTS file and work over that file. After doing so, you have to compile the device tree and test it by sending it over ssh or replacing the Linux_for_Tegra/kernel/dtb dtb file that you just compiled.

Regards,

Ricardo González Víquez
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com
Website: www.ridgerun.com

I followed these below instructions from Waveshare and I see that still its the same, It fails with following msg :

Waiting for target to boot-up…
Timeout
Device failed to boot to the initrd flash kernel. Please retrive the serial log during flashing to debug further.
Cleaning up…

Hardware I have :
Orin 8 GB Production Nano or NX( Its a non EMMC and I need to boot from NVME)
Custom carrier board with out EEPROM.

The flashing method followed:

Method 2: System Installation (script)

To facilitate user operations, here are the terminal commands to download the Jetpack 6.2 resource package and refresh it. Users can open the terminal and directly copy the commands to operate.

There will be a new version in the future, please refer to the relevant instructions

  • Run the command to create a new folder for storage

sudo mkdir orin_nano cd orin_nano

  • Download the BSP and file system package

wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v4.3/release/Jetson_Linux_r36.4.3_aarch64.tbz2 wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v4.3/release/Tegra_Linux_Sample-Root-Filesystem_r36.4.3_aarch64.tbz2

  • Extract the resource package and configure the environment
    • The decompression process will take some time, please wait for it to complete before running other commands
    • During the configuration process, please pay attention to the error messages. Some user systems may be missing components. Please install the relevant components according to the error messages

sudo tar xf Jetson_Linux_r36.4.3_aarch64.tbz2 sudo tar xpf Tegra_Linux_Sample-Root-Filesystem_r36.4.3_aarch64.tbz2 -C Linux_for_Tegra/rootfs/ cd Linux_for_Tegra/ sudo ./tools/l4t_flash_prerequisites.sh sudo ./apply_binaries.sh

  • Preset username and password (optional)
    • Here use the command to pre-set the username and password of the motherboard. Users can also skip this step, connect the screen, keyboard and mouse for manual configuration after the flashing
    • In the command, jetson is the user name set and jetson1 is the password set. Users can change it according to their own needs. -a is the setting to log in automatically. Without this parameter, you need to enter the user name and password to log in after the system starts

sudo ./tools/l4t_create_default_user.sh -u jetson -p jetson1 -a

  • Flash the system to the motherboard
    • Please make sure that the motherboard is connected to the Ubuntu host computer and set to flash mode

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

Any help would be appreciated, How to fix this issue?

Hi @shanbhagm

Have you been able to flash the device with the flashing commands (not the SDKManager) before performing the modifications? I strongly suggest you follow the recommendations from this forum Jetson Orin Nano (Super) boot from NVMe - using a VM to configure this. Many users experience problems with virtual machines. If possible, move to an Ubuntu machine or try to follow the instructions of the forum.

Please also provide the full log of the flashing process and get the serial log while flashing the device. You can follow the following instructions to connect a serail cable: NVIDIA Jetson Orin Nano - Serial Console.

Regards,

Ricardo González Víquez
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com
Website: www.ridgerun.com

1 Like

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