Tegra/Mainline SW/Nouveau

From eLinux.org
Jump to: navigation, search

Nouveau Support on Jetson TK1

This page keeps track of Nouveau's status on Jetson TK1 and acts as a information hub for people wanting to run it on their boards.

Nouveau requires an upstream kernel and cannot be used with the L4T kernel. It also requires an up-to-date upstream version of U-boot. Setting up both is a somehow involved process ; but fortunately a couple of helper scripts greatly simplify the process.

Before proceeding, be aware that upstream Linux is less featured than L4T, and that things like video acceleration does not work at the moment. There is also no accelerated X driver (but Wayland works fine). Therefore, this procedure should really only be followed by people intending to hack on Nouveau or test it.

Flashing Upstream U-boot

Tegra's boot is a quite complex process, and flashing a bootloader is equally complicated task that involves many different tools. People interested in all the gory details can read the first 3 documents of ftp://download.nvidia.com/tegra-public-appnotes/index.html. For our purpose, which is to just get things to work, we will use the Tegra U-boot Flasher Scripts.

https://github.com/NVIDIA/tegra-uboot-flasher-scripts/blob/master/README-developer.txt contains all the instructions needed to flash an upstream U-boot on your board. Once U-boot is flashed, you will be able to access its shell by pressing a key on the serial console during the initial countdown. If you let it go, it will attempt to boot the L4T kernel that is likely still on your board, which will fail because of L4T-specific kernel options that U-boot does not provide. However, it will have no problem with upstream kernel and user-space we will be building in the next section.

Building and Flashing a Nouveau User-space

We need to replace L4T with an upstream kernel, up-to-date Nouveau kernel modules, and user-space that includes the latest Free graphics stack. Again, this looks like a lot of work, but again scripts will help us.

https://github.com/NVIDIA/tegra-nouveau-rootfs will assist us with the task of cross-compiling all the components we need and putting them together into a bootable system. It takes an Ubuntu 14.04 system image (the same basis than used for L4T), cross-compiles the Linux kernel, Nouveau modules, Free graphics stack (libdrm, Wayland, Mesa) as well as a couple of programs for us to play with (kmscube and weston). Instructions to write the system to either a SD card or the board's eMMC are also included. Just follow this page and you should be running a completely Free graphics stack on your Jetson TK1 board!

Tegra and U-boot Boot Process

As explained above, the Tegra boot process is rather complex, and with U-boot on top of it, there is no shame in not understanding how one came up to that shiny Linux prompt. This section will attempt to quickly (and roughly) demystify what happens. For plenty of details, please read ftp://download.nvidia.com/tegra-public-appnotes/index.html.

When a Tegra board is powered on, code on its boot ROM is first executed. This code includes a recovery mode (that you enter by pressing the RECOVERY and RESET buttons on your Jetson TK1) that can receive a program through USB and execute it. This program can be for instance U-boot. Since this feature is in the boot ROM, it guarantees that your board can never be bricked: you will always retain the ability to load and execute a program through that mean.

When we "flash U-boot", what happens is that U-boot is loaded into the device's memory through recovery mode, and flashes itself to the eMMC memory where the boot ROM will find it.

If recovery mode is not requested, the boot ROM will look for the bootloader on the eMMC, load it and execute it. This is when U-boot is running and displays its countdown on the serial console. You can interrupt it and use its shell, but if you just let it go it will run the bootcmd macro (which you can see as well as all other defined macros by typing printenv in the U-boot shell). This macro goes through all the different boot targets that Jetson TK1 support: SD card (mmc1), eMMC (mmc0), USB storage, network boot. If booting from a MMC device, the scan_dev_for_boot macro will look for a U-boot script image in /boot/boot.scr. This script contains more U-boot commands that will load the kernel image and device tree binary, set the kernel boot arguments, and jump to the kernel entry point. From there the kernel boots as usual, by mounting the root filesystem specified in its boot arguments, and calling the init program.