Jump to content

Compiling Jetson TX1/TX2 source code: Difference between revisions

no edit summary
No edit summary
Line 21: Line 21:


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_Tegra_X1_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_Tegra_X1_source_code#Getting_bootloader_and_kernel|Getting bootloader and kernel]].
= Toolchain =
1. You can download the official NVIDIA toolchain for JetPack 3.2.1:
*[https://developer.nvidia.com/embedded/dlc/l4t-gcc-toolchain-64-bit-28-2-ga GCC 4.8.5 Tool Chain for 64-bit BSP]
Other toolchain versions can be found in [https://developer.nvidia.com/embedded/downloads#?search=tool%20chain this link].
2. Install the toolchain
<pre>
sudo mkdir /opt/l4t-gcc-toolchain-64-bit-28-2.1
sudo chown $USER:$USER /opt/l4t-gcc-toolchain-64-bit-28-2.1
cd /opt/l4t-gcc-toolchain-64-bit-28-2.1
wget https://developer.nvidia.com/embedded/dlc/l4t-gcc-toolchain-64-bit-28-2-ga
tar -xvf gcc-4.8.5-aarch64.tgz
</pre>


== Getting JetPack ==
== Getting JetPack ==
Line 81: Line 98:


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.
= Toolchain =
1. You can download the official NVIDIA toolchain for JetPack 3.2.1:
*[https://developer.nvidia.com/embedded/dlc/l4t-gcc-toolchain-64-bit-28-2-ga GCC 4.8.5 Tool Chain for 64-bit BSP]
Other toolchain versions can be found in [https://developer.nvidia.com/embedded/downloads#?search=tool%20chain this link].
2. Install the toolchain
<pre>
sudo mkdir /opt/l4t-gcc-toolchain-64-bit-28-2.1
sudo chown $USER:$USER /opt/l4t-gcc-toolchain-64-bit-28-2.1
cd /opt/l4t-gcc-toolchain-64-bit-28-2.1
wget https://developer.nvidia.com/embedded/dlc/l4t-gcc-toolchain-64-bit-28-2-ga
tar -xvf gcc-4.8.5-aarch64.tgz
</pre>


= Kernel =
= Kernel =
Line 114: Line 114:
<pre>
<pre>
mkdir -p $DEVDIR/images/modules  
mkdir -p $DEVDIR/images/modules  
mkdir -p $DEVDIR/images/packages  
mkdir -p $DEVDIR/images/packages
mkdir -p $DEVDIR/images/dtb
export CROSS_COMPILE=/opt/l4t-gcc-toolchain-64-bit-28-2.1/install/bin/aarch64-unknown-linux-gnu-
export CROSS_COMPILE=/opt/l4t-gcc-toolchain-64-bit-28-2.1/install/bin/aarch64-unknown-linux-gnu-
export KERNEL_MODULES_OUT=$DEVDIR/images/modules
export KERNEL_MODULES_OUT=$DEVDIR/images/modules
Line 262: Line 263:
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 TX2==
==Flashing the Tegra==


For loading the bootloader and the kernel on the eMMC, it's necessary flashing and booting the target Tegra device. 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>
To flash the target Tegra device:
To flash the target Tegra device:


Line 284: Line 285:
'''c.''' Copy ''Image'' and ''zImage'' located in the '''Linux_for_Tegra/images/arch/arm64/boot/''' directory to the '''Linux_for_Tegra/kernel''' directory.
'''c.''' Copy ''Image'' and ''zImage'' located in the '''Linux_for_Tegra/images/arch/arm64/boot/''' directory to the '''Linux_for_Tegra/kernel''' directory.


'''d.''' Run the following command from '''$DEVDIR":
'''d.''' Copy the modules from '''Linux_for_Tegra/images/modules/lib/modules/4.4.38/''' to '''Linux_for_Tegra/rootfs/lib/modules/4.4.38'''
 
'''e.''' Run the following command from '''$DEVDIR":
 
If you are using microSD and eMMC:
<pre>
<pre>
sudo ./flash.sh -r -d kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb -K kernel/Image jetson-tx2 mmcblk1p1
sudo ./flash.sh -r -d kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb -K kernel/Image jetson-tx2 mmcblk1p1
</pre>
</pre>


===Alternative Flash Option===
And if you are using a only the eMMC:
 
You can also copy the modules from '''Linux_for_Tegra/images/modules/lib/modules/4.4.38/''' to '''Linux_for_Tegra/rootfs/lib/modules/4.4.38''' and run:
<pre>
<pre>
sudo ./flash.sh -r -d kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb -K kernel/Image jetson-tx2 mmcblk0p1
sudo ./flash.sh -r -d kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb -K kernel/Image jetson-tx2 mmcblk0p1
</pre>
</pre>
== Flash your image with Jetpack ==
You can flash your image with Jetpack now instead of using the scripts directly, however this takes time (around 10min) because we will need jetpack generating the system.img again
1. Backup your system.img
<pre>
cd $DEVDIR/bootloader/
mv system.img.raw system.img $DEVDIR/images/packages-backup/
</pre>
2. Just run Jetpack as the first time that you install it:
<pre>
cd $DEVDIR/../../
JetPack-L4T-3.2-linux-x64_b196.run
</pre>
See the [https://developer.ridgerun.com/wiki/index.php?title=Jetpack_output_when_flashing_Tegra_X1 Jetpack output while flashing]
It will notice that everything is already build and will install your new images. If you have problems detecting the IP address wait like 2 minutes and it will give you the option to enter it manually. Username and password: ubuntu. You can see the ipaddress connecting a keyboard, mouse and monitor to the board at this point since ubuntu would be already booted.


== Installing DTB ==
== Installing DTB ==
932

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.