Compiling Jetson TX1/TX2 source code: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 1: Line 1:
<seo title="Compiling Tegra Source Code | Jetson Tegra X1 and X2 | 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,Compiling Jetson,Jetson TX1/TX2 source code,Tegra source code ."  description="Learn about compiling Tegra source code for Jetson TX1 and TX2. Read related articles and instructions for Jetpack online now at RidgeRun Developer."></seo>
<seo title="Compiling Tegra Source Code | Jetson Tegra X1 and X2 | 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,Compiling Jetson,Jetson TX1/TX2 source code,Tegra source code ."  description="Learn about compiling Tegra source code for Jetson TX1 and TX2. Read related articles and instructions for Jetpack online now at RidgeRun Developer."></seo>


= Introduction =
== Introduction ==


In this wiki page you are going to find the instructions to download the source code to rebuild the Jetson TX1/TX2 images using jetpack, several parts of this wiki were based in the document called Start_L4T_Docs.html given by Nvidia in L4T. This page should be considered a work in progress. These steps were run on Jetson Tegra X1 and Tegra X2 and Jetpack 3.2.1 was used. Additionally, in section [[Compiling_Jetson_TX1/TX2_source_code#Articles_related|Articles Related]] you can find instructions on how to build using older versions of Jetpack.
In this wiki page you are going to find the instructions to download the source code to rebuild the Jetson TX1/TX2 images using jetpack, several parts of this wiki were based in the document called Start_L4T_Docs.html given by Nvidia in L4T. This page should be considered a work in progress. These steps were run on Jetson Tegra X1 and Tegra X2 and Jetpack 3.2.1 was used. Additionally, in section [[Compiling_Jetson_TX1/TX2_source_code#Articles_related|Articles Related]] you can find instructions on how to build using older versions of Jetpack.
Line 18: Line 18:
It is assumed that the reader already read [https://developer.ridgerun.com/wiki/index.php?title=Tegra_X1#Tegra_X1 the brief Jetson TX1 introduction]
It is assumed that the reader already read [https://developer.ridgerun.com/wiki/index.php?title=Tegra_X1#Tegra_X1 the brief Jetson TX1 introduction]


= Downloading the code =
== Downloading the code ==


In order to be able to download the source code you should have Jetpack  installed, if you already have it, skip the next section and go to [[Compiling_Jetson_TX1/TX2_source_code#Getting_bootloader_and_kernel|Getting bootloader and kernel]].
In order to be able to download the source code you should have Jetpack  installed, if you already have it, skip the next section and go to [[Compiling_Jetson_TX1/TX2_source_code#Getting_bootloader_and_kernel|Getting bootloader and kernel]].


= Toolchain =
== Toolchain ==


1. You can download the official NVIDIA toolchain for JetPack 3.2.1:
1. You can download the official NVIDIA toolchain for JetPack 3.2.1:
Line 84: Line 84:
'''5.''' Follow the instructions. You'll be prompted for a devkit to build for (TX1, TX2, TX2i) just select the one you want.
'''5.''' Follow the instructions. You'll be prompted for a devkit to build for (TX1, TX2, TX2i) just select the one you want.


== Getting bootloader and kernel ==
=== Getting bootloader and kernel ===




Line 105: Line 105:
</pre>
</pre>


===Download the kernel source code===
====Download the kernel source code====


'''1.1 RECOMMENDED'''  
'''1.1 RECOMMENDED'''  
Line 132: Line 132:
When syncing, you'll be asked for a tag, lets use '''tegra-l4t-r28.2.1''' for both Kernel and uboot.
When syncing, you'll be asked for a tag, lets use '''tegra-l4t-r28.2.1''' for both Kernel and uboot.


= Kernel =
== Kernel ==


In order to compile the kernel please follow these steps
In order to compile the kernel please follow these steps


== Build Kernel ==
=== Build Kernel ===


1) Make sure you have the kernel source code and the toolchain already installed by following the instructions in these sections:
1) Make sure you have the kernel source code and the toolchain already installed by following the instructions in these sections:
Line 296: Line 296:
As an important note, kernel will be located not in a partition but in /boot on the filesystem this make easier a kernel update.
As an important note, kernel will be located not in a partition but in /boot on the filesystem this make easier a kernel update.


==Flashing the Tegra==
===Flashing the Tegra===


A USB cable is required and must be connected to the recovery port prior to running the flashing command.<br><br>
A USB cable is required and must be connected to the recovery port prior to running the flashing command.<br><br>
Line 332: Line 332:
</pre>
</pre>


== Installing DTB ==
=== Installing DTB ===


In previous versions of jetpack, updating the DTB was as easy as replacing the one in the boot folder of the boot directory and you could also just change the FDT entry in '''/boot/extlinux/extlinux.conf''' to use a different one. For Jetpack 3.1 this was changed and a separate partition is used to flash the DTB file and Nvidia says you can only update it by flashing it again using the provided '''flash''' script.  
In previous versions of jetpack, updating the DTB was as easy as replacing the one in the boot folder of the boot directory and you could also just change the FDT entry in '''/boot/extlinux/extlinux.conf''' to use a different one. For Jetpack 3.1 this was changed and a separate partition is used to flash the DTB file and Nvidia says you can only update it by flashing it again using the provided '''flash''' script.  
Line 372: Line 372:
'''NOTE:''' Use mmcblk1p1 for SDcard and mmcblk0p1 for emmc.
'''NOTE:''' Use mmcblk1p1 for SDcard and mmcblk0p1 for emmc.


=== Flash DTB from the Jetson device itself ===
==== Flash DTB from the Jetson device itself ====


You'll need to generate signed/encrypted dtb files through the flash scripts and then flash it to the kernel-dtb partition of the Jetson device.
You'll need to generate signed/encrypted dtb files through the flash scripts and then flash it to the kernel-dtb partition of the Jetson device.
Line 443: Line 443:
</pre>
</pre>


= Bootloader =
== Bootloader ==


The bootloader is a combination of NVIDIA T-Boot (nvtboot) and U-Boot. You can read about the BOOT FLOW in the [http://http.download.nvidia.com/tegra-public-appnotes/t210-nvtboot-flow.html nvtboot wiki page].  
The bootloader is a combination of NVIDIA T-Boot (nvtboot) and U-Boot. You can read about the BOOT FLOW in the [http://http.download.nvidia.com/tegra-public-appnotes/t210-nvtboot-flow.html nvtboot wiki page].  
Line 475: Line 475:
</pre>
</pre>


== Build u-boot ==
=== Build u-boot ===


1. Backup original uboot files. You see which platform you are using checking the file in $DEVDIR/jetson-tx1.conf, it says:
1. Backup original uboot files. You see which platform you are using checking the file in $DEVDIR/jetson-tx1.conf, it says:
Line 541: Line 541:
If you are attached to the serial port while flashing you should see the [http://developer.ridgerun.com/wiki/index.php?title=Jetson_TX1_serial_port_output serial port output log while flashing]
If you are attached to the serial port while flashing you should see the [http://developer.ridgerun.com/wiki/index.php?title=Jetson_TX1_serial_port_output serial port output log while flashing]


== Boot sequence ==
=== Boot sequence ===


According to the U-boot guide provided by Nvidia uboot scans booteable devices as follows:
According to the U-boot guide provided by Nvidia uboot scans booteable devices as follows:
Line 561: Line 561:
extlinux.conf is a standard text-format sysboot configuration file that contains all boot information, it is installed in /boot according to the boot method.
extlinux.conf is a standard text-format sysboot configuration file that contains all boot information, it is installed in /boot according to the boot method.


== Boot log and uboot environment ==
=== Boot log and uboot environment ===


Following [http://developer.ridgerun.com/wiki/index.php?title=Jetson_TX1_Boot_Log boot log] was obtained when connected to the serial console using the [http://developer.ridgerun.com/wiki/index.php?title=Jetson_TX1_uboot_environment default uboot environment].
Following [http://developer.ridgerun.com/wiki/index.php?title=Jetson_TX1_Boot_Log boot log] was obtained when connected to the serial console using the [http://developer.ridgerun.com/wiki/index.php?title=Jetson_TX1_uboot_environment default uboot environment].
Line 567: Line 567:
The environment is defined in extlinux.conf, however, the environment variables can be set in the uboot code directly or directly when the board is booting using the typical uboot commands like: print, saveenv, printenv, etc
The environment is defined in extlinux.conf, however, the environment variables can be set in the uboot code directly or directly when the board is booting using the typical uboot commands like: print, saveenv, printenv, etc


= Filesystem =
== Filesystem ==


Jetpack comes with a sample filesystem with X and ubuntu and Canonical keeps updating the packages available, you can also use your own filesystem. In both cases you have to install on it the Nvidia binaries, the instructions to do that are in the file Start_L4T_Docs.html, in the Getting started section. It mentions:
Jetpack comes with a sample filesystem with X and ubuntu and Canonical keeps updating the packages available, you can also use your own filesystem. In both cases you have to install on it the Nvidia binaries, the instructions to do that are in the file Start_L4T_Docs.html, in the Getting started section. It mentions:
Line 587: Line 587:
The remaining steps on this guide assumes that you are using the default filesytem or that you already have one built, specially for the flashing section, where flashing assumes that the filesystem already exists.
The remaining steps on this guide assumes that you are using the default filesytem or that you already have one built, specially for the flashing section, where flashing assumes that the filesystem already exists.


== To receive notifications of new packages ==
=== To receive notifications of new packages ===


1. Locate and edit the following file:
1. Locate and edit the following file:
Line 611: Line 611:
  $ sudo apt-get install wget
  $ sudo apt-get install wget


= Flashing the board =
== Flashing the board ==


Nvidia provides several scripts to help to generate the images and to flash the resulting images. Including if you are going to install uboot or fastboot. First the board needs to be in recovery mode and then the main script to flash it is $DEVDIR/Linux_for_Tegra_tx1/flash.sh. What this script will do is to install or flash the image in the desired destination. It is important that the script is controlled by variables defined in the DTB file.
Nvidia provides several scripts to help to generate the images and to flash the resulting images. Including if you are going to install uboot or fastboot. First the board needs to be in recovery mode and then the main script to flash it is $DEVDIR/Linux_for_Tegra_tx1/flash.sh. What this script will do is to install or flash the image in the desired destination. It is important that the script is controlled by variables defined in the DTB file.
Line 892: Line 892:
There is a [http://jetsonhacks.com/2015/12/01/serial-console-nvidia-jetson-tx1/ nice video with details].
There is a [http://jetsonhacks.com/2015/12/01/serial-console-nvidia-jetson-tx1/ nice video with details].


= References =
== References ==


<pre>
<pre>
Line 915: Line 915:
</pre>
</pre>


= Articles related =
== Links ==


:[[Compiling_Tegra_source_code_-_Jetpack_3.1 | Compiling with Jetpack 3.1]]
:[[Compiling_Tegra_source_code_-_Jetpack_3.1 | Compiling with Jetpack 3.1]]