Compiling Jetson TX2 source code L4T 32.3.1: Difference between revisions
mNo edit summary |
|||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
= | <seo title="Compiling Tegra Source Code | Compiling Jetson TX2 source code L4T 32.3.1 | RidgeRun" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP, Embedded Linux, Device Drivers, NVIDIA, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework,Jetson TX2 source code, L4T 32.3.1, Tegra Source Code, L4T 32.3, Jetson, Nvidia Jetson, Tegra, Nvidia Tegra, Jetson TX1, Tegra TX1, Tegra TX2" description="Learn about compiling Tegra source code L4T 32.3.1 for Jetson TX1 and TX2 at RidgeRun Developer."></seo> | ||
<table> | |||
<tr> | |||
<td><div class="clear; float:right">__TOC__</div></td> | |||
<td> | |||
{{NVIDIA Preferred Partner logo}} | |||
<td> | |||
<center> | |||
{{ContactUs Button}} | |||
</center> | |||
</tr> | |||
</table> | |||
= Build kernel = | == Introduction == | ||
This wiki page contains instructions to download and build kernel source code for Jetson TX2, several parts of this wiki were based in the document: [https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3231/index.html NVIDIA Tegra Linux Driver Package Development Guide 32.3.1 release]. | |||
L4T 32.3.1 is used by [https://developer.nvidia.com/embedded/jetpack JetPack 4.3]. | |||
== Build NVIDIA Jetson TX2 kernel source code == | |||
'''1. Download and install the Toolchain''' | '''1. Download and install the Toolchain''' | ||
NVIDIA recommends using the Linaro 7.3.1 2018.05 toolchain for L4T 32.3 ([https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3231/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fxavier_toolchain.html%23 | NVIDIA recommends using the Linaro 7.3.1 2018.05 toolchain for L4T 32.3 ([https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3231/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fxavier_toolchain.html%23 Jetson Linux Driver PackageToolchain]) | ||
Download the pre-built toolchain binaries | Download the pre-built toolchain binaries: [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 gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz] and locate them under '''$HOME/l4t-gcc''', or alternatively execute on console: | ||
<syntaxhighlight lang="bash" style="background-color:cornsilk"> | <syntaxhighlight lang="bash" style="background-color:cornsilk"> | ||
Line 23: | Line 38: | ||
tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz | tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz | ||
</syntaxhighlight> | </syntaxhighlight> | ||
'''2. Download the kernel sources for L4T 32.3.1''' | '''2. Download the kernel sources for L4T 32.3.1''' | ||
Line 29: | Line 43: | ||
mkdir -p $HOME/l4t-sources/tx2/ | mkdir -p $HOME/l4t-sources/tx2/ | ||
cd $HOME/l4t-sources/tx2 | cd $HOME/l4t-sources/tx2 | ||
wget https://developer.download.nvidia.com/embedded/L4T/r32-3-1_Release_v1.0/Sources/T186/public_sources.tbz2 | wget https://developer.download.nvidia.com/embedded/L4T/r32-3-1_Release_v1.0/Sources/T186/public_sources.tbz2 # be sure to download the correct sources, since on JP4.3 the only changes are between nano-tx1/tx2-xavier | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 43: | Line 57: | ||
Apply corresponding patches (if any) and follow to the next section. | Apply corresponding patches (if any) and follow to the next section. | ||
'''3. Compile kernel and dtb''' | '''3. Compile Jetson TX2 kernel and dtb ('''d'''evice '''t'''ree '''b'''lob)''' | ||
<syntaxhighlight lang="bash" style="background-color:cornsilk"> | <syntaxhighlight lang="bash" style="background-color:cornsilk"> | ||
Line 65: | Line 79: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Now compile the image, dtbs and modules: | Now compile the kernel image, dtbs and modules: | ||
<syntaxhighlight lang="bash" style="background-color:cornsilk"> | <syntaxhighlight lang="bash" style="background-color:cornsilk"> | ||
Line 74: | Line 88: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Install image on the TX2 = | == Install L4T 32.3.1 kernel image on the Jetson TX2 == | ||
This guide assumes that the user already has sdk-manager installed. This link contains details about how to | This guide assumes that the user already has sdk-manager installed. This link contains details about how to [https://docs.nvidia.com/sdk-manager/download-run-sdkm/index.html install] NVIDIA [https://developer.nvidia.com/nvidia-sdk-manager SDK Manager]. | ||
NVIDIA_SDK_MANAGER contains the directory where | NVIDIA_SDK_MANAGER contains the directory where NVIDIA SDK manager was installed. For example: | ||
<syntaxhighlight lang="bash" style="background-color:cornsilk"> | <syntaxhighlight lang="bash" style="background-color:cornsilk"> | ||
Line 89: | Line 103: | ||
JETPACK_4_3_P3310=${NVIDIA_SDK_MANAGER}/JetPack_4.3_Linux_P3310/Linux_for_Tegra/ | JETPACK_4_3_P3310=${NVIDIA_SDK_MANAGER}/JetPack_4.3_Linux_P3310/Linux_for_Tegra/ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Copy kernel, device tree and modules into JetPack 4.3 === | |||
<syntaxhighlight lang="bash" style="background-color:cornsilk"> | |||
cd ${JETPACK_4_3_P3310} | |||
# Copy kernel generated | |||
cp -rfv $JETSON_TX2_KERNEL_SOURCES/build/arch/arm64/boot/Image kernel/ | |||
# Copy device tree generated | |||
cp -rfv $JETSON_TX2_KERNEL_SOURCES/build/arch/arm64/boot/dts/tegra186-quill-p3310* kernel/dtb/ | |||
# Copy new modules | |||
sudo cp -arfv $JETSON_TX2_KERNEL_SOURCES/modules/lib rootfs/ | |||
</syntaxhighlight> | |||
=== Flash the kernel and the DTB === | |||
For this it's required to use NVIDIA's script 'flash.sh': | |||
<syntaxhighlight lang="bash" style="background-color:cornsilk"> | |||
sudo ./flash.sh -r -d kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb -K kernel/Image jetson-tx2 mmcblk0p1 | |||
</syntaxhighlight> | |||
{{ContactUs}} | |||
[[Category:Jetson]][[Category:JetsonNano]][[Category: JetsonTX2]][[Category:NVIDIA Xavier]] |
Latest revision as of 04:03, 8 May 2024
|
|
Introduction
This wiki page contains instructions to download and build kernel source code for Jetson TX2, several parts of this wiki were based in the document: NVIDIA Tegra Linux Driver Package Development Guide 32.3.1 release.
L4T 32.3.1 is used by JetPack 4.3.
Build NVIDIA Jetson TX2 kernel source code
1. Download and install the Toolchain
NVIDIA recommends using the Linaro 7.3.1 2018.05 toolchain for L4T 32.3 (Jetson Linux Driver PackageToolchain)
Download the pre-built toolchain binaries: gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz and locate them under $HOME/l4t-gcc, or alternatively execute on console:
mkdir -p $HOME/l4t-gcc cd $HOME/l4t-gcc 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:
tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
2. Download the kernel sources for L4T 32.3.1
mkdir -p $HOME/l4t-sources/tx2/ cd $HOME/l4t-sources/tx2 wget https://developer.download.nvidia.com/embedded/L4T/r32-3-1_Release_v1.0/Sources/T186/public_sources.tbz2 # be sure to download the correct sources, since on JP4.3 the only changes are between nano-tx1/tx2-xavier
Execute the following commands to extract the kernel sources:
tar -xvf public_sources.tbz2 cd Linux_for_Tegra/source/public JETSON_TX2_KERNEL_SOURCES=$(pwd) tar -xf kernel_src.tbz2
Apply corresponding patches (if any) and follow to the next section.
3. Compile Jetson TX2 kernel and dtb (device tree blob)
cd $JETSON_TX2_KERNEL_SOURCES TOOLCHAIN_PREFIX=$HOME/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- TEGRA_KERNEL_OUT=$JETSON_TX2_KERNEL_SOURCES/build KERNEL_MODULES_OUT=$JETSON_TX2_KERNEL_SOURCES/modules make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} tegra_defconfig make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} menuconfig
here you have to select the modules you want to compile, for example for libguvc something like this is required:
-> Device Drivers -> USB support (USB_SUPPORT [=y]) -> USB Gadget Support (USB_GADGET [=y]) -> USB Gadget Drivers (<choice> [=m])
Now compile the kernel image, dtbs and modules:
make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j$(nproc) Image make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j$(nproc) dtbs make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j$(nproc) modules make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$KERNEL_MODULES_OUT modules_install
Install L4T 32.3.1 kernel image on the Jetson TX2
This guide assumes that the user already has sdk-manager installed. This link contains details about how to install NVIDIA SDK Manager.
NVIDIA_SDK_MANAGER contains the directory where NVIDIA SDK manager was installed. For example:
export NVIDIA_SDK_MANAGER=$HOME/nvidia/nvidia_sdk/
Export the following variables:
JETPACK_4_3_P3310=${NVIDIA_SDK_MANAGER}/JetPack_4.3_Linux_P3310/Linux_for_Tegra/
Copy kernel, device tree and modules into JetPack 4.3
cd ${JETPACK_4_3_P3310} # Copy kernel generated cp -rfv $JETSON_TX2_KERNEL_SOURCES/build/arch/arm64/boot/Image kernel/ # Copy device tree generated cp -rfv $JETSON_TX2_KERNEL_SOURCES/build/arch/arm64/boot/dts/tegra186-quill-p3310* kernel/dtb/ # Copy new modules sudo cp -arfv $JETSON_TX2_KERNEL_SOURCES/modules/lib rootfs/
Flash the kernel and the DTB
For this it's required to use NVIDIA's script 'flash.sh':
sudo ./flash.sh -r -d kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb -K kernel/Image jetson-tx2 mmcblk0p1
RidgeRun Resources | |||||
Contact Us
|