Linux Kernel Preparation

DRI Compilation Guide : Linux Kernel Preparation
Previous: Prerequisites
Next: CPU Architectures

## 4. Linux Kernel Preparation

Only the Linux 2.4.x kernels are currently supported by the DRI hardware drivers. 2.5.x kernels may work, but aren't tested.

Most of the DRI drivers require AGP support and using Intel Pentium III SSE optimizations also requires an up-to-date Linux kernel. Configuring your kernel correctly is very important, as features such as SSE optimizations will be disabled if your kernel does not support them. Thus, if you have a Pentium III processor, you must configure your kernel for the Pentium III processor family.

Building a new Linux kernel can be difficult for beginners but there are resources on the Internet to help. This document assumes experience with configuring, building and installing Linux kernels.

Linux kernels can be downloaded from www.kernel.org

Here are the basic steps for kernel setup.

- Download the needed kernel and put it in /usr/src. Create a directory for the source and unpack it. For example:

                cd /usr/src
                rm -f linux
                mkdir linux-2.4.x
                ln -s linux-2.4.x linux
                bzcat linux-2.4.x.tar.bz2 | tar xf -

  It is critical that /usr/src/linux point to your new kernel sources, otherwise the kernel headers will not be used when building the DRI. This will almost certainly cause compilation problems.
- Read /usr/src/linux/Documentation/Changes. This file lists the minimum requirements for all software packages required to build the kernel. You must upgrade at least gcc, make, binutils and modutils to at least the versions specified in this file. The other packages may not be needed. If you are upgrading from Linux 2.2.x you must upgrade your modutils package for Linux 2.4.x.
- Configure your kernel. You might, for example, use `make menuconfig` and do the following:
  - Go to Code maturity level options
  - Enable Prompt for development and/or incomplete code/drivers
  - hit ESC to return to the top-level menu
  - Go to Processor type and features
  - Select your processor type from Processor Family
  - hit ESC to return to the top-level menu
  - Go to Character devices
  - Disable Direct Rendering Manager (XFree86 DRI support) since we'll use the DRI code from the XFree86/DRI tree and will compile it there.
  - Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)
  - Hit SPACE twice to build AGP support into the kernel
  - Enable all chipsets' support for AGP
  - It's recommended that you turn on MTRRs under Processor type and Features, but not required.
- Configure the rest of the kernel as required for your system (i.e. Ethernet, SCSI, etc)
- Exit, saving your kernel configuration.
- Edit your /etc/lilo.conf file. Make sure you have an image entry as follows (or similar):

                  image=/boot/vmlinuz
                        label=linux.2.4.x
                        read-only
                        root=/dev/hda1

  The important part is that you have /boot/vmlinuz without a trailing version number. If this is the first entry in your /etc/lilo.conf AND you haven't set a default, then this will be your default kernel.
- Compile the new kernel.

                cd /usr/src/linux-2.4.x
                make dep
                make bzImage
                make modules
                make modules_install
                make install

  Note that last make command will automatically run lilo for you.
- Now reboot to use the new kernel.

DRI Compilation Guide : Linux Kernel Preparation
Previous: Prerequisites
Next: CPU Architectures