Compiling Jetson TX1 source code - Jetpack 3.0
|
|
Introduction
The step by step instructions listed below was partially derived from Start_L4T_Docs.html documentation provided by NVIDIA. The steps were run on Jetson TX1.
Platform
Baseboard: P2371 Jetson module: P2180 Soc: tegra210 or tegra21x
It is assumed that the reader already read the brief Jetson TX1 introduction
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 Getting bootloader and kernel.
Getting JetPack
Check which is the most recent JetPack release.
1. Download jetpack from:
https://developer.nvidia.com/embedded/dlc/jetpack-l4t-3_0
2. Move binary into installation directory, we recommend /home/$USER/JetPack-L4T-3.0
mkdir -p $HOME/JetPack-L4T-3.0 mv JetPack-L4T-3.0-linux-x64.run $HOME/JetPack-L4T-3.0
3. Set the Jetpack binary as executable and set correct permissions.
cd $HOME/JetPack-L4T-3.0 chmod +x JetPack-L4T-3.0-linux-x64.run
4. Install Jetpack.
./JetPack-L4T-3.0-linux-x64.run
Getting bootloader and kernel
File called Start_L4T_Docs.html inside of Jetpack contains a good description of the packages that it contains. Let's call $DEVDIR the path where you installed your development directory or JetPack.
export DEVDIR=$HOME/JetPack-L4T-3.0 firefox $DEVDIR/Start_L4T_Docs.html &
1) In order to download the source code you can run the script called source_sync.sh
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1 ./source_sync.sh
This will download the bootloader and kernel.
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
Use: source_sync.sh [options] Available general options are, -h : help -e : exit on sync error -d DIR : root of source is DIR By default, all sources are downloaded. Only specified sources are downloaded, if one or more of the following options are mentioned. -k [TAG]: Download kernel source and optionally sync to TAG -u [TAG]: Download u-boot source and optionally sync to TAG
Repositories
k:kernel:nv-tegra.nvidia.com/linux-3.10.git: u:u-boot:nv-tegra.nvidia.com/3rdparty/u-boot.git:
you can see the repositories on the web looking for:
http://nv-tegra.nvidia.com/gitweb/?o=age http://nv-tegra.nvidia.com/gitweb/?p=linux-3.10.git;a=summary http://nv-tegra.nvidia.com/gitweb/?p=3rdparty/u-boot.git;a=summary
3) It will download the git repositories for kernel and uboot but you need to specify the branch or the tag
Branch:
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source git branch -a git checkout l4t/l4t-r24.2 cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/u-boot_source git branch -a git checkout l4t/l4t-r24.2
Or if you want to download a tag then the command should look like:
./source_sync.sh -k tegra-l4t-r24.2 -u tegra-l4t-r24.2
Toolchain
Linaro or code sourcery toolchain's can be used, however, it is recommended to use the Linaro toolchain because it is newer and produces more optimized assembler code
1. Download the Linaro toolchain. You need to install two toolchains, one which is the 64bits toolchain for ARM, and the 32bits toolchain for ARM as well. In this case version 5.3-2016.02 will be used:
2. Install the toolchain
sudo mkdir /opt/linaro sudo chmod -R 775 /opt/linaro sudo chown -R $USER /opt/linaro mv gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu.tar.xz /opt/linaro mv gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz /opt/linaro cd /opt/linaro tar -xf gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu.tar.xz tar -xf gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
Kernel
In order to compile the kernel please follow these steps
Build Kernel
1) Specify the path to the toolchain:
mkdir -p $DEVDIR/images/modules mkdir -p $DEVDIR/images/packages export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- export CROSS32CC=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc export KERNEL_MODULES_OUT=$DEVDIR/images/modules export ARCH=arm64
2) Create the kernel patches folder:
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/ mkdir patches cd patches
3) Create a file called 0001-arm-thumb-error-r7-cannot-be-used-in-asm.patch with the following content to avoid error: r7 cannot be used in asm here
Index: kernel_source/arch/arm64/kernel/vdso32/Makefile =================================================================== --- kernel_source.orig/arch/arm64/kernel/vdso32/Makefile 2016-04-08 21:28:52.651992663 -0600 +++ kernel_source/arch/arm64/kernel/vdso32/Makefile 2016-04-11 12:20:03.377388110 -0600 @@ -11,7 +11,7 @@ GCOV_PROFILE := n -ccflags-y := -shared -fPIC -fno-common -fno-builtin -march=armv7-a +ccflags-y := -shared -fPIC -fomit-frame-pointer -fno-common -fno-builtin -march=armv7-a ccflags-y += -nostdlib -Wl,-soname=linux-vdso32.so.1 \ $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) asflags-y := -D__VDSO32__ -s
4) Create a file called 0002-fix-logical-not-error.patch to avoid error: logical not is only applied to the left hand side of comparison with the following content:
Index: kernel_source/drivers/platform/tegra/tegra21_clocks.c =================================================================== --- kernel_source.orig/drivers/platform/tegra/tegra21_clocks.c 2016-04-08 21:28:58.755992489 -0600 +++ kernel_source/drivers/platform/tegra/tegra21_clocks.c 2016-04-11 12:49:59.561337028 -0600 @@ -1062,7 +1062,7 @@ */ static void tegra21_cpu_clk_init(struct clk *c) { - c->state = (!is_lp_cluster() == (c->u.cpu.mode == MODE_G)) ? ON : OFF; + c->state = ((!is_lp_cluster()) == (c->u.cpu.mode == MODE_G)) ? ON : OFF; } static int tegra21_cpu_clk_enable(struct clk *c)
5) Create a file called series with the following content:
0001-arm-thumb-error-r7-cannot-be-used-in-asm.patch 0002-fix-logical-not-error.patch
6) Go to the kernel_source directory and apply the patches:
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/ quilt push -a
7) Clean your kernel and configuration
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/ make mrproper
8) Configure your kernel:
This commands will set the default configuration and open a menu so you can change any of the settings if needed. If not, you can just hit exit after the menu opens.
make tegra21_defconfig make menuconfig
NOTE: You'll need ncurses for this command to work. If you have any issue just install the following packages.
sudo apt-get install libncurses5 libncurses5-dev
9) Compile kernel, device tree and modules
make zImage make dtbs make modules make modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT
10) Save your binaries in the images directory
cp arch/arm64/boot/Image arch/arm64/boot/zImage $DEVDIR/images/
11) Create kernel_supplements.tbz2 with kernel modules, this package is needed by Jetpack
cd $DEVDIR/images/modules/lib/modules/ ls .
define a variable with the name of the modules directory
export KERNEL_MODULES_NAME=3.10.96+
fix the symbolic links on the kernel modules directory
cd $DEVDIR/images/modules/lib/modules/$KERNEL_MODULES_NAME rm build source
create tarball
cd $DEVDIR/images/modules/ tar -cjf kernel_supplements.tbz2 * mv kernel_supplements.tbz2 $DEVDIR/images/packages
12) Besides creating the modules and the kernel image you need to create again your kernel_headers.tbz2 file (needed by Jetpack). By default when you patch the kernel code and you don't check your changes in the kernel will add a -dirty suffix to the release version (check ls $DEVDIR/images/modules/lib/modules/ for example). For this specific reason you need to generate your headers tarball again changing it the release version.
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel tar -xf kernel_headers.tbz2
Find the name of the headers file folder (in my case linux-headers-3.10.96-tegra):
ls | grep linux-headers linux-headers-3.10.96-tegra
export KERNEL_HEADERS_NAME=linux-headers-3.10.96-tegra
And rename the folder:
mv $KERNEL_HEADERS_NAME linux-headers-$KERNEL_MODULES_NAME tar -cjf kernel_headers_custom.tbz2 linux-headers-$KERNEL_MODULES_NAME mv kernel_headers_custom.tbz2 $DEVDIR/images/packages rm -rf linux-headers-$KERNEL_MODULES_NAME
13) Create the dtb directory
mkdir -p $DEVDIR/images/dtb cp $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/arch/arm64/boot/dts/*.dtb $DEVDIR/images/dtb/
14) Copy the Device Tree Compiler (DTC)
cp $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/scripts/dtc/dtc $DEVDIR/images/dtc
15) Create a backup of the images and packages included in Jetpack
mkdir -p $DEVDIR/images/packages-backup cp -rf $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/* $DEVDIR/images/packages-backup
16) Finally overwrite the default images with your own images to install and boot them using jetpack
cd $DEVDIR/images rm -rf $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/dtb cp -rf Image zImage packages/kernel_supplements.tbz2 dtb/ dtc $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/ cp -rf packages/kernel_headers_custom.tbz2 $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/kernel_headers.tbz2
17) Run the applybinaries script to generate the image to flash
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/ sudo ./apply_binaries.sh
Output:
Using rootfs directory of: /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs Extracting the NVIDIA user space components to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs Extracting the BSP test tools to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs Extracting the NVIDIA gst test applications to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs Extracting the configuration files for the supplied root filesystem to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs Creating a symbolic link nvgstplayer pointing to nvgstplayer-0.10 Creating a symbolic link nvgstcapture pointing to nvgstcapture-0.10 Adding symlink libcuda.so --> libcuda.so.1.1 in target rootfs Adding symlink libGL.so --> libGL.so.1 in target rootfs Adding symlink libcuda.so --> tegra/libcuda.so in target rootfs Adding symlink libEGL.so --> libEGL.so.1 in target rootfs Extracting the firmwares and kernel modules to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs Extracting the kernel headers to /usr/src in target rootfs Installing zImage into /boot in target rootfs Installing Image into /boot in target rootfs Installing the board *.dtb files into /boot in target rootfs Success!
As an important note, kernel will be located not in a partition but in /boot on the filesystem this make easier a kernel update.
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
cd $DEVDIR/64_TX1/Linux_for_Tegra_tx1/bootloader/ mv system.img.raw system.img $DEVDIR/images/packages-backup/
2. Just run Jetpack as the first time that you install it:
cd $DEVDIR ./JetPack-L4T-3.0-linux-x64.run
See the 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.
DTB
Looking into the file $DEVDIR/TX1/Linux_for_Tegra_tx1/jetson-tx1.conf the dtb used by jetson x1 is: tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb
ODMDATA=0x84000; NET_BSF=; EMMC_BSF=; EMMC_BCT=P2180_A00_LP4_DSC_204Mhz.cfg; EMMC_CFG=gnu_linux_tegraboot_emmc_full.xml; BOOTPARTSIZE=8388608; EMMCSIZE=31276924928; ITS_FILE=; SYSBOOTFILE=p2371-2180-devkit/extlinux.conf; DTB_FILE=tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb DFLT_KERNEL=Image; ROOTFSSIZE=14GiB; CMDLINE_ADD="fbcon=map:0"; UBOOT_TEXT_BASE=0x8010e000; UIMAGE_LABEL="Linux-tegra21"; target_board="t210ref"; ROOT_DEV="mmcblk0p1 ------------ internal eMMC. sda1 ----------------- external USB devices. (USB memory stick, HDD) eth0 ----------------- nfsroot via RJ45 Ethernet port. eth1 ----------------- nfsroot via USB Ethernet interface."; TEGRABOOT="bootloader/${target_board}/nvtboot.bin"; SOSFILE="bootloader/nvtboot_recovery.bin"; WB0BOOT="bootloader/${target_board}/warmboot.bin"; FLASHAPP="bootloader/tegraflash.py"; FLASHER="bootloader/${target_board}/cboot.bin"; BOOTLOADER="bootloader/${target_board}/p2371-2180/u-boot-dtb.bin"; UBOOT_WITH_TBOOT=yes; BCFFILE="bootloader/${target_board}/cfg/board_config_p2597-devkit.xml"; INITRD="bootloader/l4t_initrd.img"; TBCFILE="bootloader/nvtboot_cpu.bin"; BPFFILE="bootloader/bpmp.bin"; TOSFILE="bootloader/tos.img"; EKSFILE="bootloader/eks.img"; FBFILE="bootloader/reserved_fb.xml";
Bootloader
The bootloader is a combination of NVIDIA T-Boot (nvtboot) and U-Boot. You can read about the BOOT FLOW in the nvtboot wiki page.
According to the devtalk forum there are two ways to boot the board: fast boot and uboot
- Fastboot is simpler, and offers no options during boot. It strictly looks for a kernel in the GPT partition from the install's "-k 6" option. This would probably be the way to go for a non-interactive embedded appliance (if not bare metal booting).
- U-boot offers more options, and looks for a zImage in the /boot partition. Boot configuration can also be edited here, for example I threw in a couple of zImage variants (like debugging version and network options added), and edited extlinux.conf...and magically I can boot to any of those kernels at the serial console boot prompt (provided my eye is fast). No flash was required for any kernel beyond the first kernel.
Inside of the bootloader directory you will find several binaries or components, to get a description of these please read the nvtboot wiki page.
Build DTC
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
*** Your dtc is too old, please upgrade to dtc 1.4 or newer $DEVDIR/images/dtc -v Version: DTC 1.2.0-g37c0b6a0
In order to build it please run:
cd $DEVDIR/TX1/Linux_for_Tegra_tx1/sources git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git cd dtc make cp dtc $DEVDIR/images/
Build u-boot
1. Backup original uboot files. You see which platform you are using checking the file in $DEVDIR/TX1/Linux_for_Tegra_tx1/jetson-tx1.conf, it says:
SYSBOOTFILE=p2371-2180-devkit/extlinux.conf;
copy the files to the packages-backup directory
mkdir $DEVDIR/images/packages-backup/bootloader/ cp -rf $DEVDIR/TX1/Linux_for_Tegra_tx1/bootloader/t210ref/p2371-2180-devkit $DEVDIR/images/packages-backup/bootloader/ cd $DEVDIR/TX1/Linux_for_Tegra_tx1/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 $DEVDIR/images/packages-backup/bootloader/ cp $DEVDIR/TX1/Linux_for_Tegra_tx1/bootloader/t210ref/p2371-2180 $DEVDIR/images/packages-backup/bootloader/
Check that all these components are flashed in one partition according to Jetpack output when flashing Jetson TX1. The description of each of these components in on the t210-nvtboot-flow and 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
cd $DEVDIR/TX1/Linux_for_Tegra_tx1/sources/u-boot_source/ PATH=$DEVDIR/images:$PATH export CROSS_COMPILE=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- export ARCH=arm64
3. Clean and compile
make distclean make p2371-2180_defconfig make
4. Save your new binaries
mkdir $DEVDIR/images/bootloader cp $DEVDIR/TX1/Linux_for_Tegra_tx1/sources/u-boot_source/u-boot{,.bin,.dtb,-dtb.bin} $DEVDIR/images/bootloader
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.
5. Now, copy your u-boot binaries to the directory used by Jetpack to look for them. As you can see in the DTB it will look for them in
target_board="t210ref"; BOOTLOADER="bootloader/${target_board}/p2371-2180/u-boot-dtb.bin";
To copy the files run
cp $DEVDIR/images/bootloader/u-boot{,.bin,.dtb,-dtb.bin} $DEVDIR/TX1/Linux_for_Tegra_tx1/bootloader/t210ref/p2371-2180/
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
U-Boot 2015.07-rc2 (Apr 28 2016 - 19:24:09 -0600)
If you are attached to the serial port while flashing you should see the serial port output log while flashing
Boot sequence
According to the U-boot guide provided by Nvidia uboot scans booteable devices as follows:
- External SD Card
- Internal eMMC
- USB Device
- NFS Device
It looks for an extlinux.conf configuration file in the following directory of the bootable device:
<rootfs>/boot/extlinux
Upon finding the extlinux.conf file, U-Boot does the following.
- Uses the sysboot command to read out boot configuration from extlinux.conf,
- Loads kernel Image file and device tree file (/boot), and then
- Boots the kernel.
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
Following boot log was obtained when connected to the serial console using the 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
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:
Extract the sample file system to the rootfs directory with this command:
$ sudo tar jxpf ../../Tegra-Linux-Sample-Root-Filesystem_<release_type>.tbz2
Run the apply_binaries.sh script to copy the NVIDIA user space libraries into the target file system:
$ cd .. $ sudo ./apply_binaries.sh
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 the apply_binaries.sh script installs the binaries correctly, the last message output from the script is “Success!”.
You can create your own ubuntu filesystem using .deb packages as sources following this instructions. The sample filesystem provided is a 32 bits filesystem, however, the kernel is a 64bits kernel. According to devtalk nvidia will be releasing a 64bits filesystem.
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
1. Locate and edit the following file:
/etc/apt/sources.list
2. Add the following line:
deb http://ports.ubuntu.com/ubuntu-ports <distribution>-updates main universe
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:
deb http://ports.ubuntu.com/ubuntu-ports trusty-updates main universe
Prerequisite
You have attached an Ethernet cable to the device through either the Ethernet port (if available) or through the USB Ethernet adapter. To install more packages
- Boot the target device.
- Verify your Ethernet connection.
- Update the package list by executing:
$ sudo apt-get update
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:
$ sudo apt-get install wget
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.
# Examples: # ./flash.sh <target_board> mmcblk0p1 - boot <target_board> from eMMC # ./flash.sh <target_board> mmcblk1p1 - boot <target_board> from SDCARD # ./flash.sh <target_board> sda1 - boot <target_board> from USB device # ./flash.sh -N <IPaddr>:/nfsroot <target_board> eth0 - boot <target_board> from NFS # ./flash.sh -k LNX <target_board> mmcblk1p1 - update <target_board> kernel # ./flash.sh -k EBT <target_board> mmcblk1p1 - update <target_board> bootloader # # Optional Environment Variables: # BCTFILE ---------------- Boot control table configuration file to be used. # BOARDID ---------------- Pass boardid to override EEPROM value # BOOTLOADER ------------- Bootloader binary to be flashed # BOOTPARTLIMIT ---------- GPT data limit. (== Max BCT size + PPT size) # BOOTPARTSIZE ----------- Total eMMC HW boot partition size. # CFGFILE ---------------- Partition table configuration file to be used. # CMDLINE ---------------- Target cmdline. See help for more information. # DEVSECTSIZE ------------ Device Sector size. (default = 512Byte). # DTBFILE ---------------- Device Tree file to be used. # EMMCSIZE --------------- Size of target device eMMC (boot0+boot1+user). # FLASHAPP --------------- Flash application running in host machine. # FLASHER ---------------- Flash server running in target machine. # IGNOREFASTBOOTCMDLINE -- Block fastboot from filling unspecified kernel # cmdline parameters with its defaults. # INITRD ----------------- Initrd image file to be flashed. # ITSFILE ---------------- Multi image u-boot package template file. # KERNEL_IMAGE ----------- Linux kernel zImage file to be flashed. # MTS -------------------- MTS file name such as mts_si. # MTSPREBOOT ------------- MTS preboot file name such as mts_preboot_si. # NFSARGS ---------------- Static Network assignments. # <C-ipa>:<S-ipa>:<G-ipa>:<netmask> # NFSROOT ---------------- NFSROOT i.e. <my IP addr>:/exported/rootfs_dir. # ODMDATA ---------------- Odmdata to be used. # ROOTFSSIZE ------------- Linux RootFS size (internal emmc/nand only). # ROOTFS_DIR ------------- Linux RootFS directory name. # TEGRABOOT -------------- lowerlayer bootloader such as nvtboot.bin. # UBOOTSCRIPT ------------ U-boot HUSH boot script file. # UBOOT_TEXT_BASE -------- U-boot Image Load Address. # UIMAGE_LABEL ----------- Kernel version for U-boot image header. # UIMAGE_NAME ------------ uImage file name. # WB0BOOT ---------------- Warmboot code such as nvtbootwb0.bin
Recovery mode
To put the board into force USB Recovery Mode:
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. 2. Connect the Micro-B plug on the USB cable to the Recovery (USB Micro-B) Port on the device and the other end to an available USB port on the host PC. 3. Connect the power adapter to the device. 4. Press POWER button 5. Press and hold the RECOVERY FORCE (REC) button. 6. While pressing the RECOVERY FORCE button, press and release the RESET button. 7. Wait 2 seconds and release the RECOVERY FORCE button
All remaining examples assume that the board is in recovery mode
Flash filesystem
Emmc
To flash the filesystem in the emmc you need to run:
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/ sudo ./flash.sh jetson-tx1 mmcblk0p1
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 here.
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
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)
2) Format the USB drive in your PCB
umount /dev/sdb1 sudo mkfs.ext4 /dev/sdb1
3) Copy the filesystem to the USB drive. It takes a while, its size is normally 2.4GB
mkdir $DEVDIR/images/fs sudo mount /dev/sdb1 $DEVDIR/images/fs cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/rootfs/ sudo cp -a * $DEVDIR/images/fs && sync
4) Unmount the USB drive and remove it
sudo umount $DEVDIR/images/fs
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:
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/ sudo ./flash.sh jetson-tx1 sda1 #it can be other mount point
SD card
Similar to USB but you need to replace the extlinux.conf so before copying the filesystem into the SD card run:
sudo cp $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader/t210ref/p2371-2180-devkit/extlinux.conf.sdcard $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/rootfs/boot/extlinux/extlinux.conf
then flash it
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/ sudo ./flash.sh jetson-tx1 mmcblk1p1
NFS
1) First you need to set up your NFS server using these instructions.
2) Open file in $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/rootfs/etc/network/interfaces and add
auto eth0 iface eth0 inet manual
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
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/ MY_IPADDRESS=192.169.0.3 sudo ./flash.sh -N $MY_IPADDRESS:$DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/rootfs jetson-tx1 eth0
Flash kernel
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
sudo cp $DEVDIR/images/zImage $DEVDIR/images/Image $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/rootfs/boot/
if you are not booting from NFS then you need to reflash your filesysm 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.
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/ sudo ./apply_binaries.sh
then flash your filesystem again.
Flash bootloader
Update the content of the EBT partition where uboot is located
cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/ sudo ./flash.sh -k EBT jetson-tx1 mmcblk1p1
Serial Console
J21 contains the Serial Console signals as can be seen in the pin out header. Basically:
J21 Pin 8 (UART 1 TXD) -> Cable RXD J21 Pin 10 (UART 1 RXD) -> Cable TXD TX1 J21 Pin 9 (GND) -> Cable GND
There is a nice video with details.
References
https://devtalk.nvidia.com/default/topic/929186/jetson-tx1/jetson-tx1-kernel-compilation/ https://devtalk.nvidia.com/default/topic/762653/?comment=4654303 https://devtalk.nvidia.com/default/topic/901677/building-tx1-kernel-from-source/?offset=17 https://devtalk.nvidia.com/default/topic/760180/newbie-building-l4t-from-source-which-branch-tag-/ https://wiki.ubuntu.com/ARM/RootfsFromScratch https://devtalk.nvidia.com/default/topic/929186/jetson-tx1/jetson-tx1-kernel-compilation/post/4854603/#4854603 https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here https://devtalk.nvidia.com/default/topic/914941/jetson-tx1/custom-kernel-compilations/post/4799773/#4799773 https://devtalk.nvidia.com/default/topic/914941/jetson-tx1/custom-kernel-compilations/2 https://devtalk.nvidia.com/default/topic/897280/jetson-tx1/jetson-tx1-with-l4t-23-1-doesn-t-support-native-aarch64-binaries-/post/4732697/#4732697 http://elinux.org/Jetson_TX1 https://devtalk.nvidia.com/default/topic/901677/jetson-tx1/building-tx1-kernel-from-source/post/4749509/#4749509 https://devtalk.nvidia.com/default/topic/905345/jetson-tx1/built-tx1-u-boot-from-source/ http://http.download.nvidia.com/tegra-public-appnotes/tegra-boot-flow.html https://devtalk.nvidia.com/default/topic/820035/?comment=4494578 http://http.download.nvidia.com/tegra-public-appnotes/index.html https://devtalk.nvidia.com/default/topic/781056/jetson-tk1-boot-from-nfs-system-hangs-up-during-services-boot/?offset=3 https://devtalk.nvidia.com/default/topic/744908/jetson-tk1/jetson-tk1-boot-over-nfs/
- Compiling latest Jetpack
- Gstreamer pipelines for Tegra X1
- Compile gstreamer on Jetson TX1 and TX2
- Tegra X1
- TX1 Additional documentation
For direct inquiries, please refer to the contact information available on our Contact page. Alternatively, you may complete and submit the form provided at the same link. We will respond to your request at our earliest opportunity.
Links to RidgeRun Resources and RidgeRun Artificial Intelligence Solutions can be found in the footer below.