HOWTO: Nouveau - Open source 3d drivers for nvidia graphic cards
Updated 2011-10-18
Ubuntu 10.04 or later required
Intro
Nouveau is a project which aims at producing Open Source 3D drivers for nVidia cards. In this tutorial I would like to explain how to compile and install latest version of nouveau drivers.
You can find nouveau developement news and chat with other nouveau users at phoronix.
This guide is meant for people who would like to test the latest nouveau 3D drivers (if you are interested only in 2D driver, it would be safer to just use stable drivers that can be installed from ubuntu repository or install the latest version from xorg-edgers ppa). As these drivers are not considered 100% stable yet, this guide is targeted at advanced users.
To have a better vision of what to expect from nouveau drivers take a look at feature matrix (some nvidia chip code names can be found here. Also "lspci | grep VGA" can be used to find out the codename).
Part A: Removing nvidia drivers
- Uninstall it
- If you installed the drivers using ubuntu official repository:
Code:sudo apt-get --purge remove nvidia-glx-* nvidia-settings- If you used nvidia installer from nvidia website(replace VERSION with nvidia driver version!):
Code:sudo sh NVIDIA-Linux-x86-VERSION-pkg1.run --uninstall- Save all the important things you were working on, switch to virtual console by pressing by pressing Ctrl+Alt+F1 (you can switch back by pressing Ctrl+Alt+F7), login and stop gnome display manager
Code:sudo service gdm stop- Run the following command to generate xorg.conf file
Code:sudo Xorg -configure- Copy the generated file to /etc/X11
Code:sudo cp xorg.conf /etc/X11- Open the file with nano editor
Code:sudo nano /etc/X11/xorg.conf- Search for Driver "nvidia" line in Device section (editor's search functionality can be activated by pressing Ctrl+W) and if you can find it replace it with Driver "nouveau" and press Ctrl+O and Ctrl+X to save and exit.
- Restart computer.
Code:sudo reboot
Part B: Installing DRM kernel modules
- First of all, to compile latest DRM modules kernel version requirements should be fulfilled. Take a look at this Makefile(first 3 lines) to find out the required kernel version (for example, if it states "VERSION = 3", "PATCHLEVEL = 1" & "SUBLEVEL = 0" kernel version 3.1.0 is required).
- Once you know the required kernel version, download needed packages depending on your architecture (32bit or 64bit) (you can find your architecture by running uname -m - if it replies i686, you are running 32bit ubuntu, otherwise if it says x86_64, you are running 64bit version) from this page:
- 32bit:
- linux-headers-***_i386.deb
- linux-headers-***_all.deb
- linux-image-***_i386.deb
- 64bit:
- linux-headers-***_amd64.deb
- linux-headers-***_all.deb
- linux-image-***_amd64.deb
- After installing the kernel restart to boot the newly installed kernel
- Now we have two options
- to clone whole nouveau kernel repository which takes really a lot of time even with high speed i-net connection and requires git installation (--depth 1 is used to avoid downloading history)
Code:sudo apt-get install git-core git clone --depth 1 git://anongit.freedesktop.org/nouveau/linux-2.6 master- or just download daily snapshot which should be pretty fast
Code:wget http://people.freedesktop.org/~pq/nouveau-drm/master.tar.gz- If you downloaded the daily snapshot, you can use the following command to unpack it, otherwise just skip to next step
Code:tar -xzvf master.tar.gz- Enter master/drivers/gpu/drm/nouveau directory
Code:cd master/drivers/gpu/drm/nouveau- Exchange Makefile in the directory with one that will be used to compile the modules
Code:mv Makefile Makefile.orig wget -O Makefile "http://cgit.freedesktop.org/nouveau/linux-2.6/plain/nouveau/Makefile?h=master-compat"- Compile the modules
Code:NOUVEAUROOTDIR=../../../.. make- Install them
Code:sudo make install NOUVEAUROOTDIR=../../../..- Go back to the directory you downloaded the source code
Code:cd ../../../../..
Part C: Installing libdrm
- Dependency installation
Code:sudo apt-get install git-core autoconf libtool libpthread-stubs0-dev libpciaccess-dev- Download libdrm sources
Code:git clone git://anongit.freedesktop.org/git/mesa/drm/- Enter drm directory
Code:cd drm- Run autogeneration and configuration scripts with some flags (libdir flag is used because libdrm is installed in none standard directory in ubuntu)
Code:./autogen.sh --enable-nouveau-experimental-api --prefix=/usr --libdir=/lib --disable-intel --disable-radeon- Compile the library
Code:make- Install it
Code:sudo make install- Return to parent directory
Code:cd ..
Part D: 2D driver installation
- Dependency installation
Code:sudo apt-get install xorg-dev xutils-dev- Download the sources
Code:git clone --depth 1 git://anongit.freedesktop.org/nouveau/xf86-video-nouveau- Enter the source directory
Code:cd xf86-video-nouveau- Run autogeneration and configuration scripts
Code:./autogen.sh PKG_CONFIG_PATH=/lib/pkgconfig- Compile the drivers
Code:make- Copy the driver to /usr/lib/xorg/modules/drivers directory
Code:sudo cp src/.libs/nouveau_drv.so /usr/lib/xorg/modules/drivers- Let's tell to the system about new libraries
Code:sudo ldconfig- Back to parent directory
Code:cd ..
Part E: 3D driver installation
- More dependencies
Code:sudo apt-get install g++ libtalloc-dev bison flex- Acquire the sources
Code:git clone git://anongit.freedesktop.org/git/mesa/mesa- Enter mesa directory
Code:cd mesa- Run autogeneration and configuration scripts
Code:./autogen.sh --enable-glx-tls --disable-asm --with-dri-drivers= --with-gallium-drivers=swrast,nouveau --enable-texture-float --disable-asm --enable-opengl --disable-gles2 --disable-openvg --enable-dri --enable-glx --enable-xvmc --disable-va --disable-vdpau --disable-osmesa --disable-egl --disable-xorg --disable-d3d1x --disable-xa --disable-gbm --disable-xlib-glx --disable-gallium-egl --disable-gallium-gbm --disable-gallium-llvm --disable-xcb --enable-driglx-direct --enable-glx-tls --enable-glu PKG_CONFIG_PATH=/lib/pkgconfig- Compile the driver
Code:make PKG_CONFIG_PATH=/lib/pkgconfig- Copy the required file to /usr/lib and make a link in /usr/lib/dri
If after running "sudo ln -s /usr/lib/nouveau_dri.so /usr/lib/dri/nouveau_dri.so" you get an error saying "No such file or directory" create "dri" folder inside "/usr/lib" and try again:Code:sudo cp lib/gallium/nouveau_dri.so /usr/lib sudo ln -s /usr/lib/nouveau_dri.so /usr/lib/dri/nouveau_dri.so
Code:sudo mkdir /usr/lib/dri sudo ln -s /usr/lib/nouveau_dri.so /usr/lib/dri/nouveau_dri.so- Tell to the system about new libraries
Code:sudo ldconfig- Because in this tutorial we replaced nouveau 2D drivers that come with Ubuntu, we'll need to take additional step to make sure that the drivers we just installed are not overwritten by the ones provided by ubuntu during software update. We'll have to lock driver version with apt-get and synaptic:
- Run the following commands (to unlock package version replace "hold" with "install")
Code:echo libdrm-nouveau1 hold | sudo dpkg --set-selections echo xserver-xorg-video-nouveau hold | sudo dpkg --set-selections echo libdrm2 hold | sudo dpkg --set-selections- Use instructions in this ubuntu help tutorial to lock libdrm-nouveau1, xserver-xorg-video-nouveau and libdrm2 package versions.
- That's it. Now you can restart your pc to see if the drivers work (If something goes wrong, don't panic - just take a look at "If graphical environment doesn't start" section in Appendix). You can check if the 3D driver loaded correctly by taking a look at /var/log/Xorg.0.log
the output should be something similar to:Code:grep nouveau_dri /var/log/Xorg.0.log
Code:[ 1639.620] (II) AIGLX: Loaded and initialized /usr/lib/dri/nouveau_dri.so
Appendix: If graphical environment doesn't start
- This step is only needed if you are on wireless network and can only connect to internet when network manager applet is running. In that case you'll have to boot up ubuntu live cd and download the following deb packages for ubuntu version and architecture you have installed:
- Boot up to recovery mode of the official ubuntu kernel
- Unlock package versions which contents we have overwritten
Code:echo libdrm-nouveau1 install | sudo dpkg --set-selections echo xserver-xorg-video-nouveau install | sudo dpkg --set-selections echo libdrm2 install | sudo dpkg --set-selections- Now depending if you have downloaded the deb packages or will just be using apt-get run the following commands:
- deb package installation (replace '/directory/with deb packages' with the real path):
Code:cd '/directory/with deb packages' sudo dpkg -i *.deb- apt-get:
Code:sudo apt-get install --reinstall libdrm-nouveau1 xserver-xorg-video-nouveau libdrm2- Reboot
Code:sudo reboot- Select kernel that is provided by ubuntu developers
- Finally you can remove kernel packages you have installed when following this guide
Resources
Install Nouveau
Gallium3D How to
Nouveau FAQ
Bookmarks