Skip to content

Instantly share code, notes, and snippets.

@aginor
Last active August 29, 2015 14:09
Show Gist options
  • Save aginor/4f232d4c28aef7685282 to your computer and use it in GitHub Desktop.
Save aginor/4f232d4c28aef7685282 to your computer and use it in GitHub Desktop.
Patch AMD/ATI catalyst/fglrx 14.301.1001 / 14.9 or 14.501.1003 /14.12 driver to work with linux 3.17.x to 3.19.x kernels (tested on Fedora 20)

Brief summary

This is what I did to get the AMD Catalyst™ 14.9 and 14.12 Proprietary Linux x86 Display Driver, available at http://support.amd.com/en-us/download/desktop?os=Linux%20x86_64 to work with Linux 3.17.2 to 3.19.3 in Fedora 20. There's a lot of other mucking about to get the driver running the first time, but it basically boils down to not running GNOME or using GDM. A good starting point for how to sort all of this out is at https://bluehatrecord.wordpress.com/2014/11/13/installing-the-proprietary-amd-catalyst-14-9-fglrx-driver-on-fedora-20-with-kernel-3-17/.

Applying the patch

Disclaimer: This works for me, but I take no responsibility if following these instructions melt your graphics card or cause any other unfortunate events.

Step 1: Unpack the downloaded package.

$ ./amd-driver-installer-14.301.1001-x86.x86_64.run --extract

Step 2: Apply patch.

$ cd <extracted_dir>
$ patch -p1 < <path/to/3.17-3.19.patch>

Step 3: Run the installer from the extracted and patched package

For 14.9:

$ sudo ./ati-installer.sh 14.301.1001 --install

For 14.12:

$ sudo ./ati-installer.sh 14.501.1003 --install

It doesn't really seem to matter too much what the second argument is, but I suspect that it's stored in a version file somewhere, so it's probably good to give it the right argument.

Step 4: Proceed with installation as normal.

--- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-11-29 09:02:10.000000000 +1300
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-04-18 22:31:06.673656387 +1200
@@ -4816,8 +4816,13 @@
{
unsigned long orig_level;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
orig_level = __get_cpu_var(kasExecutionLevel);
__get_cpu_var(kasExecutionLevel) = level;
+#else
+ orig_level = this_cpu_read(kasExecutionLevel);
+ this_cpu_write(kasExecutionLevel,level);
+#endif
return orig_level;
}
@@ -4829,7 +4834,12 @@
*/
static unsigned long kas_GetExecutionLevel(void)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
return __get_cpu_var(kasExecutionLevel);
+#else
+ return this_cpu_read(kasExecutionLevel);
+#endif
+
}
/** \brief Type definition for kas_spin_lock() parameter */
--- a/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2014-11-29 09:02:10.000000000 +1300
+++ b/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2014-12-21 20:57:00.059831695 +1300
@@ -842,7 +842,11 @@
device = (acpi_device_adr(tdev) >> 16) & 0xffff;
if(PCI_SLOT(pdev->devfn) == device)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
tdev->flags.no_hotplug = true;
+#else
+ pdev->ignore_hotplug = true;
+#endif
}
}
#endif
@aginor
Copy link
Author

aginor commented Apr 18, 2015

Updated the gist to cover all kernel revisions between 3.17 to 3.19. Maybe I should be proactive and give it a go with 4.0 while I'm at it 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment