Tag Archives: cuda

Flashing the Jetson TK1 and installing CUDA

A few notes on flashing the Jetson TK1, in case I need to do this again…

I flashed the 21.3 version of Linux for Tegra. The first step was to download the files into a directory on a Linux system, on a Linux partition (originally, I was unpacking these in a ntfs partition shared with the Windows part of my dual boot configuration, which screwed up the permissions when unpacking – this was subtle!):

  • http://developer.download.nvidia.com/embedded/L4T/r21_Release_v3.0/Tegra124_Linux_R21.3.0_armhf.tbz2
  • http://developer.download.nvidia.com/embedded/L4T/r21_Release_v3.0/Tegra_Linux_Sample-Root-Filesystem_R21.3.0_armhf.tbz2

Then, I could roughly follow the instructions from NVIDIA. Let’s assume the two files above are in a directory called ~/reflash/ on a Linux computer (e.g. my laptop, which is running Ubuntu 12.04).

cd ~/reflash
sudo tar xpf Tegra124_Linux_R21.3.0_armhf.tbz2
cd Linux_for_Tegra/rootfs/
sudo tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R21.3.0_armhf.tbz2
cd ..
sudo ./apply_binaries.sh

Now, you have to put the Jetson in recovery mode. Connect the Jetson to your PC using the microUSB port on the Jetson, then hold the recovery button down on the Jetson and the press the Reset button once, or the Power button if it was off. The Jetson doesn’t seem to display anything to the screen when in recovery, so I wait, say, a minute to be really sure it’s in recovery. Then type ‘lsusb’ on the PC to make sure it lists a device by “Nvidia Corp.”, to ensure you can actually talk to the Jetson.

Now, the next step is to actually flash the thing, but there are a few issues:

  1. The default flashing instructions won’t use all the space available on the embedded memory (uses about 8GB instead of 16GB), which may be annoying if you need to have more toolkits installed. To use the full space, use the flag ‘-S 14580MiB ‘ (and you may have good reason not to do this – note that is the maximum you can use, as discussed on the elinux wiki).
  2. On the ubuntu version that I was running, /dev/loop0 was already being used, so the flash script failed since it is hard coded to use /dev/loop0. A neat trick I found to get this to work was to type ‘losetup –find’, which for me showed /dev/loop1 as the first available device. I thus edited flash.sh to use /dev/loop1 instead of /dev/loop0 (it was around line 440 of flash.sh)

With those 2 notes in mind, the next step on the PC was:

sudo ./flash.sh -S 14580MiB jetson-tk1 mmcblk0p1

This took about 30min, after which the Jetson will automatically reboot. The instructions say to “Reset” the board (even though it just rebooted), so I unplugged the USB cable and pressed the Reset button. The network cable was plugged into the Jetson the whole time, so when it rebooted, I had no issue logging in using ssh (checked my router status page to figure out the right IP address for ssh).

CUDA was easy to install from the instructions on elinux. I downloaded the following onto the Jetson:

  • http://developer.download.nvidia.com/embedded/L4T/r21_Release_v3.0/cuda-repo-l4t-r21.3-6-5-prod_6.5-42_armhf.deb

I actually downloaded it to my PC and scp’ed it to the Jetson.  Then I followed the instructions from elinux, and typed the following on the Jetson:

sudo dpkg -i cuda-repo-l4t-r21.3_6.5-42_armhf.deb
sudo apt-get update
sudo apt-get install cuda-toolkit-6-5
sudo usermod -a -G video $USER

I tested that CUDA installed by typing on the Jetson:

nvcc -V

and then proceeded to install the examples and compile them.