Differences between revisions 58 and 59
Revision 58 as of 2016-07-25 03:01:52
Size: 12426
Comment: Use official name for TK1
Revision 59 as of 2016-07-25 09:07:50
Size: 12427
Editor: ?GregorHerrmann
Comment: add missing space after warning icon
Deletions are marked like this. Additions are marked like this.
Line 69: Line 69:
/!\If you want to install Debian to your SD disk, make sure to obtain the netboot image. /!\ If you want to install Debian to your SD disk, make sure to obtain the netboot image.

The Jetson TK1 developer kit from NVIDIA based is based on the Tegra K1 chip (also known as Tegra 124). The Tegra K1 (codenamed "Logan") features a quad-core 32-bit ARM Cortex-A15 CPU and Kepler GPU (GK20A) with 192 CUDA cores. The Jetson TK1 can run Debian's armhf port.

Debian on Jetson TK1

Console access

Parts of this procedure require changing U-Boot environment variables. To do that you need serial console access. The board has a standard serial port so a null modem cable works if you have serial on your machine. More usually a USB-serial adaptor is needed. Use screen or minicom to communicate. For example:

screen /dev/ttyUSB0 115200

The board is set up with a 2-second pause during boot, where a character received on this console should interrupt the normal boot process and get you a U-Boot prompt.

Installing U-Boot

You have to install mainline U-Boot as the boot loader in order to run Debian on your Jetson TK1. Debian provides a precompiled U-Boot image.

/!\ Please note that U-Boot version 2014.10-rc2 from Linux For Tegra R21.4 is too old to run Debian!

In order to flash U-Boot to your Jetson, you have to put it in recovery mode:

  • Turn the device off
  • Connect the micro-B USB connector on the Jetson with the USB port on your host
  • Hold the "Force Recovery" button
  • Turn the board on (while still holding the "force recovery" button)
  • Release the button after a few seconds
  • You won't see anything on the serial console. However, lsusb on your host should show the following device: 0955:7140 NVidia Corp.

Debian provides an U-Boot image for the Jetson TK1. In order to install U-Boot from Debian, please obtain the Linux For Tegra R19.3 driver package (Tegra124_Linux_R19.3.0_armhf.tbz2) from NVIDIA's developer site.

/!\ Make sure to get version R19.3. Versions R21.1 to R21.4 can not be used to flash Debian's U-Boot (they will flash it, but the board won't boot at all).

If you're running Debian stretch, you can install the Tegra U-Boot package on your host:

sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install u-boot-tegra:armhf

If you're on an older version of Debian, you can download the package and unpack it somewhere (dpkg -x u-boot-tegra*.deb tmp).

Now flash U-Boot to your Jetson:

sudo ./flash.sh -L /usr/lib/u-boot/jetson-tk1/u-boot-dtb-tegra.bin -S 14580MiB jetson-tk1 mmcblk1p1

(Change the location of the jetson-tk1 directory if you unpacked the package manually.)

Obtaining Debian installer

You can use standard Debian installer from stretch to install Debian on your Jetson TK1 (tested with alpha7). Debian-installer from Debian stable (jessie, Debian 8) does not work because this board is not supported by that kernel.

You can choose between two installation media:

hd-media

The hd-media installation medium consists of the installer and an ISO image with some Debian packages that are to be installed. Further packages can be installed over the network during the installation.

netboot

The netboot image consists of the installer. Packages are downloaded via the network.

/!\ If you want to install Debian to your SD disk, make sure to obtain the netboot image.

Download firmware.Wandboard.img.gz and partition.img.gz.

Uncompress both files and write them to the SD card (not to a partition on the SD card but to the SD card directly. The images contain a partition layout and VFAT filesystem).

zcat firmware.Wandboard.img.gz partition.img.gz > /dev/mmcblk0

