Difference between revisions of "NVIDIA Jetson Orin/JetPack 5.0.2/Compiling Code"
(Created page with "<noinclude> {{NVIDIA Jetson Orin/Head|previous=JetPack 5.0/Getting_Started/Components|next=JetPack 5.0/Compiling Code/Kernel|keywords=jetpack,compiling,compile,building}...") |
m (→Install the Toolchain) |
||
(36 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
− | {{NVIDIA Jetson Orin/Head|previous=JetPack 5.0/Getting_Started/Components|next= | + | {{NVIDIA Jetson Orin/Head|previous=JetPack 5.0.2/Getting_Started/Components|next=JetPack_5.0.2/Flashing_Board|metakeywords=jetpack,compiling,compile,building,Jetpack 5.0.2}} |
− | + | {{DISPLAYTITLE:NVIDIA Jetson Orin - Compiling Source Code|noerror}} | |
− | |||
− | {{DISPLAYTITLE:NVIDIA Jetson | ||
− | |||
− | + | Learning to build the BSP and OS components enables developers to customize the software for their specific project needs. | |
− | + | <br> | |
− | |||
− | + | This section will guide you through the process of building the BSP and OS components for the NVIDIA Jetson Orin. For this section you are going to need Jetpack 5.0.2 for Orin AGX installed on your host computer, we assume that you got this installed following through our [[NVIDIA_Jetson_Orin/JetPack_5.0.2/Getting_Started|Getting Started]] and [[NVIDIA_Jetson_Orin/JetPack_5.0.2/Getting_Started/Installing_Jetpack|Installing Jetpack]] sections. | |
+ | <br> | ||
− | == | + | ==Assumptions== |
+ | # The build of the BSP/OS components source code will be performed by cross-compiling on a host computer running a Linux OS. | ||
+ | # Make sure the following dependencies are installed on your system: | ||
+ | ** wget | ||
+ | ** lbzip2 | ||
+ | ** build-essential | ||
+ | ** bc | ||
+ | ** zip | ||
+ | ** libgmp-dev | ||
+ | ** libmpfr-dev | ||
+ | ** libmpc-dev | ||
+ | ** vim-common # For xxd | ||
− | + | In Debian based systems you can run the following: | |
− | + | <syntaxhighlight lang=bash> | |
− | + | sudo apt install wget lbzip2 build-essential bc zip libgmp-dev libmpfr-dev libmpc-dev vim-common | |
− | + | </syntaxhighlight> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ==Downloading and compiling== | |
+ | ===Download the JetPack sources=== | ||
+ | |||
+ | You can obtain the JetPack 5.0.2 DP sources by doing the following: | ||
+ | |||
+ | 1. Go to https://developer.nvidia.com/embedded/jetson-linux-archive and download the source files for your release. | ||
+ | |||
+ | 2. Extract the .tbz2 file: | ||
+ | <pre> | ||
+ | tar -xjf public_sources.tbz2 | ||
+ | </pre> | ||
+ | 3. Extract the kernel source file: | ||
+ | <pre> | ||
+ | cd Linux_for_Tegra/source/public | ||
+ | JETSON_SOURCES=$PWD | ||
+ | tar -xjf kernel_src.tbz2 | ||
+ | </pre> | ||
+ | This extracts the kernel source to the kernel/ subdirectory. | ||
+ | |||
+ | ===Kernel build instructions=== | ||
+ | |||
+ | Once the sources have been downloaded, perform the following steps in order to build. | ||
+ | ====Install the Toolchain==== | ||
+ | First, download the [https://developer.nvidia.com/embedded/jetson-linux Bootlin toolchain binaries] from the NVIDIA Jetson Linux home page. Go to the bottom of the page and click on the Bootlin Toolchain gcc option as shown in the image below: | ||
+ | <br> | ||
+ | <br> | ||
+ | [[File:Toolchain.png|thumb|center|650px]] | ||
+ | <br> | ||
+ | After that do: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
− | + | mkdir $HOME/l4t-gcc | |
+ | cd $HOME/l4t-gcc | ||
+ | tar xf <path_to_toolchain_archive> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | ====Build the kernel==== | ||
+ | |||
+ | * Establish the building paths and create directories: | ||
+ | <pre> | ||
+ | KERNEL_OUT=$JETSON_SOURCES/kernel_out | ||
+ | MODULES_OUT=$JETSON_SOURCES/modules_out | ||
+ | mkdir -p $KERNEL_OUT | ||
+ | mkdir -p $MODULES_OUT | ||
+ | </pre> | ||
+ | |||
+ | * Use the following command to install dependencies on Ubuntu: | ||
+ | <pre> | ||
+ | sudo apt install libncurses-dev | ||
+ | </pre> | ||
+ | |||
+ | * Export environment variables: | ||
+ | <pre> | ||
+ | export CROSS_COMPILE_AARCH64_PATH=$HOME/l4t-gcc | ||
+ | export CROSS_COMPILE_AARCH64=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu- | ||
+ | </pre> | ||
+ | |||
+ | * Compile kernel: | ||
+ | <pre> | ||
+ | cd $JETSON_SOURCES | ||
+ | ./nvbuild.sh -o $KERNEL_OUT | ||
+ | </pre> | ||
+ | |||
+ | *Install the modules | ||
+ | <pre> | ||
+ | make -C $JETSON_SOURCES/kernel/kernel-5.10/ ARCH=arm64 O=$KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$MODULES_OUT modules_install | ||
+ | </pre> | ||
<noinclude> | <noinclude> | ||
− | {{NVIDIA Jetson Orin/Foot|JetPack | + | {{NVIDIA Jetson Orin/Foot|JetPack 5.0.2/Getting_Started/Components|JetPack_5.0.2/Flashing_Board}} |
</noinclude> | </noinclude> |
Latest revision as of 13:24, 17 August 2023
NVIDIA Jetson Orin RidgeRun documentation is currently under development. |
Learning to build the BSP and OS components enables developers to customize the software for their specific project needs.
This section will guide you through the process of building the BSP and OS components for the NVIDIA Jetson Orin. For this section you are going to need Jetpack 5.0.2 for Orin AGX installed on your host computer, we assume that you got this installed following through our Getting Started and Installing Jetpack sections.
Contents
Assumptions
- The build of the BSP/OS components source code will be performed by cross-compiling on a host computer running a Linux OS.
- Make sure the following dependencies are installed on your system:
- wget
- lbzip2
- build-essential
- bc
- zip
- libgmp-dev
- libmpfr-dev
- libmpc-dev
- vim-common # For xxd
In Debian based systems you can run the following:
sudo apt install wget lbzip2 build-essential bc zip libgmp-dev libmpfr-dev libmpc-dev vim-common
Downloading and compiling
Download the JetPack sources
You can obtain the JetPack 5.0.2 DP sources by doing the following:
1. Go to https://developer.nvidia.com/embedded/jetson-linux-archive and download the source files for your release.
2. Extract the .tbz2 file:
tar -xjf public_sources.tbz2
3. Extract the kernel source file:
cd Linux_for_Tegra/source/public JETSON_SOURCES=$PWD tar -xjf kernel_src.tbz2
This extracts the kernel source to the kernel/ subdirectory.
Kernel build instructions
Once the sources have been downloaded, perform the following steps in order to build.
Install the Toolchain
First, download the Bootlin toolchain binaries from the NVIDIA Jetson Linux home page. Go to the bottom of the page and click on the Bootlin Toolchain gcc option as shown in the image below:
After that do:
mkdir $HOME/l4t-gcc
cd $HOME/l4t-gcc
tar xf <path_to_toolchain_archive>
Build the kernel
- Establish the building paths and create directories:
KERNEL_OUT=$JETSON_SOURCES/kernel_out MODULES_OUT=$JETSON_SOURCES/modules_out mkdir -p $KERNEL_OUT mkdir -p $MODULES_OUT
- Use the following command to install dependencies on Ubuntu:
sudo apt install libncurses-dev
- Export environment variables:
export CROSS_COMPILE_AARCH64_PATH=$HOME/l4t-gcc export CROSS_COMPILE_AARCH64=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-
- Compile kernel:
cd $JETSON_SOURCES ./nvbuild.sh -o $KERNEL_OUT
- Install the modules
make -C $JETSON_SOURCES/kernel/kernel-5.10/ ARCH=arm64 O=$KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$MODULES_OUT modules_install