Linux ATI/AMD drivers: How to get it to compile

As you may have noticed, AMD has stopped supporting their “older” cards, calling them all “legacy” even if your card is just a few years old. This leads to their software not compiling on newer kernels. It gave me hours of grief on Fedora 17..
I eventually got it to work, and I thought I’d publish my findings.. Here are the tips on how to get it to compile.

First download ATI/AMD drivers from their sites, run the “amd….run” file, which will eventually fail.

It might complain of several things (see /usr/share/ati/fglrx-install.log file)

1) that it cannot find version.h

For this, I had to type this command:
# ln -s /lib/modules/3.7.3-101.fc17.x86_64/build/include/generated/uapi/linux/version.h /lib/modules/3.7.3-101.fc17.x86_64/build/include/linux/version.h

Or, here is a version you can copy and paste:
ln -s /lib/modules/`uname -r`/build/include/generated/uapi/linux/version.h /lib/modules/`uname -r`/build/include/linux/version.h

Of course, edit the above line to your liking.. To find out your curent kernel version, do a “uname -a”

Now go into it source directory and attempt to compile it again..
# cd /lib/modules/fglrx/build_mod
# ./make.sh

2) That there was something wrong with “do_mmap” call.

For that, you need to patch a file, because apparently do_mmap and do_unmmap functions are renamed now. Download it here..

Save this patch file, and do a “patch < 3.5-do_mmap.patch" as root. It should just say "Hunk .. patched" or something. Iif it gives you errors, check the top 2 lines of the patch file to make sure they correspond to where you have your ATI driver source located - mine are at /lib/modules/fglrx. 3) It might still complain about VM_RESERVED

Well, VM_RESERVED went out the window with the new kernels.. Instead, edit that file that it cannot compile, and replace all the VM_RESERVED you see with this:
VM_DONTEXPAND | VM_DONTDUMP

so , for example,
vma->vm_flags |= VM_SHM | VM_RESERVED;
becomes:
vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP;

I just used gedit to do this.. About 12 changes altogether.

4) That struct dev_archdata’ has no member named ‘acpi_handle’

For this, you need a small patch, Download it here. Then do the usual thing, that is,
patch < fix-build-kernel-3.8.patch There.. that should do the trick.. Good luck. Now compile it again.. # cd /lib/modules/fglrx/build_mod
# ./make.sh
# cd ..
# ./make_install.sh

I hope the frustration leaves some hairs on your head after all this.. Next time, buy NVIDIA.

Leave a Reply