NVIDIA Jetson Orin/JetPack 5.0.2/Compiling Code: Difference between revisions
No edit summary |
|||
(15 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=JetPack_5.0/Flashing_Board| | {{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}} | ||
</noinclude> | |||
{{DISPLAYTITLE:NVIDIA Jetson Orin - Compiling Source Code|noerror}} | {{DISPLAYTITLE:NVIDIA Jetson Orin - Compiling Source Code|noerror}} | ||
Line 7: | Line 8: | ||
<br> | <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. | |||
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 for Orin AGX installed on your host computer, we assume that you got this installed following through our [[NVIDIA_Jetson_Orin/JetPack_5.0/Getting_Started|Getting Started]] and [[NVIDIA_Jetson_Orin/JetPack_5.0/Getting_Started/Installing_Jetpack|Installing Jetpack]] sections. | |||
<br> | <br> | ||
==Assumptions== | ==Assumptions== | ||
# The build of the BSP/OS components source code will be performed by cross-compiling on a host computer running a Linux OS. | # 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: | # Make sure the following dependencies are installed on your system: | ||
** wget | ** wget | ||
Line 45: | Line 35: | ||
You can obtain the JetPack 5.0.2 DP sources by doing the following: | 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. | 1. Go to [https://developer.nvidia.com/embedded/jetson-linux-archive Jetson Linux Archive] and download the source files for your release. '''Important: ''' Consider that JetPack-5.0.2 requires L4T-35.1, JetPack-5.1.2 requires L4T-35.4.1 and so on, you can check the JetPack/L4T correlation at [https://developer.nvidia.com/embedded/jetpack-archive JetPack-Archive]. For this example we use the [https://developer.nvidia.com/embedded/jetson-linux-r351 L4T-35.1] BSP | ||
2. Extract the .tbz2 file: | 2. Extract the .tbz2 file: | ||
Line 55: | Line 45: | ||
cd Linux_for_Tegra/source/public | cd Linux_for_Tegra/source/public | ||
JETSON_SOURCES=$PWD | JETSON_SOURCES=$PWD | ||
tar | tar -xjf kernel_src.tbz2 | ||
</pre> | </pre> | ||
This extracts the kernel source to the kernel/ subdirectory. | This extracts the kernel source to the kernel/ subdirectory. | ||
Line 64: | Line 54: | ||
====Install the Toolchain==== | ====Install the Toolchain==== | ||
First download the [https://developer.nvidia.com/embedded/jetson-linux Bootlin | * First, download the Bootlin toolchain binaries] from the NVIDIA Jetson Linux home page. | ||
* '''Important''' same as for the BSP version, the L4T version is important, for JetPack-5.0.2 we use L4T-35.1, building L4T-35.1 with much newer compilers may cause issues, for example building JetPack-5.1.2 with l4t-gcc from L4T-36.3, causes builds to fail. For this example we download the [https://developer.nvidia.com/embedded/jetson-linux-r351 Bootlin Toolchain gcc from L4T-35.1]. | |||
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]] | [[File:Toolchain.png|thumb|center|650px]] | ||
<br> | |||
After that do: | After that do: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
Line 106: | Line 100: | ||
make -C $JETSON_SOURCES/kernel/kernel-5.10/ ARCH=arm64 O=$KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$MODULES_OUT modules_install | make -C $JETSON_SOURCES/kernel/kernel-5.10/ ARCH=arm64 O=$KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$MODULES_OUT modules_install | ||
</pre> | </pre> | ||
<noinclude> | <noinclude> | ||
{{NVIDIA Jetson Orin/Foot|JetPack 5.0/Getting_Started/Components|JetPack_5.0/Flashing_Board}} | {{NVIDIA Jetson Orin/Foot|JetPack 5.0.2/Getting_Started/Components|JetPack_5.0.2/Flashing_Board}} | ||
</noinclude> | </noinclude> |
Latest revision as of 23:19, 9 July 2024
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.
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 Jetson Linux Archive and download the source files for your release. Important: Consider that JetPack-5.0.2 requires L4T-35.1, JetPack-5.1.2 requires L4T-35.4.1 and so on, you can check the JetPack/L4T correlation at JetPack-Archive. For this example we use the L4T-35.1 BSP
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.
- Important same as for the BSP version, the L4T version is important, for JetPack-5.0.2 we use L4T-35.1, building L4T-35.1 with much newer compilers may cause issues, for example building JetPack-5.1.2 with l4t-gcc from L4T-36.3, causes builds to fail. For this example we download the Bootlin Toolchain gcc from L4T-35.1.
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