NVIDIA-Prompted-Kernel-Compile
Jump to navigation
Jump to search
nVidia Graphics Driver Installation & Kernel Recompile in Slackware 12.0
Warning!
- Please do all this at your own risk. If you change your kernel and cause any damage to your system, you and only you are responsible for it. By providing this tutorial I do not take any responsibility for any damages or losses to your system. This is a disclaimer!
Background Info & Rationale for Kernel Recompile
- I recently bought a used Geforce N6200 video card (nvidia chipset) to replace the ATI Radeon 9200SE that suddenly died on me. I ran Xorg configuration utility xorgconfig to set the new card up. Slackware 12.0 ships with a generic nv driver for nvidia cards, but it does not support graphics acceleration and/or direct rendering. That means no games and no graphic heavy websites. Fortunately, nvidia provides a Linux binary driver for your video card that will do direct rendering and 3D acceleration just fine, although the driver is closed-source. But hey, at least it works.
- Assuming that you're running Slackware 12.0 and using huge generic kernel 2.6.21.5 or newer or the smp version of it, you are going to face some problems compiling the nvidia driver against that kernel. The nvidia installer utility compiles the binary driver to suit your kernel. In Slackware 12.0 the support for Riva framebuffer is enabled by default in the huge-2.6.21.5 and huge-2.6.21.5-smp kernels and it is a problem for the nvidia installer utility. As soon as it notes the riva support enabled in the kernel header files, it quits and the driver module compilation fails. Most people will experience this problem in Slackware 12.0. The solution is to disable riva framebuffer support from the kernel and recompile it.
- At the end of this tutorial you will have a fresh kernel compiled for your system, the nvidia driver compiled against this kernel and installed as kernel module and 3D graphics acceleration as well as direct rendering enabled. So let's begin taking one thing at a time.
Back Up Current Kernel & Kernel Modules
- It is important that you have a backup of your currently working kernel modules so if the new kernel fails, you would still be able to use the old kernel to boot the system. Let's play safe. Important: All steps in this tutorials are done as superuser.
cd /lib/modules ls 2.6.21.5 2.6.21.5-smp
- Above currently installed kernels on your system are listed. Rename the kernel you're using to something like kernel-name.backup. If you do not know which kernel you're using, do the following. The output of it should list the kernel you're using. Once you find it out, rename it as follows.
uname -a Linux 2.6.21.5 #1 Sun Mar 16 14:46:57 CDT 2008 i686 AMD Athlon(tm) AuthenticAMD GNU/Linux
mv 2.6.21.5 2.6.21.5-backup ls 2.6.21.5-smp 2.6.21.5-backup
Kernel Configuration and Recompile
- Now that we have a backup of our current kernel and its modules, its time to proceed with configuration and recompiling the kernel. Change to the kernel source directory and copy the current kernel config file to the kernel source directory
cd /usr/src/linux cp /boot/config .config #Note that config in /boot has no dot before it, but when we copy it, we include a dot prefix.
This step will copy your current configuration so we can use it as a reference for further steps. Now let's begin kernel configuration
make menuconfig
This should give you a nice ncurses style detailed graphical menu of kernel configuration.
Select Device Drivers > Graphics Support >
- Scroll down to Riva Framebuffer Support (not nvidia Riva Support) and press space bar twice. First space bar press will change the <M> to <*> and second will change <*> to < > (blank). Now press exit three times. The menuconfig will ask you if you want to save the changes. Select Yes and quit. We have now removed Riva Framebuffer Support from kernel configuration, the culprit for failing nvidia driver module compilation.
- It's time to compile the kernel. Do the following:
make bzImage
- This is a good time to take a break for any of these: Coffee / Tea / Cigarette / Quick run to the grocery store. In short, depending upon how fast your procesor is, this step will take anywhere between 15 minutes to an hour. If everything goes fine, it will compile a new kernel and install newly compiled modules in /lib/modules/. If you get errors, something went wrong and you'll need to get some help from kernel documentation or ask in ##slackware on IRC host freenode.net
- Now that we have a kernel compiled, its time to compile and install kernel modules
make modules && make modules_install
- Again, this step will take some time. But it will be worth the wait. In the basic kernel, there is close to 1000 modules that need to be compiled. Once this step is finished and you did not get any errors, its time to make sure the kernel bzImage was created and the modules were installed to the appropriate location.
pwd /usr/src/linux cd arch/i386/boot pwd /usr/src/linux/arch/i386/boot ls Makefile bootsect.S bzImage edd.S mtools.conf.in setup.S tools vmlinux.bin bootsect bootsect.o compressed install.sh setup setup.o video.S
- bzImage is your newly compiled kernel without Riva framebuffer support.
cd /lib/modules ls 2.6.21.5 2.6.21.5-smp 2.6.21.5-backup
The first entry above is the location of your newly installed kernel modules.
Install New Kernel And Update lilo.conf
- Time to install the new kernel and notify your boot loader of its existence.
cd /usr/src/linux/arch/i386/boot cp bzImage /boot
- Open your favorite text editor and add following lines to your boot loader (typically /etc/lilo.conf)
cd /etc emacs -nw lilo.conf
#Linux bootable partition config begins image = /boot/bzImage root = /dev/hda2 #or whatever partition your / is located on label = New-Kernel #You can name it whatever you want. Just don't name it the same as the old kernel #Linux bootable partition config ends
- Save file, close it and run lilo so the new changes take effect.
lilo Added *Linux Added *New-Kernel
- Excellent! It's time to test the new kernel. When you reboot, lilo will now present you with two choices for kernel, use the New-Kernel and boot. If somehow it fails, you can always go back to the old kernel. Just rename the /lib/modules/2.6.21.5-backup as 2.6.21.5 and rename the new kernel modules as something else. You see how important it was for us to backup the kernel as well as kernel modules in the beginning?
- Assuming that your new kernel booted just fine and you had a fully functional system back up, its time to get the nVidia graphics driver from nvidia.com and install it. The current incarnation of nVidia driver is version # 169.12. Either use your favorite browser to download the driver from http://www.nvidia.com/Download/index.aspx?lang=en-us or do the following:
cd /tmp wget http://us.download.nvidia.com/XFree86/Linux-x86/169.12/NVIDIA-Linux-x86-169.12-pkg1.run
Make the installer utility executable and execute it
chmod 755 NVIDIA-Linux-x86-169.12-pkg1.run ls -la -rwxr-xr-x 1 user groupname 17636559 2008-03-17 13:06 NVIDIA-Linux-x86-169.12-pkg1.run
Before we execute it, we need to exit the X server.
telinit 3 #This changes runlevel to 3, shuts down the X server and drops you off at the terminal sh ./NVIDIA-Linux-x86-169.12-pkg1.run
- This installer utility first tries to find a pre-compiled driver for your kernel which it would not find, then it tries to download it via ftp from nvidia servers which fails too, and finally it proceeds to compile the driver kernel module against your newly installed bzImage kernel. This time, there is no riva framebuffer in the kernel header files and so this step should not fail. Should it fail, ask for help in your local LUG or the highly knowledgeable folks at ##slackware in irc channel freenode.net
Updating X.Org Configuration File
- After the installer utility finishes compiling and installing kernel module for the nvidia driver, it will ask you if you want it to make appropriate changes to your /etc/X11/xorg.conf. I personally chose not to, because I did not want my already customized xorg.conf to be messed with by a third party software. I simply changed the driver name from nv to nvidia in the <device> section of /etc/X11/xorg.conf
- That's it folks. You now have a new kernel, new kernel modules and nvidia driver with 3D acceleration and direct rendering. Check direct rendering as follows:
glxinfo | grep dri
- Third line of the output should tell you that Direct Rendering has been enabled. Now its time to fire up X server and check your new driver.
telinit 4
- This should launch X server, you should be seeing a flash of nvidia screen and then back to your favorite window manager. If everything went fine, you should go ahead and check video performance with some game, or a graphics intensive website or such.
Acknowledgements
- This article benefited substantially by input from ##slackware (irc.freenode.net) user InspectorCluseau
- If you have any questions or if you find a mistake in this tutorial, please contact me at [1]