An introduction into the Tegra (boot) world

Tegra Logo

Tegra Logo

This blog post provides a big picture of the Linux Tegra OSS world. The Wikipedia article about Tegra serves well to get an overview of the Tegra SoC in general, especially from the hardware side.

Linux/Android software provided from NVidia for the Tegra processors are generally known as Linux for Tegra (L4T). Beside the Kernel and its sources, this includes proprietary driver binaries and utilities.

On the other side, today, open source projects such as Linux or U-Boot have a fairly well upstream support for Tegra too. Also thanks to the effort of NVidia providing open source code and documentation as well as pushing things upstream.

This article should provide a big picture about the boot process, available boot software and the state of upstream implementation. Its not a complete view of things, but it would have helped me learning about the Tegra world, so it might help others too :-).

First thing first: Booting. NVidia published in its application notes how booting works: The on CPU Boot ROM start on the internal AVP processor (which is an ARM7TDMI) while only having access to the internal RAM. The Boot ROM program looks up all possible start devices (eMMC/NAND..) and reads the BCT (Boot configuration table). This table mainly contains the external RAM configuration which is crucial to load more advanced boot loaders. Further, it contains the address of the bootloader inside the boot device, the target memory address to copy the bootloader to and the entry address.

Beside that, the Boot ROM also knows a boot loader state which can be used to download and run code (some boards even have a button which needs to be pressed while start-up to get in this state, altough, this button might not be assembled :-)). The Tegra device acts as a USB client and enumerates with an device ID such as 0955:7820. In order to run advanced code, the user needs to download a BCT to enable external RAM. However, in most consumer devices. such as the Ouya console, this state is protected by fuses and would need the secret encryption key. Thus customers cannot use this state to flash the device…

Linux for Tegra provides utilities to flash and boot a Tegra system:

  • nvflash – Flash utility for Tegra RCM and nv3p USB protocol
  • fastboot – Closed source NAND/eMMC bootloader
  • ..
  • U-Boot binary built form U-Boot for Chrome OS

When flashing, the utility nvflash downloads and runs a small bootloader (given by the argument –bl) which then enables the nv3p protocol. Then, the utility can send data and flash them on the given device.

The bootloader also implements the Android fastboot specification and thus can communicate with the fastboot client utility (which is well known in the Android community).

On the other hand, open source utilities exist too:

  • cbootimage – Boot image and BCT (Boot configuration table) generator
  • tegrarcm – Download utility for Tegra RCM and nv3p protocol
  • U-Boot – has Tegra 2/3/4 support including a SPL (Secondary Program Loader)

Since 2012 U-Boot has SPL support. SPL is meant to run on the internal RAM only and enable external RAM in order to load and start the full Bootloader (just like the Boot ROM). The Tegra U-Boot supports make use of SPL support by implementing a small first stage boot loader for the ARM7TDMI AVP.

The utility tegrarcm makes use of this function and downloads SPL as well as U-Boot in order to enable external RAM and run the full U-Boot version. U-Boot then can be used to flash anything (NAND/eMMC) from nearly everywhere (SD/Network/USB).

NVidia also provides proprietary and open source Linux drivers through the Linux for Tegra project. The Linux Kernel of the current L4T release (r16.4) uses the Linux Kernel 3.1 released back in 2011. This Kernel includes all the drivers needed to run the pheripherial on that SoC as well as Android drivers (and also provides Android defconfigs). However, the Tegra SoC support code didn’t made it directly to the upstream release since the quality of that does not meet the requirements of the upstream Linux Kernel. But, so far, this is still the base for most commercial products out there…

NVidia employees also develop/re-factor drivers for the upstream Linux Kernel. Nowadays the latest upstream Kernel (3.13) has good support for the Tegra 2/3/4 and the “yet-to-be-released” Tegra 5. Even 2D acceleration for Tegra 2/3 is supported. All this is using the new Device Tree bindings used in the ARM tree. Hopefully the next major Linux for Tegra release is leveraging this support and built on top of that.

Leave a Comment