summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorVi0L02015-11-09 20:45:46 +0100
committerVi0L02015-11-09 20:45:46 +0100
commit7566f4f49cafe3405a9cc9b04c098938f3b5a94d (patch)
treec9b8189b138400a75e60510ae62b7cb79d13533c
parent52556ab70c9a6830fc91886f8a39dcc3cddf55a8 (diff)
downloadaur-7566f4f49cafe3405a9cc9b04c098938f3b5a94d.tar.gz
added 4.2 and 4.3 kernel support
-rw-r--r--.SRCINFO35
-rw-r--r--4.2-fglrx-has_fpu.patch20
-rw-r--r--4.2-kolasa-fpu_save_init.patch34
-rw-r--r--4.3-gentoo-mtrr.patch27
-rw-r--r--4.3-kolasa-seq_printf.patch16
-rw-r--r--PKGBUILD54
-rw-r--r--a-ac-aticonfig6
-rw-r--r--a-lid-aticonfig4
-rwxr-xr-xati-powermode.sh106
-rw-r--r--atieventsd.service2
-rwxr-xr-xcatalyst_build_module2
-rw-r--r--kolasa_4.0-cr4-strn.patch70
-rw-r--r--kolasa_4.1_remove-IRQF_DISABLED-15.7-v2.patch15
-rw-r--r--ubuntu_buildfix_kernel_4.0.patch39
-rw-r--r--ubuntu_buildfix_kernel_4.1.patch29
-rw-r--r--ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch60
-rw-r--r--ubuntu_buildfix_kernel_4.2.patch114
17 files changed, 525 insertions, 108 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 90fa79e11bc..ee894601876 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = catalyst-firepro
pkgdesc = AMD/ATI beta drivers for FirePro/GL/MV brand cards. catalyst-hook + catalyst-utils + lib32-catalyst-utils + experimental powerXpress suppport.
pkgver = 14.502.1040
- pkgrel = 1
+ pkgrel = 2
url = http://www.amd.com
install = catalyst-firepro.install
arch = i686
@@ -9,7 +9,7 @@ pkgbase = catalyst-firepro
license = custom
makedepends = unzip
depends = linux>=3.0
- depends = linux<4.2
+ depends = linux<4.4
depends = linux-headers
depends = xorg-server>=1.7.0
depends = xorg-server<1.17.0
@@ -24,6 +24,7 @@ pkgbase = catalyst-firepro
depends = patch
depends = libxinerama
depends = mesa>=10.1.0-4
+ depends = gcc49
optdepends = qt4: to run ATi Catalyst Control Center (amdcccle)
optdepends = libxxf86vm: to run ATi Catalyst Control Center (amdcccle)
optdepends = opencl-headers: headers necessary for OpenCL development
@@ -60,6 +61,9 @@ pkgbase = catalyst-firepro
source = catalyst.sh
source = atieventsd.sh
source = atieventsd.service
+ source = ati-powermode.sh
+ source = a-ac-aticonfig
+ source = a-lid-aticonfig
source = catalyst.conf
source = arch-fglrx-authatieventsd_new.patch
source = hook-fglrx
@@ -78,14 +82,23 @@ pkgbase = catalyst-firepro
source = fglrx_gpl_symbol.patch
source = fglrx_3.17rc6-no_hotplug.patch
source = kolasa-3.19-get_cpu_var.patch
- source = kolasa_4.0-cr4-strn.patch
- source = kolasa_4.1_remove-IRQF_DISABLED-15.7-v2.patch
+ source = ubuntu_buildfix_kernel_4.0.patch
+ source = ubuntu_buildfix_kernel_4.1.patch
+ source = ubuntu_buildfix_kernel_4.2.patch
+ source = 4.2-fglrx-has_fpu.patch
+ source = 4.2-kolasa-fpu_save_init.patch
+ source = ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
+ source = 4.3-kolasa-seq_printf.patch
+ source = 4.3-gentoo-mtrr.patch
md5sums = 37d01238c76792592bfbc77c11dfa9fc
- md5sums = 601d9c756571dd79d26944e54827631e
+ md5sums = f3aaed0084725304cf607f6915e4bfee
md5sums = af7fb8ee4fc96fd54c5b483e33dc71c4
md5sums = bdafe749e046bfddee2d1c5e90eabd83
md5sums = 9d9ea496eadf7e883d56723d65e96edf
- md5sums = 90a37e010f4e5f45e270cd000894d553
+ md5sums = b79e144932616221f6d01c4b05dc9306
+ md5sums = 514899437eb209a1d4670df991cdfc10
+ md5sums = 80fdfbff93d96a1dfca2c7f684be8cc1
+ md5sums = 9054786e08cf3ea2a549fe22d7f2cd92
md5sums = 3e19c2285c76f4cb92108435a1e9c302
md5sums = b3ceefeb97c609037845f65d0956c4f0
md5sums = 9126e1ef0c724f8b57d3ac0fe77efe2f
@@ -104,8 +117,14 @@ pkgbase = catalyst-firepro
md5sums = ef97fc080ce7e5a275fe0c372bc2a418
md5sums = 67a22f624bae95a76638ce269392cb01
md5sums = 3aa45013515b724a71bbd8e01f98ad99
- md5sums = dee3df1c5d3ed87363f4304da917fc00
- md5sums = daa56baca90f473cf1831f6c64e35c2c
+ md5sums = 40aaf97acae268f8f7949e0fecb926d9
+ md5sums = 982451bcc1fa1ee3da53ffa481d65581
+ md5sums = 88832af8d6769aa51fa9b266a74394e0
+ md5sums = ed7748a593d6b894269f8c7856b7ae50
+ md5sums = dd51495a1d8f2d1042f04a783bf01e08
+ md5sums = 2f7d42fde403a1b4a22e5db8de738d0f
+ md5sums = 0e0666e95d1d590a7a83192805679485
+ md5sums = 98828e3eeaec2b3795e584883cc1b746
pkgname = catalyst-firepro
diff --git a/4.2-fglrx-has_fpu.patch b/4.2-fglrx-has_fpu.patch
new file mode 100644
index 00000000000..173ec888dc7
--- /dev/null
+++ b/4.2-fglrx-has_fpu.patch
@@ -0,0 +1,20 @@
+--- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-07-04 16:31:23.000000000 +0200
++++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-08-21 15:26:44.860536831 +0200
+@@ -6475,6 +6475,7 @@
+ */
+ struct task_struct *cur_task = current;
+ preempt_disable();
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+ /* The thread structure is changed with the commit below for kernel 3.3:
+ * https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8
+@@ -6483,6 +6484,9 @@
+ #else
+ if (cur_task->thread.has_fpu)
+ #endif
++#else
++ if (cur_task->thread.fpu.fpregs_active)
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+ KCL_fpu_save_init(cur_task);
+ #else
diff --git a/4.2-kolasa-fpu_save_init.patch b/4.2-kolasa-fpu_save_init.patch
new file mode 100644
index 00000000000..6d2e4e70c0f
--- /dev/null
+++ b/4.2-kolasa-fpu_save_init.patch
@@ -0,0 +1,34 @@
+--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-20 18:29:19.488890309 +0200
++++ 15.9b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-20 14:20:51.000000000 +0200
+@@ -6505,11 +6505,15 @@
+ struct task_struct *cur_task = get_current();
+ preempt_disable();
+ if (cur_thread->status & TS_USEDFPU)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
++ copy_fpregs_to_fpstate(&cur_task->thread.fpu);
++#else
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+ KCL_fpu_save_init(cur_task);
+ #else
+ __save_init_fpu(cur_task);
+ #endif
++#endif
+ else
+ clts();
+
+@@ -6531,11 +6535,15 @@
+ #else
+ if (cur_task->thread.fpu.fpregs_active)
+ #endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
++ copy_fpregs_to_fpstate(&cur_task->thread.fpu);
++#else
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+ KCL_fpu_save_init(cur_task);
+ #else
+ __save_init_fpu(cur_task);
+ #endif
++#endif
+ else
+ clts();
+ #endif
diff --git a/4.3-gentoo-mtrr.patch b/4.3-gentoo-mtrr.patch
new file mode 100644
index 00000000000..86d7ffc3cc2
--- /dev/null
+++ b/4.3-gentoo-mtrr.patch
@@ -0,0 +1,27 @@
+--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200
++++ 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-03 19:00:09.121884973 +0100
+@@ -3412,7 +3412,11 @@
+ int ATI_API_CALL KCL_MEM_MTRR_AddRegionWc(unsigned long base, unsigned long size)
+ {
+ #ifdef CONFIG_MTRR
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ return arch_phys_wc_add(base, size);
++#else
+ return mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1);
++#endif
+ #else /* !CONFIG_MTRR */
+ return -EPERM;
+ #endif /* !CONFIG_MTRR */
+@@ -3421,7 +3425,12 @@
+ int ATI_API_CALL KCL_MEM_MTRR_DeleteRegion(int reg, unsigned long base, unsigned long size)
+ {
+ #ifdef CONFIG_MTRR
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ arch_phys_wc_del(reg);
++ return reg;
++#else
+ return mtrr_del(reg, base, size);
++#endif
+ #else /* !CONFIG_MTRR */
+ return -EPERM;
+ #endif /* !CONFIG_MTRR */
diff --git a/4.3-kolasa-seq_printf.patch b/4.3-kolasa-seq_printf.patch
new file mode 100644
index 00000000000..6cd08a93aca
--- /dev/null
+++ b/4.3-kolasa-seq_printf.patch
@@ -0,0 +1,16 @@
+--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200
++++ 15.9b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-02 21:02:06.124639919 +0100
+@@ -623,8 +623,13 @@
+
+ len = snprintf(buf, request, "%d\n", major);
+ #else
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ seq_printf(m, "%d\n", major);
++ len = 0;
++#else
+ len = seq_printf(m, "%d\n", major);
+ #endif
++#endif
+
+ KCL_DEBUG1(FN_FIREGL_PROC, "return len=%i\n",len);
+
diff --git a/PKGBUILD b/PKGBUILD
index b9a27a75132..6b340a2c72a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -25,13 +25,13 @@
pkgname=catalyst-firepro
pkgver=14.502.1040
-pkgrel=1
+pkgrel=2
pkgdesc="AMD/ATI beta drivers for FirePro/GL/MV brand cards. catalyst-hook + catalyst-utils + lib32-catalyst-utils + experimental powerXpress suppport."
arch=('i686' 'x86_64')
url="http://www.amd.com"
license=('custom')
options=('staticlibs' 'libtool' '!strip' '!upx')
-depends=('linux>=3.0' 'linux<4.2' 'linux-headers' 'xorg-server>=1.7.0' 'xorg-server<1.17.0' 'libxrandr' 'libsm' 'fontconfig' 'libxcursor' 'libxi' 'gcc-libs' 'gcc>4.0.0' 'make' 'patch' 'libxinerama' 'mesa>=10.1.0-4')
+depends=('linux>=3.0' 'linux<4.4' 'linux-headers' 'xorg-server>=1.7.0' 'xorg-server<1.17.0' 'libxrandr' 'libsm' 'fontconfig' 'libxcursor' 'libxi' 'gcc-libs' 'gcc>4.0.0' 'make' 'patch' 'libxinerama' 'mesa>=10.1.0-4' 'gcc49')
makedepends=('unzip')
optdepends=('qt4: to run ATi Catalyst Control Center (amdcccle)'
'libxxf86vm: to run ATi Catalyst Control Center (amdcccle)'
@@ -66,6 +66,9 @@ source=(
catalyst.sh
atieventsd.sh
atieventsd.service
+ ati-powermode.sh
+ a-ac-aticonfig
+ a-lid-aticonfig
catalyst.conf
arch-fglrx-authatieventsd_new.patch
hook-fglrx
@@ -84,15 +87,24 @@ source=(
fglrx_gpl_symbol.patch
fglrx_3.17rc6-no_hotplug.patch
kolasa-3.19-get_cpu_var.patch
- kolasa_4.0-cr4-strn.patch
- kolasa_4.1_remove-IRQF_DISABLED-15.7-v2.patch)
+ ubuntu_buildfix_kernel_4.0.patch
+ ubuntu_buildfix_kernel_4.1.patch
+ ubuntu_buildfix_kernel_4.2.patch
+ 4.2-fglrx-has_fpu.patch
+ 4.2-kolasa-fpu_save_init.patch
+ ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
+ 4.3-kolasa-seq_printf.patch
+ 4.3-gentoo-mtrr.patch)
md5sums=('37d01238c76792592bfbc77c11dfa9fc'
- '601d9c756571dd79d26944e54827631e'
+ 'f3aaed0084725304cf607f6915e4bfee'
'af7fb8ee4fc96fd54c5b483e33dc71c4'
'bdafe749e046bfddee2d1c5e90eabd83'
'9d9ea496eadf7e883d56723d65e96edf'
- '90a37e010f4e5f45e270cd000894d553'
+ 'b79e144932616221f6d01c4b05dc9306'
+ '514899437eb209a1d4670df991cdfc10'
+ '80fdfbff93d96a1dfca2c7f684be8cc1'
+ '9054786e08cf3ea2a549fe22d7f2cd92'
'3e19c2285c76f4cb92108435a1e9c302'
'b3ceefeb97c609037845f65d0956c4f0'
'9126e1ef0c724f8b57d3ac0fe77efe2f'
@@ -111,8 +123,14 @@ md5sums=('37d01238c76792592bfbc77c11dfa9fc'
'ef97fc080ce7e5a275fe0c372bc2a418'
'67a22f624bae95a76638ce269392cb01'
'3aa45013515b724a71bbd8e01f98ad99'
- 'dee3df1c5d3ed87363f4304da917fc00'
- 'daa56baca90f473cf1831f6c64e35c2c')
+ '40aaf97acae268f8f7949e0fecb926d9'
+ '982451bcc1fa1ee3da53ffa481d65581'
+ '88832af8d6769aa51fa9b266a74394e0'
+ 'ed7748a593d6b894269f8c7856b7ae50'
+ 'dd51495a1d8f2d1042f04a783bf01e08'
+ '2f7d42fde403a1b4a22e5db8de738d0f'
+ '0e0666e95d1d590a7a83192805679485'
+ '98828e3eeaec2b3795e584883cc1b746')
@@ -245,9 +263,13 @@ package() {
install -m644 usr/share/applications/*.desktop ${pkgdir}/usr/share/applications
# ACPI example files
- install -m755 usr/share/doc/fglrx/examples/etc/acpi/*.sh ${pkgdir}/etc/acpi
- sed -i -e "s/usr\/X11R6/usr/g" ${pkgdir}/etc/acpi/ati-powermode.sh
- install -m644 usr/share/doc/fglrx/examples/etc/acpi/events/* ${pkgdir}/etc/acpi/events
+# install -m755 usr/share/doc/fglrx/examples/etc/acpi/*.sh ${pkgdir}/etc/acpi
+# sed -i -e "s/usr\/X11R6/usr/g" ${pkgdir}/etc/acpi/ati-powermode.sh
+# install -m644 usr/share/doc/fglrx/examples/etc/acpi/events/* ${pkgdir}/etc/acpi/events
+ # lets check our own files - V
+ install -m755 ${srcdir}/ati-powermode.sh ${pkgdir}/etc/acpi
+ install -m644 ${srcdir}/a-ac-aticonfig ${pkgdir}/etc/acpi/events
+ install -m644 ${srcdir}/a-lid-aticonfig ${pkgdir}/etc/acpi/events
# Add ATI Events Daemon launcher
install -m755 ${srcdir}/atieventsd.sh ${pkgdir}/etc/rc.d/atieventsd
@@ -295,8 +317,14 @@ package() {
patch -Np1 -i ../fglrx_3.17rc6-no_hotplug.patch
patch -Np1 -i ../kolasa-3.19-get_cpu_var.patch
patch -Np1 -i ../fglrx_gpl_symbol.patch
- patch -Np1 -i ../kolasa_4.0-cr4-strn.patch
- patch -Np1 -i ../kolasa_4.1_remove-IRQF_DISABLED-15.7-v2.patch
+ patch -Np1 -i ../ubuntu_buildfix_kernel_4.0.patch
+ patch -Np1 -i ../ubuntu_buildfix_kernel_4.1.patch
+ patch -Np1 -i ../ubuntu_buildfix_kernel_4.2.patch
+ patch -Np1 -i ../4.2-fglrx-has_fpu.patch
+ patch -Np1 -i ../4.2-kolasa-fpu_save_init.patch
+ patch -Np1 -i ../ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
+ patch -Np1 -i ../4.3-kolasa-seq_printf.patch
+ patch -Np1 -i ../4.3-gentoo-mtrr.patch
# Prepare modules source files
_archdir=x86_64
diff --git a/a-ac-aticonfig b/a-ac-aticonfig
new file mode 100644
index 00000000000..753e3af063f
--- /dev/null
+++ b/a-ac-aticonfig
@@ -0,0 +1,6 @@
+# /etc/acpi/events/ac
+# Called when the user connects ac power to us
+#
+
+event=ac_adapter
+action=/etc/acpi/ati-powermode.sh "%e"
diff --git a/a-lid-aticonfig b/a-lid-aticonfig
new file mode 100644
index 00000000000..021f834ba6d
--- /dev/null
+++ b/a-lid-aticonfig
@@ -0,0 +1,4 @@
+# Called when the user opens/closes the laptop lid
+
+event=button/lid
+action=/etc/acpi/ati-powermode.sh "%e"
diff --git a/ati-powermode.sh b/ati-powermode.sh
new file mode 100755
index 00000000000..ded996c4305
--- /dev/null
+++ b/ati-powermode.sh
@@ -0,0 +1,106 @@
+#!/bin/bash
+
+#
+# Control script for ACPI lid state and AC adapter state
+#
+
+getXuser() {
+ user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'`
+ if [ x"$user" = x"" ]; then
+ startx=`pgrep -n startx`
+ if [ x"$startx" != x"" ]; then
+ user=`ps -o user --no-headers $startx`
+ fi
+ fi
+ if [ x"$user" != x"" ]; then
+ userhome=`getent passwd $user | cut -d: -f6`
+ export XAUTHORITY=$userhome/.Xauthority
+ else
+ export XAUTHORITY=""
+ fi
+ export XUSER=$user
+}
+
+#Find the right XServer to be configured.
+getXserver() {
+for x in /tmp/.X11-unix/*; do
+ displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
+ getXuser;
+ if [ x"$XAUTHORITY" != x"" ]; then
+ export DISPLAY=":$displaynum"
+ fi
+done
+}
+
+#If PPLIB is enabled
+checkPPLIB() {
+su $user -c '/usr/bin/aticonfig --pplib-cmd="get version"' | grep PPLIB
+if [ $? = 0 ]; then
+ echo "Has PPLIB"
+ has_pplib=1
+else
+ echo "No PPLIB"
+ has_pplib=0
+fi
+}
+
+case "$1" in
+ ac_adapter)
+ case "$2" in
+ AC|ACAD|ADP0)
+ case "$4" in
+ 00000000)
+ logger 'AC unpluged'
+ getXserver;
+ checkPPLIB;
+ if [ ${has_pplib} -eq 1 ]; then
+ su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
+ else
+ su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
+ fi
+ ;;
+ 00000001)
+ logger 'AC pluged'
+ getXserver;
+ checkPPLIB;
+ if [ ${has_pplib} -eq 1 ]; then
+ su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
+ else
+ su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ logger "ACPI action undefined: $2"
+ ;;
+ esac
+ ;;
+ button/lid)
+ case "$3" in
+ close)
+ logger 'LID closed'
+ getXserver;
+ checkPPLIB;
+ if [ ${has_pplib} -eq 1 ]; then
+ su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
+ else
+ su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
+ fi
+ ;;
+ open)
+ logger 'LID opened'
+ getXserver;
+ checkPPLIB;
+ if [ ${has_pplib} -eq 1 ]; then
+ su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
+ else
+ su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
+ fi
+ ;;
+ *)
+ logger "ACPI action undefined: $3"
+ ;;
+ esac
+ ;;
+esac \ No newline at end of file
diff --git a/atieventsd.service b/atieventsd.service
index 3bbf25acb8f..ff58ce7540e 100644
--- a/atieventsd.service
+++ b/atieventsd.service
@@ -1,6 +1,6 @@
[Unit]
Description=Catalyst event Daemon
-Requires=acpid.socket
+Requires=acpid.service
[Service]
ExecStart=/usr/bin/atieventsd --nodaemon
diff --git a/catalyst_build_module b/catalyst_build_module
index 02d75f9e4c4..0afc3130c19 100755
--- a/catalyst_build_module
+++ b/catalyst_build_module
@@ -35,7 +35,7 @@ install_module(){
## Compile module using _ati_check variables
CFLAGS_MODULE="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions"
- make -C /usr/lib/modules/${kernver}/build SUBDIRS="`pwd`" ARCH=${arch} \
+ make CC=gcc-4.9 -C /usr/lib/modules/${kernver}/build SUBDIRS="`pwd`" ARCH=${arch} \
MODFLAGS="$CFLAGS_MODULE" \
CFLAGS_MODULE="$CFLAGS_MODULE" \
PAGE_ATTR_FIX=$PAGE_ATTR_FIX COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE modules || return 1
diff --git a/kolasa_4.0-cr4-strn.patch b/kolasa_4.0-cr4-strn.patch
deleted file mode 100644
index 7bce698bad3..00000000000
--- a/kolasa_4.0-cr4-strn.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-diff -uNr 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 14.12_2/common/lib/modules/fglrx/build_mod/firegl_public.c
---- 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-11-28 21:02:10.000000000 +0100
-+++ 14.12_2/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-03-08 13:30:42.565275902 +0100
-@@ -4468,8 +4468,13 @@
-
- if (cpu_has_pge)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
- cr4 = read_cr4();
- write_cr4(cr4 & ~X86_CR4_PGE);
-+#else
-+ cr4 = __read_cr4();
-+ __write_cr4(cr4 & ~X86_CR4_PGE);
-+#endif
- }
- __flush_tlb();
-
-@@ -4482,7 +4487,11 @@
- write_cr0(cr0 & 0xbfffffff);
- if (cpu_has_pge)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
- write_cr4(cr4);
-+#else
-+ __write_cr4(cr4);
-+#endif
- }
- local_irq_restore(flags);
-
-@@ -4509,8 +4518,13 @@
-
- if (cpu_has_pge)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
- cr4 = read_cr4();
- write_cr4(cr4 & ~X86_CR4_PGE);
-+#else
-+ cr4 = __read_cr4();
-+ __write_cr4(cr4 & ~X86_CR4_PGE);
-+#endif
- }
- __flush_tlb();
-
-@@ -4522,7 +4536,11 @@
- write_cr0(cr0 & 0xbfffffff);
- if (cpu_has_pge)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
- write_cr4(cr4);
-+#else
-+ __write_cr4(cr4);
-+#endif
- }
- local_irq_restore(flags);
-
-diff -uNr 14.12/common/lib/modules/fglrx/build_mod/kcl_str.c 14.12_2/common/lib/modules/fglrx/build_mod/kcl_str.c
---- 14.12/common/lib/modules/fglrx/build_mod/kcl_str.c 2014-11-28 21:02:10.000000000 +0100
-+++ 14.12_2/common/lib/modules/fglrx/build_mod/kcl_str.c 2015-03-08 13:25:11.568396701 +0100
-@@ -169,7 +169,11 @@
- const char* s2,
- KCL_TYPE_SizeSigned count)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
- return strnicmp(s1, s2, count);
-+#else
-+ return strncasecmp(s1, s2, count);
-+#endif
- }
-
- /** \brief Locate character in string
diff --git a/kolasa_4.1_remove-IRQF_DISABLED-15.7-v2.patch b/kolasa_4.1_remove-IRQF_DISABLED-15.7-v2.patch
deleted file mode 100644
index fe7cd3bd948..00000000000
--- a/kolasa_4.1_remove-IRQF_DISABLED-15.7-v2.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-07-04 16:31:23.000000000 +0200
-+++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-07-11 11:30:12.617426303 +0200
-@@ -3498,7 +3498,11 @@
- #else
- //when MSI enabled. keep irq disabled when calling the action handler,
- //exclude this IRQ from irq balancing (only on one CPU)
-- ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)),
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)
-+ ((useMSI) ? (0x0) : (IRQF_SHARED)),
-+#else
-+ ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)),
-+#endif
- #endif
- dev_name,
- context);
diff --git a/ubuntu_buildfix_kernel_4.0.patch b/ubuntu_buildfix_kernel_4.0.patch
new file mode 100644
index 00000000000..c46029187ea
--- /dev/null
+++ b/ubuntu_buildfix_kernel_4.0.patch
@@ -0,0 +1,39 @@
+From 9029e189f8431a39146ac3477c7e4491e06c6f4b Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Thu, 4 Jun 2015 18:03:39 +0200
+Subject: [PATCH 1/1] Add support for Linux 4.0
+
+---
+ firegl_public.c | 5 +++++
+ kcl_str.c | 4 ++++
+ 2 files changed, 9 insertions(+)
+
+--- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -275,6 +275,11 @@ MODULE_LICENSE("Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY");
+ MODULE_DEVICE_TABLE(pci, fglrx_pci_table);
+ #endif
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0)
++#define read_cr4() __read_cr4()
++#define write_cr4(cr4) __write_cr4(cr4)
++#endif
++
+ /* globals constants */
+ const char* KCL_SYSINFO_OsVersionString = UTS_RELEASE;
+ const unsigned int KCL_SYSINFO_PageSize = PAGE_SIZE;
+diff --git a/kcl_str.c b/kcl_str.c
+index 2d89eb0..bacdb69 100755
+--- 15.7/common/lib/modules/fglrx/build_mod/kcl_str.c
++++ 15.7b/common/lib/modules/fglrx/build_mod/kcl_str.c
+@@ -42,6 +42,10 @@
+ #include "kcl_type.h"
+ #include "kcl_str.h"
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0)
++#define strnicmp strncasecmp
++#endif
++
+ /** \brief Fill memory with a constant byte
+ * \param s Pointer to memory
+ * \param c Initializing value
diff --git a/ubuntu_buildfix_kernel_4.1.patch b/ubuntu_buildfix_kernel_4.1.patch
new file mode 100644
index 00000000000..cf3dda0bfc5
--- /dev/null
+++ b/ubuntu_buildfix_kernel_4.1.patch
@@ -0,0 +1,29 @@
+From 94631bfd9b813d9d2f1af0ea744e7121d72d25c5 Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Fri, 10 Jul 2015 16:52:29 +0200
+Subject: [PATCH 1/2] Add support for Linux 4.1
+
+Drop the IRQF_DISABLED flag, as it was removed in Linux 4.1
+
+Signed-off-by: Alberto Milone <alberto.milone@canonical.com>
+---
+ firegl_public.c | 4 +++-
+ kcl_acpi.c | 4 ++++
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+--- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -3495,10 +3495,12 @@ int ATI_API_CALL KCL_InstallInterruptHandler(
+ KCL_PUB_InterruptHandlerWrap,
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+ ((useMSI) ? (SA_INTERRUPT) : (SA_SHIRQ)),
+-#else
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
+ //when MSI enabled. keep irq disabled when calling the action handler,
+ //exclude this IRQ from irq balancing (only on one CPU)
+ ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)),
++#else
++ ((useMSI) ? (0x0) : (IRQF_SHARED)),
+ #endif
+ dev_name,
+ context); \ No newline at end of file
diff --git a/ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch b/ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
new file mode 100644
index 00000000000..b92c64fd5b9
--- /dev/null
+++ b/ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
@@ -0,0 +1,60 @@
+--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-27 10:59:10.121499353 +0200
++++ 15.9b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-27 10:59:31.869133789 +0200
+@@ -6446,6 +6446,48 @@
+ return i;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
++/*
++ * Save processor xstate to xsave area.
++ */
++static void _copy_xregs_to_kernel(struct xregs_state *xstate)
++{
++ u64 mask = -1;
++ u32 lmask = mask;
++ u32 hmask = mask >> 32;
++ int err = 0;
++
++ /*WARN_ON(!alternatives_patched);*/
++
++ /*
++ * If xsaves is enabled, xsaves replaces xsaveopt because
++ * it supports compact format and supervisor states in addition to
++ * modified optimization in xsaveopt.
++ *
++ * Otherwise, if xsaveopt is enabled, xsaveopt replaces xsave
++ * because xsaveopt supports modified optimization which is not
++ * supported by xsave.
++ *
++ * If none of xsaves and xsaveopt is enabled, use xsave.
++ */
++ alternative_input_2(
++ "1:"XSAVE,
++ XSAVEOPT,
++ X86_FEATURE_XSAVEOPT,
++ XSAVES,
++ X86_FEATURE_XSAVES,
++ [xstate] "D" (xstate), "a" (lmask), "d" (hmask) :
++ "memory");
++ asm volatile("2:\n\t"
++ xstate_fault(err)
++ : "0" (err)
++ : "memory");
++
++ /* We should never fault when copying to a kernel buffer: */
++ WARN_ON_FPU(err);
++}
++#endif
++
+ /** \brief Generate UUID
+ * \param buf pointer to the generated UUID
+ * \return None
+@@ -6465,7 +6507,7 @@
+ fpu_xsave(fpu);
+ if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
+ #else
+- copy_xregs_to_kernel(&fpu->state.xsave);
++ _copy_xregs_to_kernel(&fpu->state.xsave);
+ if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
+ #endif
+ return 1;
diff --git a/ubuntu_buildfix_kernel_4.2.patch b/ubuntu_buildfix_kernel_4.2.patch
new file mode 100644
index 00000000000..9aa71bb1143
--- /dev/null
+++ b/ubuntu_buildfix_kernel_4.2.patch
@@ -0,0 +1,114 @@
+From eb7beb0ea51de526e59a0c3edc76530b28ef10e7 Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Tue, 14 Jul 2015 12:56:37 +0200
+Subject: [PATCH 1/1] Add support for Linux 4.2
+
+Deal with the FPU code renaming
+---
+ firegl_public.c | 38 ++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 38 insertions(+)
+
+--- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -191,9 +191,17 @@
+ #include <linux/string.h>
+ #include <linux/gfp.h>
+ #include <linux/swap.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ #include "asm/i387.h"
++#else
++#include <asm/fpu/api.h>
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ #include <asm/fpu-internal.h>
++#else
++#include <asm/fpu/internal.h>
++#endif
+ #endif
+
+ #include "firegl_public.h"
+@@ -1698,6 +1706,9 @@ void ATI_API_CALL KCL_SetCurrentProcessState(KCL_ENUM_ProcessState state)
+
+ #if defined(__i386__)
+ #ifndef __HAVE_ARCH_CMPXCHG
++#ifndef __xg
++#define __xg(x) ((volatile long *)(x))
++#endif
+ static inline
+ unsigned long __fgl_cmpxchg(volatile void *ptr, unsigned long old,
+ unsigned long new, int size)
+@@ -1734,7 +1745,11 @@ unsigned long ATI_API_CALL kcl__cmpxchg(volatile void *ptr, unsigned long old,
+ unsigned long new, int size)
+ {
+ #ifndef __HAVE_ARCH_CMPXCHG
++#if defined(__i386__)
+ return __fgl_cmpxchg(ptr,old,new,size);
++#elif defined(__x86_64__)
++ return cmpxchg((unsigned long*)ptr,old,new);
++#endif
+ #else
+ /* On kernel version 2.6.34 passing a variable or unsupported size
+ * argument to the __cmpxchg macro causes the default-clause of a
+@@ -6430,21 +6445,36 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
+ struct fpu *fpu = &tsk->thread.fpu;
+
+ if(static_cpu_has(X86_FEATURE_XSAVE)) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ fpu_xsave(fpu);
+ if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
++#else
++ copy_xregs_to_kernel(&fpu->state.xsave);
++ if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
++#endif
+ return 1;
+ } else if (static_cpu_has(X86_FEATURE_FXSR)) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ fpu_fxsave(fpu);
++#else
++ copy_fxregs_to_kernel(fpu);
++#endif
+ } else {
+ asm volatile("fnsave %[fx]; fwait"
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ : [fx] "=m" (fpu->state->fsave));
++#else
++ : [fx] "=m" (fpu->state.fsave));
++#endif
+ return 0;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) {
+ asm volatile("fnclex");
+ return 0;
+ }
++#endif
+ return 1;
+ }
+ #endif
+@@ -6456,8 +6486,12 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
+ void ATI_API_CALL KCL_fpu_begin(void)
+ {
+ #ifdef CONFIG_X86_64
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ kernel_fpu_begin();
+ #else
++ __kernel_fpu_begin();
++#endif
++#else
+ #ifdef TS_USEDFPU
+ struct thread_info *cur_thread = current_thread_info();
+ struct task_struct *cur_task = get_current();
+@@ -6502,7 +6536,11 @@ void ATI_API_CALL KCL_fpu_begin(void)
+ */
+ void ATI_API_CALL KCL_fpu_end(void)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ kernel_fpu_end();
++#else
++ __kernel_fpu_end();
++#endif
+ }
+
+ /** Create new directory entry under "/proc/...."