20,290
edits
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<seo title="NVIDIA Tegra X2 | Compiling Tegra X2 Source Code | RidgeRun" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP, Embedded Linux, Device Drivers, | <seo title="NVIDIA Tegra X2 | Compiling Tegra X2 Source Code | RidgeRun" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP, Embedded Linux, Device Drivers, NVIDIA, Jetson, TX1, TX2, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework." description="Find instructions to download Tegra source code to rebuild the Jetson TX2 images. Learn about compiling Tegra X2 source code with RidgeRun Developer."></seo> | ||
{{NVIDIA Pref Partner logo and RR Contact}} | {{NVIDIA Pref Partner logo and RR Contact}} | ||
Line 13: | Line 13: | ||
'''Platform''' | '''Platform''' | ||
< | <syntaxhighlight lang="bash"> | ||
Baseboard: | Baseboard: | ||
Jetson module: | Jetson module: | ||
Soc: | Soc: | ||
</ | </syntaxhighlight> | ||
== Download kernel code == | == Download kernel code == | ||
Line 33: | Line 33: | ||
'''1.''' In a browser, navigate to: https://developer.nvidia.com/embedded/downloads, Locate and download the L4T Sources (L4T Sources 27.1 2017/03/14). Also you can use wget command: | '''1.''' In a browser, navigate to: https://developer.nvidia.com/embedded/downloads, Locate and download the L4T Sources (L4T Sources 27.1 2017/03/14). Also you can use wget command: | ||
<syntaxhighlight lang="bash"> | |||
wget http://developer2.download.nvidia.com/embedded/L4T/r27_Release_v1.0/BSP/r27.1.0_sources.tbz2 | |||
</syntaxhighlight> | |||
'''2.''' Copy L4T kernel sources into DEVDIR. | '''2.''' Copy L4T kernel sources into DEVDIR. | ||
< | <syntaxhighlight lang="bash"> | ||
cp r27.1.0_sources.tbz2 $DEVDIR | cp r27.1.0_sources.tbz2 $DEVDIR | ||
</ | </syntaxhighlight> | ||
'''3.''' Expand the TBZ2 file. | '''3.''' Expand the TBZ2 file. | ||
< | <syntaxhighlight lang="bash"> | ||
tar -vxjf r27.1.0_sources.tbz2 | tar -vxjf r27.1.0_sources.tbz2 | ||
# Decompress kernel | # Decompress kernel | ||
sudo tar -xjf kernel_src.tbz2 | sudo tar -xjf kernel_src.tbz2 | ||
</ | </syntaxhighlight> | ||
===Option 2 Sync with git=== | ===Option 2 Sync with git=== | ||
Line 53: | Line 55: | ||
1) In order to download the source code you can run the script called source_sync.sh | 1) In order to download the source code you can run the script called source_sync.sh | ||
< | <syntaxhighlight lang="bash"> | ||
$JETPACKDIR/64_TX2/Linux_for_Tegra_64_tx2$ ./source_sync.sh | $JETPACKDIR/64_TX2/Linux_for_Tegra_64_tx2$ ./source_sync.sh | ||
</ | </syntaxhighlight> | ||
This will download the bootloader and kernel. | This will download the bootloader and kernel. | ||
Line 61: | Line 63: | ||
2) It downloads all the kernel tree but you need to specify the tag, looking into the script it seems that the tags should be specified with k and u parameters | 2) It downloads all the kernel tree but you need to specify the tag, looking into the script it seems that the tags should be specified with k and u parameters | ||
< | <syntaxhighlight lang="bash"> | ||
Use: source_sync.sh [options] | Use: source_sync.sh [options] | ||
Available general options are, | Available general options are, | ||
Line 74: | Line 76: | ||
-u [TAG]: Download u-boot source and optionally sync to TAG | -u [TAG]: Download u-boot source and optionally sync to TAG | ||
</ | </syntaxhighlight> | ||
Repositories | Repositories | ||
JetPack 3.0 by default has 4.4 kernel version, but if you go to source_sync.sh script, the kernel version is 3.10 as follows: | JetPack 3.0 by default has 4.4 kernel version, but if you go to source_sync.sh script, the kernel version is 3.10 as follows: | ||
< | |||
<syntaxhighlight lang="bash"> | |||
k:kernel:nv-tegra.nvidia.com/linux-3.10.git: | k:kernel:nv-tegra.nvidia.com/linux-3.10.git: | ||
u:u-boot:nv-tegra.nvidia.com/3rdparty/u-boot.git: | u:u-boot:nv-tegra.nvidia.com/3rdparty/u-boot.git: | ||
</ | |||
</syntaxhighlight> | |||
Change the kernel version removing the line: | Change the kernel version removing the line: | ||
< | <syntaxhighlight lang="bash"> | ||
k:kernel:nv-tegra.nvidia.com/linux-3.10.git: | k:kernel:nv-tegra.nvidia.com/linux-3.10.git: | ||
</ | </syntaxhighlight> | ||
and adding: | and adding: | ||
< | <syntaxhighlight lang="bash"> | ||
k:kernel:nv-tegra.nvidia.com/linux-4.4.git: | k:kernel:nv-tegra.nvidia.com/linux-4.4.git: | ||
</ | </syntaxhighlight> | ||
you can see the repositories on the web looking for: | you can see the repositories on the web looking for: | ||
< | <syntaxhighlight lang="bash"> | ||
http://nv-tegra.nvidia.com/gitweb/?o=age | http://nv-tegra.nvidia.com/gitweb/?o=age | ||
</ | </syntaxhighlight> | ||
kernel 4.4 and u-boot | kernel 4.4 and u-boot | ||
< | <syntaxhighlight lang="bash"> | ||
http://nv-tegra.nvidia.com/gitweb/?p=linux-4.4.git;a=summary | http://nv-tegra.nvidia.com/gitweb/?p=linux-4.4.git;a=summary | ||
http://nv-tegra.nvidia.com/gitweb/?p=3rdparty/u-boot.git;a=summary | http://nv-tegra.nvidia.com/gitweb/?p=3rdparty/u-boot.git;a=summary | ||
</ | </syntaxhighlight> | ||
3) It will download the git repositories for kernel and uboot but you need to specify the branch or the tag | 3) It will download the git repositories for kernel and uboot but you need to specify the branch or the tag | ||
Line 113: | Line 117: | ||
Branch: | Branch: | ||
< | <syntaxhighlight lang="bash"> | ||
cd $JETPACKDIR/64_TX2/Linux_for_Tegra_64_tx2/sources/kernel_source | cd $JETPACKDIR/64_TX2/Linux_for_Tegra_64_tx2/sources/kernel_source | ||
git branch -a | git branch -a | ||
Line 122: | Line 126: | ||
git checkout l4t/l4t-r27.1 | git checkout l4t/l4t-r27.1 | ||
</ | </syntaxhighlight> | ||
Or if you want to download a tag then the command should look like: | Or if you want to download a tag then the command should look like: | ||
< | <syntaxhighlight lang="bash"> | ||
./source_sync.sh -k tegra-l4t-r27.1 -u tegra-l4t-r27.1 | ./source_sync.sh -k tegra-l4t-r27.1 -u tegra-l4t-r27.1 | ||
</ | </syntaxhighlight> | ||
== Toolchain == | == Toolchain == | ||
Line 145: | Line 149: | ||
2) Decompress tarball file. | 2) Decompress tarball file. | ||
< | <syntaxhighlight lang="bash"> | ||
tar -xvf gcc-4.8.5-aarch64.tgz | tar -xvf gcc-4.8.5-aarch64.tgz | ||
</ | </syntaxhighlight> | ||
3) Install toolchain. | 3) Install toolchain. | ||
< | <syntaxhighlight lang="bash"> | ||
mkdir /opt/jetpack3.0 | mkdir /opt/jetpack3.0 | ||
cp install /opt/jetpack3.0/ -r | cp install /opt/jetpack3.0/ -r | ||
</ | </syntaxhighlight> | ||
===Option 2=== | ===Option 2=== | ||
Line 165: | Line 169: | ||
2) Decompress tarball file. | 2) Decompress tarball file. | ||
< | <syntaxhighlight lang="bash"> | ||
tar -xvf src_aarch64_gcc-4.8.5.tar | tar -xvf src_aarch64_gcc-4.8.5.tar | ||
</ | </syntaxhighlight> | ||
3) Run the toolchain building script. | 3) Run the toolchain building script. | ||
< | <syntaxhighlight lang="bash"> | ||
./make-aarch64-toolchain.sh | ./make-aarch64-toolchain.sh | ||
</ | </syntaxhighlight> | ||
4) Install the toolchain | 4) Install the toolchain | ||
< | <syntaxhighlight lang="bash"> | ||
mkdir /opt/jetpack3.0 | mkdir /opt/jetpack3.0 | ||
cp install /opt/jetpack3.0/ -r | cp install /opt/jetpack3.0/ -r | ||
</ | </syntaxhighlight> | ||
== Kernel == | == Kernel == | ||
Line 191: | Line 195: | ||
'''1.''' Specify the path to the toolchain and architecture: | '''1.''' Specify the path to the toolchain and architecture: | ||
< | |||
<syntaxhighlight lang="bash"> | |||
export CROSS_COMPILE=/opt/jetpack3.0/install/bin/aarch64-unknown-linux-gnu- | export CROSS_COMPILE=/opt/jetpack3.0/install/bin/aarch64-unknown-linux-gnu- | ||
export ARCH=arm64 | export ARCH=arm64 | ||
</ | </syntaxhighlight> | ||
'''2.''' Define and create destination directories. | '''2.''' Define and create destination directories. | ||
< | <syntaxhighlight lang="bash"> | ||
export TEGRA_KERNEL_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/images | export TEGRA_KERNEL_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/images | ||
export TEGRA_MODULES_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/modules | export TEGRA_MODULES_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/modules | ||
mkdir -p $TEGRA_KERNEL_OUT | mkdir -p $TEGRA_KERNEL_OUT | ||
mkdir -p $TEGRA_MODULES_OUT | mkdir -p $TEGRA_MODULES_OUT | ||
</ | </syntaxhighlight> | ||
'''3.''' Clean your kernel and configuration | '''3.''' Clean your kernel and configuration | ||
< | <syntaxhighlight lang="bash"> | ||
make -C kernel/kernel-4.4/ mrproper | make -C kernel/kernel-4.4/ mrproper | ||
</ | </syntaxhighlight> | ||
'''4.''' Configure your kernel | '''4.''' Configure your kernel | ||
< | <syntaxhighlight lang="bash"> | ||
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT tegra18_defconfig | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT tegra18_defconfig | ||
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT menuconfig | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT menuconfig | ||
</ | </syntaxhighlight> | ||
'''5.''' Compile kernel, device tree and modules. To speed up compilation on multiprocessor systems, use -j n, this option tells make to execute many recipes simultaneously. | '''5.''' Compile kernel, device tree and modules. To speed up compilation on multiprocessor systems, use -j n, this option tells make to execute many recipes simultaneously. | ||
< | |||
<syntaxhighlight lang="bash"> | |||
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage | ||
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT dtbs | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT dtbs | ||
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules | ||
make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT | ||
</ | </syntaxhighlight> | ||
'''6.''' Save your Images and device tree | '''6.''' Save your Images and device tree | ||
< | |||
<syntaxhighlight lang="bash"> | |||
mkdir boot | mkdir boot | ||
cp images/arch/arm64/boot/Image boot/ | cp images/arch/arm64/boot/Image boot/ | ||
cp images/arch/arm64/boot/dts/* boot/ | cp images/arch/arm64/boot/dts/* boot/ | ||
</ | </syntaxhighlight> | ||
=== Flash your Kernel image using Jetpack 3.0 root file system=== | === Flash your Kernel image using Jetpack 3.0 root file system=== | ||
'''1.''' Install jetpack 3.0: | '''1.''' Install jetpack 3.0: [[Installing_Jetpack_3.0]] | ||
'''2.''' Flash your board with Jetpack, the root file system will be on an SD card | '''2.''' Flash your board with Jetpack, the root file system will be on an SD card | ||
'''3.''' Go to Linux_for_Tegra_64_tx2 directory | '''3.''' Go to Linux_for_Tegra_64_tx2 directory | ||
< | |||
<syntaxhighlight lang="bash"> | |||
cd $JETPACKDIR/64_TX2/Linux_for_Tegra_64_tx2/ | cd $JETPACKDIR/64_TX2/Linux_for_Tegra_64_tx2/ | ||
</ | </syntaxhighlight> | ||
'''4.''' Put the board into force USB Recovery Mode: | '''4.''' Put the board into force USB Recovery Mode: | ||
< | |||
<syntaxhighlight lang="bash"> | |||
1. Power down the device. If connected, remove the AC adapter from the device. The device must be | 1. Power down the device. If connected, remove the AC adapter from the device. The device must be | ||
powered OFF, and not in a suspend or sleep state. | powered OFF, and not in a suspend or sleep state. | ||
Line 254: | Line 263: | ||
6. While pressing the RECOVERY FORCE button, press and release the RESET button. | 6. While pressing the RECOVERY FORCE button, press and release the RESET button. | ||
7. Wait 2 seconds and release the RECOVERY FORCE button | 7. Wait 2 seconds and release the RECOVERY FORCE button | ||
</ | </syntaxhighlight> | ||
'''5.''' Use ./flash.sh in order to configure TX2 board, Also this script configures jetpack rootfs to be used as SD filesystem. | '''5.''' Use ./flash.sh in order to configure TX2 board, Also this script configures jetpack rootfs to be used as SD filesystem. | ||
Execute the script as follows: | Execute the script as follows: | ||
< | <syntaxhighlight lang="bash"> | ||
sudo ./flash.sh jetson-tx2 mmcblk1p1 | sudo ./flash.sh jetson-tx2 mmcblk1p1 | ||
</ | </syntaxhighlight> | ||
'''6.''' Create ext4 partition called "rootfs". | '''6.''' Create ext4 partition called "rootfs". | ||
<syntaxhighlight lang="bash"> | |||
sudo mkfs.ext4 /dev/mmcblk0p1 -L "rootfs" | |||
</syntaxhighlight> | |||
'''7.''' Copy rootfs from jetpack 3.0 | '''7.''' Copy rootfs from jetpack 3.0 | ||
< | <syntaxhighlight lang="bash"> | ||
sudo cp -a $JETPACKDIR/64_TX2/Linux_for_Tegra_tx2/rootfs/* /media/$USER/rootfs/ | sudo cp -a $JETPACKDIR/64_TX2/Linux_for_Tegra_tx2/rootfs/* /media/$USER/rootfs/ | ||
</ | </syntaxhighlight> | ||
'''8.''' Copy kernel image, device tree, and modules. | '''8.''' Copy kernel image, device tree, and modules. | ||
< | <syntaxhighlight lang="bash"> | ||
cd $TEGRA_KERNEL_OUT | cd $TEGRA_KERNEL_OUT | ||
sudo cp -a arch/arm64/boot/Image /media/$USER/rootfs/boot/Image | sudo cp -a arch/arm64/boot/Image /media/$USER/rootfs/boot/Image | ||
Line 281: | Line 292: | ||
cd $TEGRA_MODULES_OUT | cd $TEGRA_MODULES_OUT | ||
sudo cp -a lib/* /media/$USER/rootfs/lib/ | sudo cp -a lib/* /media/$USER/rootfs/lib/ | ||
</ | </syntaxhighlight> | ||
'''9.''' Modify extlinux.conf. The Device Tree Binary (DTB) is no longer specified by default in /boot/extlinux/extlinux.conf therefore you have to set this field manually in /media/$USER/rootfs/boot/extlinux/extlinux.conf | '''9.''' Modify extlinux.conf. The Device Tree Binary (DTB) is no longer specified by default in /boot/extlinux/extlinux.conf therefore you have to set this field manually in /media/$USER/rootfs/boot/extlinux/extlinux.conf | ||
(see: http://elinux.org/Jetson/TX2_DTB) | (see: http://elinux.org/Jetson/TX2_DTB) | ||
< | <syntaxhighlight lang="bash"> | ||
TIMEOUT 30 | TIMEOUT 30 | ||
DEFAULT primary | DEFAULT primary | ||
Line 297: | Line 308: | ||
FDT /boot/tegra186-quill-p3310-1000-c03-00-base.dtb | FDT /boot/tegra186-quill-p3310-1000-c03-00-base.dtb | ||
APPEND fbcon=map:0 net.ifnames=0 console=tty0 OS=l4t console=ttyS0,115200n8 memtype=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x03100000 gpt tegraid=18.1.2.0.0 tegra_keep_boot_clocks maxcpus=6 android.kerneltype=normal androidboot.serialno=0335115020673 vpr_resize root=/dev/mmcblk1p1 rw rootwait | APPEND fbcon=map:0 net.ifnames=0 console=tty0 OS=l4t console=ttyS0,115200n8 memtype=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x03100000 gpt tegraid=18.1.2.0.0 tegra_keep_boot_clocks maxcpus=6 android.kerneltype=normal androidboot.serialno=0335115020673 vpr_resize root=/dev/mmcblk1p1 rw rootwait | ||
</ | </syntaxhighlight> | ||
'''10.''' Unmount the device and Put the SD into the tx2 board, and boot the board. | '''10.''' Unmount the device and Put the SD into the tx2 board, and boot the board. | ||
< | |||
<syntaxhighlight lang="bash"> | |||
umount /media/$USER/rootfs | umount /media/$USER/rootfs | ||
</ | </syntaxhighlight> | ||
Username and password: nvidia. You can see the ipaddress connecting a keyboard, mouse and monitor to the board at this point since ubuntu would be already booted. | Username and password: nvidia. You can see the ipaddress connecting a keyboard, mouse and monitor to the board at this point since ubuntu would be already booted. | ||
Line 310: | Line 322: | ||
Looking into the file $JETPACKDIR/64_TX2/Linux_for_Tegra_tx2/jetson-tx2.conf the dtb used by jetson x1 is: '''tegra186-a02-bpmp-quill-p3310-1000-a00-00-te770d-ucm2.dtb''' | Looking into the file $JETPACKDIR/64_TX2/Linux_for_Tegra_tx2/jetson-tx2.conf the dtb used by jetson x1 is: '''tegra186-a02-bpmp-quill-p3310-1000-a00-00-te770d-ucm2.dtb''' | ||
< | <syntaxhighlight lang="bash"> | ||
#!/bin/bash | #!/bin/bash | ||
Line 344: | Line 356: | ||
source "${LDK_DIR}/p2771-0000.conf.common"; | source "${LDK_DIR}/p2771-0000.conf.common"; | ||
</ | </syntaxhighlight> | ||
== Bootloader == | == Bootloader == | ||
Line 362: | Line 374: | ||
U-boot requires the Device Tree Compiler (dtc) which is used to compile device tree files contained in the U-Boot source tree. One version is included inside of the kernel. However, that binary is too old according to u-boot when trying to use that one | U-boot requires the Device Tree Compiler (dtc) which is used to compile device tree files contained in the U-Boot source tree. One version is included inside of the kernel. However, that binary is too old according to u-boot when trying to use that one | ||
< | <syntaxhighlight lang="bash"> | ||
*** Your dtc is too old, please upgrade to dtc 1.4 or newer | *** Your dtc is too old, please upgrade to dtc 1.4 or newer | ||
$DEVDIR/images/dtc -v | $DEVDIR/images/dtc -v | ||
Version: DTC 1.2.0-g37c0b6a0 | Version: DTC 1.2.0-g37c0b6a0 | ||
</ | </syntaxhighlight> | ||
In order to build it please run: | In order to build it please run: | ||
< | <syntaxhighlight lang="bash"> | ||
cd $JETPACKDIR/64_TX2/Linux_for_Tegra_tx2/sources | cd $JETPACKDIR/64_TX2/Linux_for_Tegra_tx2/sources | ||
git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git | git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git | ||
Line 376: | Line 388: | ||
make | make | ||
cp dtc $DEVDIR/images/ | cp dtc $DEVDIR/images/ | ||
</ | </syntaxhighlight> | ||
=== Build u-boot === | === Build u-boot === | ||
Line 382: | Line 394: | ||
1. Backup original uboot files. You see which platform you are using checking the file in $/64_TX2/Linux_for_Tegra_tx2/jetson-tx2.conf, it says: | 1. Backup original uboot files. You see which platform you are using checking the file in $/64_TX2/Linux_for_Tegra_tx2/jetson-tx2.conf, it says: | ||
< | <syntaxhighlight lang="bash"> | ||
SYSBOOTFILE=p2371-2180-devkit/extlinux.conf; | SYSBOOTFILE=p2371-2180-devkit/extlinux.conf; | ||
</ | </syntaxhighlight> | ||
copy the files to the packages-backup directory | copy the files to the packages-backup directory | ||
< | <syntaxhighlight lang="bash"> | ||
mkdir $JETPACK/images/packages-backup/bootloader/ | mkdir $JETPACK/images/packages-backup/bootloader/ | ||
cp -rf $JETPACK/64_TX2/Linux_for_Tegra_tx2/bootloader/t210ref/p2371-2180-devkit $JETPACK/images/packages-backup/bootloader/ | cp -rf $JETPACK/64_TX2/Linux_for_Tegra_tx2/bootloader/t210ref/p2371-2180-devkit $JETPACK/images/packages-backup/bootloader/ | ||
Line 394: | Line 406: | ||
cp nvtboot.bin nvtboot_cpu.bin u-boot-dtb.bin bpmp.bin warmboot.bin tos.img tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb $JETPACK/images/packages-backup/bootloader/ | cp nvtboot.bin nvtboot_cpu.bin u-boot-dtb.bin bpmp.bin warmboot.bin tos.img tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb $JETPACK/images/packages-backup/bootloader/ | ||
cp $JETPACK/64_TX2/Linux_for_Tegra_tx2/bootloader/t210ref/p2371-2180 $JETPACK/images/packages-backup/bootloader/ | cp $JETPACK/64_TX2/Linux_for_Tegra_tx2/bootloader/t210ref/p2371-2180 $JETPACK/images/packages-backup/bootloader/ | ||
</ | </syntaxhighlight> | ||
Check that all these components are flashed in one partition according to [ | Check that all these components are flashed in one partition according to [[Jetpack_output_when_flashing_Tegra_X1 Jetpack | output when flashing Tegra X1]]. The description of each of these components in on the [http://http.download.nvidia.com/tegra-public-appnotes/t210-nvtboot-flow.html t210-nvtboot-flow] and [http://http.download.nvidia.com/tegra-public-appnotes/tegra-boot-flow.html tegra-boot-flow] pages. | ||
2. Go to uboot and set environment variables. You need to export the images directory path in order to allow u-boot find the DTC | 2. Go to uboot and set environment variables. You need to export the images directory path in order to allow u-boot find the DTC | ||
< | <syntaxhighlight lang="bash"> | ||
cd $JETPACK/64_TX2/Linux_for_Tegra_tx2/sources/u-boot_source/ | cd $JETPACK/64_TX2/Linux_for_Tegra_tx2/sources/u-boot_source/ | ||
PATH=$JETPACK/images:$PATH | PATH=$JETPACK/images:$PATH | ||
export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- | export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- | ||
export ARCH=arm64 | export ARCH=arm64 | ||
</ | </syntaxhighlight> | ||
3. Clean and compile | 3. Clean and compile | ||
< | <syntaxhighlight lang="bash"> | ||
make distclean | make distclean | ||
make p2371-2180_defconfig | make p2371-2180_defconfig | ||
make | make | ||
</ | </syntaxhighlight> | ||
4. Save your new binaries | 4. Save your new binaries | ||
< | |||
<syntaxhighlight lang="bash"> | |||
mkdir $JETPACK/images/bootloader | mkdir $JETPACK/images/bootloader | ||
cp $JETPACK/64_TX2/Linux_for_Tegra_tx2/sources/u-boot_source/u-boot{,.bin,.dtb,-dtb.bin} $JETPACK/images/bootloader | cp $JETPACK/64_TX2/Linux_for_Tegra_tx2/sources/u-boot_source/u-boot{,.bin,.dtb,-dtb.bin} $JETPACK/images/bootloader | ||
</ | </syntaxhighlight> | ||
Note: L4T U-Boot does not use the kernel partition. The kernel is installed into the filesystem alongside the boot configuration file in /boot. Aside from this difference, U-Boot has the same internal eMMC partition layout as that used by cboot. | {{Ambox | ||
|type=notice | |||
|small=left | |||
|issue=Note: L4T U-Boot does not use the kernel partition. The kernel is installed into the filesystem alongside the boot configuration file in /boot. Aside from this difference, U-Boot has the same internal eMMC partition layout as that used by cboot. | |||
|style=width:unset; | |||
}} | |||
5. Now, copy your u-boot binaries to the directory used by Jetpack to look for them. As you can see in the [ | 5. Now, copy your u-boot binaries to the directory used by Jetpack to look for them. As you can see in the [[Compiling_Tegra_X1_source_code#DTB | DTB]] it will look for them in | ||
< | <syntaxhighlight lang="bash"> | ||
target_board="t210ref"; | target_board="t210ref"; | ||
BOOTLOADER="bootloader/${target_board}/p2371-2180/u-boot-dtb.bin"; | BOOTLOADER="bootloader/${target_board}/p2371-2180/u-boot-dtb.bin"; | ||
</ | </syntaxhighlight> | ||
To copy the files run | To copy the files run | ||
< | <syntaxhighlight lang="bash"> | ||
cp $JETPACK/images/bootloader/u-boot{,.bin,.dtb,-dtb.bin} $JETPACK/64_TX2/Linux_for_Tegra_tx2/bootloader/t210ref/p2371-2180/ | cp $JETPACK/images/bootloader/u-boot{,.bin,.dtb,-dtb.bin} $JETPACK/64_TX2/Linux_for_Tegra_tx2/bootloader/t210ref/p2371-2180/ | ||
</ | </syntaxhighlight> | ||
6. Now run jetpack or follow the steps below to use flash.sh and let it install the new binaries as we did with the kernel. You can check the serial console output to see that u-boot has a newer date | 6. Now run jetpack or follow the steps below to use flash.sh and let it install the new binaries as we did with the kernel. You can check the serial console output to see that u-boot has a newer date | ||
< | <syntaxhighlight lang="bash"> | ||
U-Boot 2015.07-rc2 (Apr 28 2016 - 19:24:09 -0600) | U-Boot 2015.07-rc2 (Apr 28 2016 - 19:24:09 -0600) | ||
</ | </syntaxhighlight> | ||
If you are attached to the serial port while flashing you should see the [ | If you are attached to the serial port while flashing you should see the [[Jetson_TX1_serial_port_output | serial port output log while flashing]] | ||
=== Boot sequence === | === Boot sequence === | ||
Line 453: | Line 471: | ||
It looks for an extlinux.conf configuration file in the following directory of the bootable device: | It looks for an extlinux.conf configuration file in the following directory of the bootable device: | ||
< | |||
<syntaxhighlight lang="bash"> | |||
<rootfs>/boot/extlinux | <rootfs>/boot/extlinux | ||
</ | </syntaxhighlight> | ||
Upon finding the extlinux.conf file, U-Boot does the following. | Upon finding the extlinux.conf file, U-Boot does the following. | ||
Line 466: | Line 485: | ||
=== Boot log and uboot environment === | === Boot log and uboot environment === | ||
Following [ | Following [[Jetson_TX1_Boot_Log | boot log]] was obtained when connected to the serial console using the [[Jetson_TX1_uboot_environment | default uboot environment]]. | ||
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 | ||
Line 476: | Line 495: | ||
Extract the sample file system to the rootfs directory with this command: | Extract the sample file system to the rootfs directory with this command: | ||
<syntaxhighlight lang="bash"> | |||
$ sudo tar jxpf ../../Tegra-Linux-Sample-Root-Filesystem_<release_type>.tbz2 | |||
</syntaxhighlight> | |||
Run the apply_binaries.sh script to copy the NVIDIA user space libraries into the target file system: | Run the apply_binaries.sh script to copy the NVIDIA user space libraries into the target file system: | ||
<syntaxhighlight lang="bash"> | |||
$ cd .. | |||
$ sudo ./apply_binaries.sh | |||
</syntaxhighlight> | |||
If you are using a different rootfs, or if you have already configured your rootfs, apply the NVIDIA user space libraries by setting the LDK_ROOTFS_DIR environment variable to point to your rootfs. Then run the script, as shown above, to copy the binaries into your target file system. | If you are using a different rootfs, or if you have already configured your rootfs, apply the NVIDIA user space libraries by setting the LDK_ROOTFS_DIR environment variable to point to your rootfs. Then run the script, as shown above, to copy the binaries into your target file system. | ||
Line 493: | Line 517: | ||
1. Locate and edit the following file: | 1. Locate and edit the following file: | ||
<pre> | |||
/etc/apt/sources.list | /etc/apt/sources.list | ||
</pre> | |||
2. Add the following line: | 2. Add the following line: | ||
<pre> | |||
deb http://ports.ubuntu.com/ubuntu-ports <distribution>-updates main universe | |||
</pre> | |||
Where <distribution> is the name of the Ubuntu distribution your rootfs is based on. For example, for a rootfs based on the Trusty Tahr distribution of Ubuntu, add the line: | Where <distribution> is the name of the Ubuntu distribution your rootfs is based on. For example, for a rootfs based on the Trusty Tahr distribution of Ubuntu, add the line: | ||
<pre> | |||
deb http://ports.ubuntu.com/ubuntu-ports trusty-updates main universe | |||
</pre> | |||
Prerequisite | Prerequisite | ||
Line 509: | Line 542: | ||
*Verify your Ethernet connection. | *Verify your Ethernet connection. | ||
*Update the package list by executing: | *Update the package list by executing: | ||
Note: Ensure that you run sudo apt-get update and not apt-get upgrade, which upgrades already installed packages. Do not confuse the two commands. | <syntaxhighlight lang="bash"> | ||
$ sudo apt-get update | |||
</syntaxhighlight> | |||
{{ambox | |||
| type = content | |||
| small = left | |||
| text = Note: Ensure that you run sudo apt-get update and not apt-get upgrade, which upgrades already installed packages. Do not confuse the two commands. | |||
*Install packages using apt-get. For example, to install wget execute this command: | *Install packages using apt-get. For example, to install wget execute this command: | ||
| style=width:unset; | |||
}} | |||
<syntaxhighlight lang="bash"> | |||
$ sudo apt-get install wget | |||
</syntaxhighlight> | |||
== 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 $JETPACK/64_TX2/Linux_for_Tegra_tx2/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. | |||
< | <syntaxhighlight lang="bash"> | ||
# Examples: | # Examples: | ||
# ./flash.sh <target_board> mmcblk0p1 - boot <target_board> from eMMC | # ./flash.sh <target_board> mmcblk0p1 - boot <target_board> from eMMC | ||
Line 559: | Line 604: | ||
# UIMAGE_NAME ------------ uImage file name. | # UIMAGE_NAME ------------ uImage file name. | ||
# WB0BOOT ---------------- Warmboot code such as nvtbootwb0.bin | # WB0BOOT ---------------- Warmboot code such as nvtbootwb0.bin | ||
</ | </syntaxhighlight> | ||
=== Recovery mode === | === Recovery mode === | ||
To put the board into force USB Recovery Mode: | To put the board into force USB Recovery Mode: | ||
<pre> | <pre> | ||
1. Power down the device. If connected, remove the AC adapter from the device. The device must be | 1. Power down the device. If connected, remove the AC adapter from the device. The device must be | ||
Line 582: | Line 628: | ||
==== Emmc ==== | ==== Emmc ==== | ||
To flash the filesystem in the emmc you need to run: | To flash the filesystem in the emmc you need to run: | ||
< | |||
<syntaxhighlight lang="bash"> | |||
cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | ||
sudo ./flash.sh jetson-tx2 mmcblk0p1 | sudo ./flash.sh jetson-tx2 mmcblk0p1 | ||
</ | </syntaxhighlight> | ||
==== USB ==== | ==== USB ==== | ||
'''Important:''' Only for USB tegra needs a firmware that is loaded from the filesystem so the USB port is not enabled on uboot and then it causes problems to mount the fs from there, you can read about it [https://devtalk.nvidia.com/default/topic/933850/jetson-tx1/tx1-boot-from-usb/?offset=2#4871443 | |||
{{ambox | |||
| type = content | |||
| small = left | |||
| text = '''Important:''' Only for USB tegra needs a firmware that is loaded from the filesystem so the USB port is not enabled on uboot and then it causes problems to mount the fs from there, you can read about it NVIDIA document on [https://devtalk.nvidia.com/default/topic/933850/jetson-tx1/tx1-boot-from-usb/?offset=2#4871443 TX1 Boot from USB]. | |||
| style=width:unset; | |||
}} | |||
To flash the filesystem to USB you need to put the filesystem on the USB first | To flash the filesystem to USB you need to put the filesystem on the USB first | ||
1) Insert your USB flash/drive in your PC and check where it was mounted | 1) Insert your USB flash/drive in your PC and check where it was mounted | ||
< | |||
<syntaxhighlight lang="bash"> | |||
mount | mount | ||
/dev/sdb1 on /media/dsoto/EF02-5626 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2) | /dev/sdb1 on /media/dsoto/EF02-5626 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2) | ||
</ | </syntaxhighlight> | ||
2) Format the USB drive in your PCB | 2) Format the USB drive in your PCB | ||
< | |||
<syntaxhighlight lang="bash"> | |||
umount /dev/sdb1 | umount /dev/sdb1 | ||
sudo mkfs.ext4 /dev/sdb1 | sudo mkfs.ext4 /dev/sdb1 | ||
</ | </syntaxhighlight> | ||
3) Copy the filesystem to the USB drive. It takes a while, its size is normally 2.4GB | 3) Copy the filesystem to the USB drive. It takes a while, its size is normally 2.4GB | ||
< | |||
<syntaxhighlight lang="bash"> | |||
mkdir $JETPACK/images/fs | mkdir $JETPACK/images/fs | ||
sudo mount /dev/sdb1 $JETPACK/images/fs | sudo mount /dev/sdb1 $JETPACK/images/fs | ||
cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/ | cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/ | ||
sudo cp -a * $JETPACK/images/fs && sync | sudo cp -a * $JETPACK/images/fs && sync | ||
</ | </syntaxhighlight> | ||
4) Unmount the USB drive and remove it | 4) Unmount the USB drive and remove it | ||
< | |||
<syntaxhighlight lang="bash"> | |||
sudo umount $JETPACK/images/fs | sudo umount $JETPACK/images/fs | ||
</ | </syntaxhighlight> | ||
5) Finally connect the USB drive to the Jetson board put the Jetson on recovery mode, flash the board to look for the filesystem on the USB port: | 5) Finally connect the USB drive to the Jetson board put the Jetson on recovery mode, flash the board to look for the filesystem on the USB port: | ||
< | |||
<syntaxhighlight lang="bash"> | |||
cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | ||
sudo ./flash.sh jetson-tx2 sda1 #it can be other mount point | sudo ./flash.sh jetson-tx2 sda1 #it can be other mount point | ||
</ | </syntaxhighlight> | ||
==== SD card ==== | ==== SD card ==== | ||
Similar to USB but you need to replace the extlinux.conf so before copying the filesystem into the SD card run: | Similar to USB but you need to replace the extlinux.conf so before copying the filesystem into the SD card run: | ||
< | |||
<syntaxhighlight lang="bash"> | |||
sudo cp $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/bootloader/t210ref/p2371-2180-devkit/extlinux.conf.sdcard $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/boot/extlinux/extlinux.conf | sudo cp $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/bootloader/t210ref/p2371-2180-devkit/extlinux.conf.sdcard $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/boot/extlinux/extlinux.conf | ||
</ | </syntaxhighlight> | ||
then flash it | then flash it | ||
< | <syntaxhighlight lang="bash"> | ||
cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | ||
sudo ./flash.sh jetson-tx2 mmcblk1p1 | sudo ./flash.sh jetson-tx2 mmcblk1p1 | ||
</ | </syntaxhighlight> | ||
==== NFS ==== | ==== NFS ==== | ||
1) First you need to set up your NFS server using [ | 1) First you need to set up your NFS server using [[Getting_Started_Guide_for_DM8168_EVM#Setting_up_an_NFS_server | these instructions]]. | ||
2) Open file in $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/etc/network/interfaces and add | 2) Open file in $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/etc/network/interfaces and add | ||
< | |||
<syntaxhighlight lang="bash"> | |||
auto eth0 | auto eth0 | ||
iface eth0 inet manual | iface eth0 inet manual | ||
</ | </syntaxhighlight> | ||
3) Then flash the board to generate and install the initrd image to use nfs, you need to do this everytime that you recompile the kernel | 3) Then flash the board to generate and install the initrd image to use nfs, you need to do this everytime that you recompile the kernel | ||
< | <syntaxhighlight lang="bash"> | ||
cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | ||
MY_IPADDRESS=192.169.0.3 | MY_IPADDRESS=192.169.0.3 | ||
sudo ./flash.sh -N $MY_IPADDRESS:$JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs jetson-tx2 eth0 | sudo ./flash.sh -N $MY_IPADDRESS:$JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs jetson-tx2 eth0 | ||
</ | </syntaxhighlight> | ||
=== Flash kernel === | === Flash kernel === | ||
Line 653: | Line 718: | ||
To flash your kernel you just need to copy it to /boot in your filesystem. The old method to flash it in the LNX partition (./flash.sh -k LNX <target_board> mmcblk1p1) is NOT longer used | To flash your kernel you just need to copy it to /boot in your filesystem. The old method to flash it in the LNX partition (./flash.sh -k LNX <target_board> mmcblk1p1) is NOT longer used | ||
< | <syntaxhighlight lang="bash"> | ||
sudo cp $JETPACK/images/zImage $JETPACK/images/Image $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/boot/ | sudo cp $JETPACK/images/zImage $JETPACK/images/Image $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/rootfs/boot/ | ||
</ | </syntaxhighlight> | ||
if you are not booting from NFS then you need to reflash your filesystem in order to update the kernel. However, likely you did some changes in the kernel modules so it is recommended to run the apply_binaries.sh script instead of only copying the kernel images. | if you are not booting from NFS then you need to reflash your filesystem in order to update the kernel. However, likely you did some changes in the kernel modules so it is recommended to run the apply_binaries.sh script instead of only copying the kernel images. | ||
< | <syntaxhighlight lang="bash"> | ||
cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | ||
sudo ./apply_binaries.sh | sudo ./apply_binaries.sh | ||
</ | </syntaxhighlight> | ||
then flash your filesystem again. | then flash your filesystem again. | ||
Line 670: | Line 735: | ||
Update the content of the EBT partition where uboot is located | Update the content of the EBT partition where uboot is located | ||
< | <syntaxhighlight lang="bash"> | ||
cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | cd $JETPACK/64_TX2/Linux_for_Tegra_64_tx2/ | ||
sudo ./flash.sh -k EBT jetson-tx2 mmcblk1p1 | sudo ./flash.sh -k EBT jetson-tx2 mmcblk1p1 | ||
</ | </syntaxhighlight> | ||
== Serial Console == | == Serial Console == | ||
Line 679: | Line 744: | ||
J21 contains the Serial Console signals as can be seen in the [http://jetsonhacks.com/nvidia-jetson-tx1-j21-header-pinout/ pin out header]. Basically: | J21 contains the Serial Console signals as can be seen in the [http://jetsonhacks.com/nvidia-jetson-tx1-j21-header-pinout/ pin out header]. Basically: | ||
< | <syntaxhighlight lang="bash"> | ||
J21 Pin 8 (UART 1 TXD) -> Cable RXD | J21 Pin 8 (UART 1 TXD) -> Cable RXD | ||
J21 Pin 10 (UART 1 RXD) -> Cable TXD | J21 Pin 10 (UART 1 RXD) -> Cable TXD | ||
TX2 J21 Pin 9 (GND) -> Cable GND | TX2 J21 Pin 9 (GND) -> Cable GND | ||
</ | </syntaxhighlight> | ||
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]. |