Differences between revisions 68 and 69
Revision 68 as of 2017-07-13 18:16:33
Size: 13346
Editor: ?VagrantCascadian
Comment: update to use the "none" firmware image rather than wandboard
Revision 69 as of 2019-02-09 20:37:38
Size: 14111
Editor: ?GregoryPSmith
Comment: Mention the tegra124-cpufreq requirement in order to run at full speed
Deletions are marked like this. Additions are marked like this.
Line 193: Line 193:

=== Enable cpufreq to run at full speed ===

By default the "tegra124-cpufreq" module is not loaded. This limits the system to running at 1/3 speed!

To enable cpufreq at boot time:
{{{
echo tegra124-cpufreq >>/etc/modules
}}}

To enable it manually:
{{{
modprobe tegra124-cpufreq
}}}

You can see that this has worked by looking in /proc/cpuinfo. The BogoMIPS value will increase from 24 to 80.

{{{
$ head /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 80.01
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc0f
CPU revision : 3
}}}

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-installer *may* work fine with the shipped u-boot, but booting will fail consistently (See #Known issues). 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! You need 2016.03+dfsg1 or later.

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:

cd Linux_for_Tegra19.3
sudo ./flash.sh -L /usr/lib/u-boot/jetson-tk1/u-boot-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.none.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.none.img.gz partition.img.gz > /dev/mmcblk0

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, but the two recommended options are:

  • Install everything to eMMC
  • Install to SATA with /boot on eMMC (Uboot cannot boot directly from SATA, so at least /boot must be installed on eMMC or SD).

/!\ 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)

1 (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 EXT3 filesystem (EXT4 is not read properly by uboot so will not boot). 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 it doesn't boot properly. EXT2 and EXT3 work OK. 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

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)".

Debian's kernel and the libdrm package have the required options enabled. However, the X patches are missing. This is work in progress.

Enable cpufreq to run at full speed

By default the "tegra124-cpufreq" module is not loaded. This limits the system to running at 1/3 speed!

To enable cpufreq at boot time:

echo tegra124-cpufreq >>/etc/modules

To enable it manually:

modprobe tegra124-cpufreq

You can see that this has worked by looking in /proc/cpuinfo. The BogoMIPS value will increase from 24 to 80.

$ head /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 3 (v7l)
BogoMIPS        : 80.01
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc0f
CPU revision    : 3

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.

    This is likely due to a bug in u-boot: https://bugs.debian.org/823500

  • If you use the nvidia-supplied u-boot (2014.10-rc2) to boot a kernel with CONFIG_ARM_TEGRA_DEVFREQ configured it will start booting but hang after a few seconds. Debian kernels after 4.6-1~exp2 have this option enabled which is why you can't use that nvidia uboot with Stretch. Recorded in https://bugs.debian.org/827557

Debian's u-boot 2016.03+dfsg1 or later works fine.

The characteristic last console messages are:

[   13.625987] tegra-snd-rt5640 sound: ASoC: CPU DAI (null) not registered
[   13.632660] tegra-snd-rt5640 sound: snd_soc_register_card failed (-517)

(The issue is one of power management, nothing to do with sound).

Kernel

TODO

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