Tegra/Mainline SW/Nouveau

Nouveau Support on Jetson TK1
This page keeps track of Nouveau's status on Jetson TK1 and acts as a kind of tutorial to get things running.

Note that Nouveau requires an upstream kernel to work and cannot be used with the L4T kernel. Going through this document will replace your L4T kernel with an upstream one, which may impact your board's usability as upstream kernels are currently less-featured. Due to the current reduced functionality of using Nouveau on Jetson TK1, this should really only be followed by people intending to hack on Nouveau or test it.

Note that as of now, there is no X.org support. All the instructions of this document are for setting up DRM, Mesa and Wayland.

The GPU in Jetson TK1 is called GK20A and will be referred as such throughout this document.

U-boot
Compile and install the 'master' branch of git://git.denx.de/u-boot-tegra.git. An essential patch (df3443dfa4) is required for the GPU to initialize properly and it has not reached mainline yet.

Kernel and Nouveau Module
Although the goal is to have all the necessary support in the upstream kernel, a few patches are still on their way there and therefore you will need to use custom Linux kernel and Nouveau modules branches.

Kernel
Most of the kernel patches have been merged for 3.17, but a few are still pending, hopefully not for too long. Checkout the 'drm' branch of https://github.com/Gnurou/linux.git. It has just a handful of commits on top of the current -rc.

From the kernel root, create a build directory and go into it:

mkdir build-tegra cd build-tegra

Select the Tegra configuration and cross-compile the kernel and modules (adapt the CROSS_COMPILE parameter to match your cross-compiler):

make -j4 -C .. ARCH=arm O=`pwd` CROSS_COMPILE=arm-none-eabi- tegra_defconfig dtbs zImage modules

Now install the kernel and modules. Mount the root partition of your Jetson TK1 (if you are booting off eMMC, run "ums 0 mmc 0" from U-boot to make it appear as a USB storage device) and adapt the following lines so the mount directory matches:

cp arch/arm/boot/zImage arch/arm/boot/dts/tegra124-* /path/to/jetson/root/boot make -C .. ARCH=arm O=`pwd` CROSS_COMPILE=arm-none-eabi- INSTALL_MOD_PATH=/path/to/jetson/root modules_install

Nouveau Kernel Module
The version of Nouveau in the kernel still lacks a few patches to allow GK20A to be used.

Checkout the 'gk20a' branch of https://github.com/Gnurou/nouveau.git. Then compile the modules against your Linux tree:

cd nouveau/drm make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- O=/path/to/kernel/source/build-tegra M=$PWD -C /path/to/kernel/source modules

Mount your Jetson TK1 root partition again, and install the modules:

make ARCH=arm CROSS_COMPILE=arm-none-eabi- O=/path/to/kernel/source/build-tegra M=$PWD INSTALL_MOD_PATH=/path/to/jetson/root -C /path/to/kernel/source modules_install

NVIDIA GK20A Firmware
GK20A's firmware should eventually end in linux-firmware, but until it is the case you will need to find or extract the 4 firmware files nvea_fuc409c, nvea_fuc409d, nvea_fuc41ac and nvea_fuc41ad. These files are still not officially distributed.

Put the 4 firmware files into /lib/firmware/nouveau of your Jetson TK1 root.

After the kernel, Nouveau modules, and firmware have been installed, you can boot your Jetson: the nouveau module should load successfully despite a few errors in the kernel log. To confirm, check that /dev/dri/renderD128 exists. If it does, the Nouveau module is correctly loaded!

User-space
We will compile all the required projects on the Jetson board. It takes more time, but is easier to achieve than cross-compilation. Make sure a compilation toolchain (gcc, autotools, etc.) is installed.

We will install all needed programs and libraries into $HOME/usr to avoid overwriting anything on the system. So first let's create an environment file for when we want to use Nouveau stuff, in e.g. ~/nouveau-env.sh:

NVD=$HOME/usr LD_LIBRARY_PATH=$NVD/lib PKG_CONFIG_PATH=$NVD/lib/pkgconfig/:$NVD/share/pkgconfig/ ACLOCAL="aclocal -I $NVD/share/aclocal" export NVD LD_LIBRARY_PATH PKG_CONFIG_PATH ACLOCAL export PATH="$NVD/bin:$PATH"

You can source this file before doing Nouveau-related work, or better, add the following to your ~/.bashrc:

source ~/nouveau-env.sh

Now with this environment properly set up, let's compile all needed libraries and programs.

libdrm
Some patches on top of mainline are still needed. Get the 'gk20a' branch of https://github.com/Gnurou/drm.git, then compile and install as follows:

./autogen.sh --prefix=$NVD --enable-tegra-experimental-api make -j4 make install

Wayland
Wayland must be installed prior to Mesa so its Wayland support can be included.

Checkout the 'master' branch (commit 5bed9e46e7 is known to work) from git://anongit.freedesktop.org/wayland/wayland, then compile and install:

./autogen.sh --prefix=$NVD --disable-documentation make -j4 make install

Mesa
All the needed patches are already in upstream Mesa, horray! But they will not be released until Mesa 10.3. So by the meantime, you will need to compile Mesa from source.

Checkout the 'master' branch (commit f2338c8f3 is known to work) of git://anongit.freedesktop.org/mesa/mesa, then compile as follows:

./autogen.sh --without-dri-drivers --with-gallium-drivers=nouveau --enable-gallium-egl --enable-gbm --enable-egl --with-egl-platforms=drm,wayland --enable-gles1 --enable-gles2 --enable-opengl --prefix=$NVD make -j4 make install

Weston
Checkout the baserock/james/weston branch of git://git.baserock.org/delta/weston.git. Then:

mkdir m4 ./autogen.sh --prefix=$NVD make -j4 sudo make install

You should now be able to run Weston. Make sure you have a keyboard and mouse connected, as it won't run through serial, and start Weston:

weston-launch

You should now see the Weston desktop and be able to run programs!

X.org
No X.org support for now - sorry!

Enabling Reclocking
Reclocking support is enabled in the kernel, but to support it from user-space the Nouveau module needs to be loaded with a parameter. Paste the following:

options nouveau pstate=1

into /etc/modprobe.d/nouveau.conf and reboot for effect. The pstate file should appear in /sys/devices/soc0/57000000.gpu/. Use cat to list the possible values, and echo 0f to it to max the GPU frequency if needed!