Difference between revisions of "Tegra/Mainline SW/Nouveau"

From eLinux.org
Jump to: navigation, search
(Created page with "== 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 a...")
 
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Nouveau Support on Jetson TK1 ==
+
= 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.
+
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.
  
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.
+
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.
  
The GPU in Jetson TK1 is called GK20A and will be referred as such throughout this document.
+
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.
  
== Kernel and Nouveau Module ==
+
== Flashing Upstream U-boot ==
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.
+
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.
  
=== Kernel ===
+
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.
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:
+
== 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.
  
mkdir build-tegra
+
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!
cd build-tegra
 
  
Select the Tegra configuration and cross-compile the kernel and modules (adapt the CROSS_COMPILE parameter to match your cross-compiler):
+
== 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.
  
make -j4 -C .. ARCH=arm O=`pwd` CROSS_COMPILE=arm-none-eabi- tegra_defconfig dtbs zImage modules
+
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.
  
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:
+
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.
  
cp arch/arm/boot/zImage arch/arm/boot/dts/tegra124-* /path/to/jetson/root/boot
+
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.
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 ==
 
 
 
=== libdrm ===
 
 
 
=== Mesa ===
 
All the needed patches are already in Mesa, horray!
 
 
 
=== Wayland/Weston ===
 
Wayland:
 
 
 
Checkout the '1.5' branch from git://anongit.freedesktop.org/wayland/wayland
 
 
 
Weston:
 
 
 
 
 
=== 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!
 

Latest revision as of 02:57, 5 November 2014

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.