(Yes, the file is Wandboard, not TK1. We don't actually use any Wandboard specific code. We just need this file for the partition layout of the SD card.)

See the instructions for more details.

Loading Debian installer

The existing U-Boot config doesn't specify the DTB filename or the console to use for output. You need to set those two things for the installer to work:

setenv console ttyS0,115200n8
setenv fdtfile tegra124-jetson-tk1.dtb
saveenv

Now put the SD card into the Jetson and reset the board. It should just boot off the SD card. If not, you can do it manually:

run bootcmd_mmc1

or at lower level:

setenv bootargs console=${console}
load mmc 1:1 ${kernel_addr_r} /vmlinuz
load mmc 1:1 ${fdt_addr_r} /dtbs/${fdtfile}
load mmc 1:1 ${ramdisk_addr_r} /initrd.gz
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

You can also use your monitor and keyboard instead of the serial console to install Debian. Load the daily installer onto your SD card and start the installer like this:

setenv bootargs fb=false
setenv console tty1
run bootcmd_mmc1

While the easiest way to load Debian installer is with an SD card, there are instructions below on loading the installer via Ethernet.

Installing Debian

Debian installer on Jetson TK1

The installer will start and you can perform a normal installation. You can consult the installation guide for more information.

The installer will tell you that there is a missing firmware file (rtl_nic/rtl8168g-2.fw). You can safely ignore this warning and choose "no" (don't load additional firmware). The Ethernet will work fine without this firmware file.

You can install to the internal eMMC, the external SD card, or a SATA drive (or a USB stick, not covered here). The options are covered below.

/!\ Please note that the IDs of the MMC/SD cards are reversed in U-Boot and Debian:

MMC/SD

U-Boot

Debian

Internal

0 (mmc0)

0 (mmcblk1)

External

1 (mmc1)

0 (mmcblk0)

Installing to Internal flash

To install to the internal eMMC, choose the "manual" partition method instead of "guided". Look for the "APP" partition (normally /dev/mmcblk1p1) and choose that as your root device. It can be formatted with the EXT2 or EXT4 filesystem. Leave the other 7 partitions alone as they are used for things like storing the boot loader itself. Ignore the warning about not having selected a partition for swap and format the disk.

/!\ Even though the EXT4 filesystem is supposed to work, I couldn't reliable boot Debian. Switching to EXT2 solved the problem for me. YMMV (see known issues)

The board can boot directly from the eMMC device. After you finish your installation, remove the SD card, and Debian will boot from the internal flash. You can override this by putting in an external bootable SD card.

Installing to External SD

To install to the external SD, choose the guided partitioning method and select "MMC/SD card #1 (mmcblk0)" in the installer. Note that you have to use the netboot installer instead of the hd-media.

After you finish your installation, Debian will boot from the external SD card. The external SD card has preference over the internal eMMC.

Installing to SATA drive

The U-Boot boot loader cannot boot directly off the SATA disk, so /boot has to be on flash (either internal or SD card). It is best to use the internal flash so it 'just works'. The large first partition is the one formatted as a real filesystem for this (the other 7 are raw space used for various things such as the boot loader itself).

So set up the disks with /boot on /dev/mmcblk1p1 formatted as EXT2 and / (root) on /dev/sda1 (or however you wish to set up your drive).

After completing the installation you have to tell U-Boot where the root partition is, so that it can tell the kernel (it would be nice if this was automatic).

End the installation, and reboot, removing the SD card. Hit a key to stop the boot to get a U-Boot prompt and set bootargs to point to whichever partition you used for root:

Simple root on sda1:

setenv bootargs root=/dev/sda1
saveenv

Root using lvm:

setenv bootargs root=/dev/<volumegroup>/<logicalvolume>
saveenv

then reboot, and you should be done.

Running Debian on the Jetson TK1

Firmware

The Jetson TK1 requires some non-free firmware files to operate fully. Please configure Debian's non-free repository in APT and install the firmware-misc-nonfree package. This is required for the operation of:

  • GK20A graphics core (nouveau)
  • xHCI (Linux 4.7 and later)

As described above, you can ignore the warnings about missing Realtek (rtl_nic) firmware files. You can install the firmware-realtek package to get rid of the warnings if you want.

Graphics

NVIDIA ported the free nouveau driver to the Kepler GPU (GK20A) of the Tegra K1.

According to Alexandre Courbot from NVIDIA, "you need to patch X a bit for it to take advantage of Nouveau/GLamor (and also enable DRM_TEGRA_STAGING in the kernel and compile libdrm with --enable-tegra-experimental-api)".

Our libdrm package has this option enabled. I just enabled the option for the kernel (for 4.7). I'm not sure about the X patches required. This is work in progress.

Using U-Boot

You can also load the installer via Ethernet. When you boot, you'll see:

Net:   No ethernet found.

You have to run:

pci enum

Now you can load files via Ethernet. For example, you can load the installer via TFTP. Make sure to use the netboot image.

setenv serverip 192.168.1.2
setenv ipaddr 192.168.1.147
setenv bootargs console=${console}
tftpboot ${kernel_addr_r} jetson-tk1/vmlinuz
tftpboot ${fdt_addr_r} jetson-tk1/${fdtfile}
tftpboot ${ramdisk_addr_r} jetson-tk1/initrd.gz
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

Boot script

U-Boot needs a script (boot.scr) to boot. This will be installed to /boot by flash-kernel during the install process (the default script /etc/flash-kernel/bootscript/bootscr.uboot-generic is used). If for some reason you don't complete the install you need to do this step manually, by installing the flash-kernel package and running

flash-kernel

(or if need be you could edit the script to fill in the @@KERNEL_VERSION@@ variable yourself (and remove the other @@foo@@ variables) and copy it in manually)

Known issues

  • Booting from EXT4 doesn't work reliably. I used EXT4 as the filesystem for the "APP" partition and I was able to boot only once. The other times I always get a failure, mostly because U-Boot thinks some of the files are 0 bytes. When I boot into Debian installer again and inspect the files, they are not 0 byte. I need to investigate this further.

TODO

  • Provide SD card images (with the installer, maybe even U-Boot)
  • Test and document graphics
  • Explain DTB and U-Boot's distro support