Compiling Jetson Nano source code L4T 32.2.1
|
|
Introduction
This wiki page contains instructions to download and build kernel source code for Jetson Nano, several parts of this wiki were based in the document: NVIDIA Tegra Linux Driver Package Development Guide 32.2.
L4T 32.2.1 is used by JetPack 4.2.2 (You can get more information from jetpack-archive).
Build Kernel
Follow these instructions to build and install the kernel image and device tree.
1. Download and install the Toolchain
NVIDIA recommends using the Linaro 7.3.1 2018.05 toolchain for L4T 32.1
Download the pre-built toolchain binaries from: http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
Execute the following commands to extract the toolchain:
mkdir $HOME/l4t-gcc cd $HOME/l4t-gcc tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
2. Download the kernel sources
You can download the kernel source files and then manually extract them. it is recommended to instead sync with git.
In a browser, navigate to: https://developer.nvidia.com/embedded/downloads. Locate and download the L4T Sources for your release. (L4T Sources 32.1 2019/03/18) or run the command below:
wget https://developer.download.nvidia.com/embedded/L4T/r32-2-1_Release_v1.0/Nano-TX1/Sources/public_sources.tbz2
Execute the following commands to extract the kernel:
tar -xvf public_sources.tbz2 cd public_sources/ JETSON_NANO_KERNEL_SOURCE=$(pwd) tar -xvf kernel_src.tbz2
3. Compile kernel and dtb
Follow the steps:
cd $JETSON_NANO_KERNEL_SOURCE CROSS_COMPILE=$HOME/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- TEGRA_KERNEL_OUT=$JETSON_NANO_KERNEL_SOURCE/build KERNEL_MODULES_OUT=$JETSON_NANO_KERNEL_SOURCE/modules make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT menuconfig # if is required to change the default configuration make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j6 Image make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j6 dtbs make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT CROSS_COMPILE=${CROSS_COMPILE} -j6 modules make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT
Flash Jetson NANO
This guide assumes that the user already has JetPack 4.2.2 installed. This link contains details about how to install JetPack 4.2.2: https://docs.nvidia.com/sdk-manager/download-run-sdkm/index.html
JETPACK_4_2_2 contains the directory where JetPack 4.2.2 was installed. For example.
export JETPACK_4_2_2=$HOME/JetPack-L4T-4.2.2
Select DTB and directory based on Jetson Nano module type
Production module
DTB=tegra210-p3448-0002-p3449-0000-b00.dtb JETPACK_4_2_2_P3448=${JETPACK_4_2_2}/JetPack_4.2.2_Linux_GA_P3448/Linux_for_Tegra
Devkit module
export DTB=tegra210-p3448-0000-p3449-0000-a02.dtb JETPACK_4_2_2_P3448=${JETPACK_4_2_2}/JetPack_4.2.2_Linux_GA_P3448-0020/Linux_for_Tegra
Make sure the Jetson Nano is in recovery mode
Copy kernel, device tree and modules into jetpack
cd ${JETPACK_4_2_2_P3448} # Copy kernel generated cp $JETSON_NANO_KERNEL_SOURCE/build/arch/arm64/boot/Image kernel/ # Copy device tree generated cp $JETSON_NANO_KERNEL_SOURCE/build/arch/arm64/boot/dts/${DTB} kernel/dtb/ # Copy new modules sudo cp -a $JETSON_NANO_KERNEL_SOURCE/modules/lib rootfs/
Flash memory
Make sure the Jetson NANO is in recovery mode.
Flash production module DTB
sudo ./flash.sh jetson-nano-emmc mmcblk0p1
Flash Devkit module
sudo ./flash.sh jetson-nano-qspi-sd mmcblk0p1
Flash device tree only
This command flashes only the device tree, excluding the kernel image and filesystem. Make sure the Jetson NANO is in recovery mode.
Flash production module DTB
sudo ./flash.sh -r -k DTB jetson-nano-emmc mmcblk0p1
Flash Devkit module
sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1
Flash custom DTB on the Jetson Nano
This command flashes only the device tree, excluding the kernel image and filesystem, just make sure to put the board in recovery mode.
cd ${JETPACK_4_2_2}/JetPack_4.2.2_Linux_GA_P3448/Linux_for_Tegra/ # Copy device tree generated cp $JETSON_NANO_KERNEL_SOURCE/build/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-a02.dtb kernel/dtb/ # Flash device tree partition sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1
For direct inquiries, please refer to the contact information available on our Contact page. Alternatively, you may complete and submit the form provided at the same link. We will respond to your request at our earliest opportunity.
Links to RidgeRun Resources and RidgeRun Artificial Intelligence Solutions can be found in the footer below.