Bembel-B Blog

2006/08/25

Building ATI fglrx Graphics Driver Kernel Module RPMs Based on Livna Releases

For the latest Fedora Core 5 Kernel there were no ATI fglrx drivers available in the Livna repository for many days, so I built them myself. It’s also not advised to use the driver installer provided by ATI, as this will mess up your system. This procedure should also work with the Livna NVidia drivers, I guess.

Fedora Core Logo

The funny thing is, half a day later, the long awaited RPMs were finally available in the Livna repository. But as it wasn’t all too trivial to build these RPMs for rather a beginner like me, here is what I did.

0.) Setup non-root rpmbuild environment

Don’t build as root! Be sure to have rpmdevtools RPM installed. Then as the user you want to build with, issue fedora-buildrpmtree. This will setup your rpmbuild environment including a directory ~/rpmbuild.

1.) Get the latest Livna fglrx binary, devel and source RPMs

Install Livna binaries and devel RPMs:

yum --enablerepo=livna install kmod-fglrx xorg-x11-drv-fglrx-devel

Download the matching source RPM from Livna, e.g.:

wget http://rpm.livna.org/fedora/5/SRPMS/fglrx-kmod-8.27.10-2.2.6.17_1.2157_FC5.src.rpm

2.) Adapt the source RPM to the new kernel release

Extract the source RPM using fedora-extract.

Modify the fglrx-kmod.spec file like shown in this diff:

[scheff@p512o fglrx-kmod-8.27.10-2.2.6.17_1.2174_FC5]$ diff fglrx-kmod.spec fglrx-kmod.spec.orig
7c7
< %{!?kversion: %define kversion 2.6.17-1.2174_FC5}
---
> %{!?kversion: %define kversion 2.6.17-1.2157_FC5}
13,14c13,14
< %ifarch i686 ppc athlon
< #define smpvar smp
---
> %ifarch i686 ppc
> %define smpvar smp
16c16
< %ifarch i686 x86_64 athlon
---
> %ifarch i686 x86_64
19c19
< #define kdumpvar kdump
---
> %define kdumpvar kdump
25c25
< Release:        0.%(echo %{kverrel} | tr - _)
---
> Release:        2.%(echo %{kverrel} | tr - _)
38c38
< ExclusiveArch:  i586 i686 x86_64 athlon
---
> ExclusiveArch:  i586 i686 x86_64

I changed the kernel version to the desired revision number, lowered the fglrx release number to be able to catch the official build via yum updates and enabled athlon architecture builds. Furthermore I disabled the forced building of kernel modules for smp and kdump kernels. because I don’t use them.

This was the only file, that contained the kernel version as a variable. The other files partly use uname -r, so we will have to build the modules with the corresponding kernel release running.

3.) Build the fglrx kernel module

As mentioned above, one has to be running the kernel release one wants to build for. So if you are running a different kernel now, boot the right one.

Now symlink the sources to your rpmbuild directory:

ln -s /home/scheff/src/fglrx-kmod-8.27.10-2.2.6.17_1.2174_FC5/* /home/scheff/rpmbuild/SOURCES/

To build the Athlon optimized kernel module binary RPM type:

rpmbuild -bb --target=athlon ~/rpmbuild/SOURCES/fglrx-kmod.spec

Now you could delete the symlinks in the ~/rpmbuild/SOURCES directory, to keep it clean.

That’s it. You now should have the kmod-fglrx-*.rpm in your ~/rpmbuild/RPMS/{arch} directory ready for installation.
If you are updating your running fglrx kernel module, you will have to stop the X server (# init 4), unload the fglrx kernel module (# rmmod fglrx) and then start up your X server again (# init 5).

ChangeLog

[070429 Fix minor typos. Fix some markup. Add logo image.]
[060929 Fix minor typo and markup]

Advertisements

Blog at WordPress.com.