summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorVi0L02016-06-12 20:50:29 +0200
committerVi0L02016-06-12 20:50:29 +0200
commita7521ab2e6d8a3e52fc9d223d12cec826a9743a5 (patch)
treeed98b35fe0e1c0e5510647b29d7fd247176ace98
parentafdab9012ff9d8701391c1c4a09a852164c9803a (diff)
downloadaur-a7521ab2e6d8a3e52fc9d223d12cec826a9743a5.tar.gz
13.1-36: initial 4.6 kernel support + switched to dkms + acpi script from aslmaswd
-rw-r--r--.SRCINFO33
-rw-r--r--4.6-arch-get_user_pages-page_cache_release.patch26
-rw-r--r--PKGBUILD81
-rw-r--r--a-ac-aticonfig6
-rw-r--r--a-lid-aticonfig4
-rwxr-xr-xati-powermode.sh107
-rw-r--r--ati_make.sh145
-rw-r--r--catalyst-hook.service14
-rw-r--r--catalyst-total-hd234k.install40
-rwxr-xr-xcatalyst_build_module201
-rw-r--r--dkms.conf7
-rw-r--r--hook-fglrx14
-rw-r--r--makesh-dont-check-gcc-version.patch11
-rw-r--r--makesh-src_file.patch29
14 files changed, 179 insertions, 539 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f9fe6fafaf1..d1cd060ad2c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,15 @@
pkgbase = catalyst-total-hd234k
- pkgdesc = AMD/ATI legacy drivers. catalyst-hook + catalyst-utils + lib32-catalyst-utils
+ pkgdesc = AMD/ATI legacy drivers. catalyst-dkms+ catalyst-utils + lib32-catalyst-utils
pkgver = 13.1
- pkgrel = 34
+ pkgrel = 36
url = http://www.amd.com
install = catalyst-total-hd234k.install
arch = i686
arch = x86_64
license = custom
+ depends = dkms
depends = linux>=3.0
- depends = linux<4.6
+ depends = linux<4.7
depends = linux-headers
depends = xorg-server>=1.7.0
depends = xorg-server<1.13.0
@@ -32,7 +33,7 @@ pkgbase = catalyst-total-hd234k
provides = libatical=13.1
provides = catalyst=13.1
provides = catalyst-utils=13.1
- provides = catalyst-hook=13.1
+ provides = catalyst-dkms=13.1
provides = catalyst-libgl=13.1
provides = opencl-catalyst=13.1
provides = libcl
@@ -47,7 +48,7 @@ pkgbase = catalyst-total-hd234k
conflicts = catalyst
conflicts = catalyst-daemon
conflicts = catalyst-generator
- conflicts = catalyst-hook
+ conflicts = catalyst-dkms
conflicts = catalyst-utils
conflicts = libcl
options = staticlibs
@@ -55,20 +56,14 @@ pkgbase = catalyst-total-hd234k
options = !strip
options = !upx
source = http://www2.ati.com/drivers/legacy/amd-driver-installer-catalyst-13.1-legacy-linux-x86.x86_64.zip
- source = catalyst_build_module
source = lib32-catalyst.sh
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
- source = ati_make.sh
source = makefile_compat.patch
- source = catalyst-hook.service
source = 3.5-do_mmap.patch
source = arch-fglrx-3.7.patch
source = gentoo_linux-3.10-proc.diff
@@ -88,21 +83,19 @@ pkgbase = catalyst-total-hd234k
source = 4.3-gentoo-mtrr.patch
source = gcc5-something_something_the_dark_side.patch
source = 4.4-arch-block_signals.patch
+ source = 4.6-arch-get_user_pages-page_cache_release.patch
+ source = dkms.conf
+ source = makesh-dont-check-gcc-version.patch
+ source = makesh-src_file.patch
md5sums = c07fd1332abe4c742a9a0d0e0d0a90de
- md5sums = 3c2ff823b56d16e8220d129726b43ff1
md5sums = af7fb8ee4fc96fd54c5b483e33dc71c4
md5sums = bdafe749e046bfddee2d1c5e90eabd83
md5sums = 9d9ea496eadf7e883d56723d65e96edf
md5sums = b79e144932616221f6d01c4b05dc9306
- md5sums = 514899437eb209a1d4670df991cdfc10
- md5sums = 80fdfbff93d96a1dfca2c7f684be8cc1
- md5sums = 9054786e08cf3ea2a549fe22d7f2cd92
+ md5sums = 9e2a7ded987b7d2b2cfffc7281ebd8a5
md5sums = 3e19c2285c76f4cb92108435a1e9c302
md5sums = b3ceefeb97c609037845f65d0956c4f0
- md5sums = 9126e1ef0c724f8b57d3ac0fe77efe2f
- md5sums = 62239156a9656c6f41e89a879578925c
md5sums = 3e1b82bd69774ea808da69c983d6a43b
- md5sums = a64e2eae5addc6d670911ccf94b8cda4
md5sums = a450e2e3db61994b09e9d99d95bee837
md5sums = ff60c162b46e21e9810a722718023451
md5sums = 5872d95907a93ada44982e355e91e59d
@@ -122,6 +115,10 @@ pkgbase = catalyst-total-hd234k
md5sums = 98828e3eeaec2b3795e584883cc1b746
md5sums = af80a9eb2016811ab79717c2bd370a25
md5sums = d200e156e941ec7b0227e399fd20a9c2
+ md5sums = d98bb6d66520bdaeac42b60b75b01ab4
+ md5sums = 23d569abfdd7de433d76e003e4b3ccf9
+ md5sums = 10829e3b992b3e80a6e78c8e27748703
+ md5sums = 6cdc15206cc61e3de456416a9011db07
pkgname = catalyst-total-hd234k
diff --git a/4.6-arch-get_user_pages-page_cache_release.patch b/4.6-arch-get_user_pages-page_cache_release.patch
new file mode 100644
index 00000000000..f931c05558c
--- /dev/null
+++ b/4.6-arch-get_user_pages-page_cache_release.patch
@@ -0,0 +1,26 @@
+--- 16.5/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-12-18 19:47:41.000000000 +0100
++++ 16.5b/common/lib/modules/fglrx/build_mod/firegl_public.c 2016-05-09 20:29:48.227025117 +0200
+@@ -3220,7 +3220,11 @@
+ int ret;
+
+ down_read(&current->mm->mmap_sem);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
++ ret = get_user_pages_remote(current, current->mm, vaddr, page_cnt, 1, 0, (struct page **)page_list, NULL);
++#else
+ ret = get_user_pages(current, current->mm, vaddr, page_cnt, 1, 0, (struct page **)page_list, NULL);
++#endif
+ up_read(&current->mm->mmap_sem);
+
+ return ret;
+@@ -3249,7 +3257,11 @@
+ unsigned int i;
+ for (i=0; i<page_cnt; i++)
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
++ put_page((struct page*)page_list[i]);
++#else
+ page_cache_release((struct page*)page_list[i]);
++#endif
+ }
+ }
+
diff --git a/PKGBUILD b/PKGBUILD
index cc03b3bfc3d..262896bf18a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -20,26 +20,27 @@
# Contributor: ubuntu (parts of 4.0, 4.1 and 4.2 kernel patches)
# Contributor: kolasa (parts of 4.2 and 4.3 kernel patches)
# Contributor: gentoo (patch for 3.10 + part of 4.3 kernel patches)
+# Contributor: aslmaswd (acpi main script)
# PKGEXT='.pkg.tar.gz' # imho time to pack this pkg into tar.xz is too long, unfortunatelly yaourt got problems when ext is different from .pkg.tar.xz - V
pkgname=catalyst-total-hd234k
pkgver=13.1
-pkgrel=34
-pkgdesc="AMD/ATI legacy drivers. catalyst-hook + catalyst-utils + lib32-catalyst-utils"
+pkgrel=36
+pkgdesc="AMD/ATI legacy drivers. catalyst-dkms+ catalyst-utils + lib32-catalyst-utils"
arch=('i686' 'x86_64')
url="http://www.amd.com"
license=('custom')
options=('staticlibs' 'libtool' '!strip' '!upx')
-depends=('linux>=3.0' 'linux<4.6' 'linux-headers' 'xorg-server>=1.7.0' 'xorg-server<1.13.0' 'libxrandr' 'libsm' 'fontconfig' 'libxcursor' 'libxi' 'gcc-libs' 'gcc>4.0.0' 'make' 'patch' 'libxinerama' 'mesa>=10.1.0-4')
+depends=('dkms' 'linux>=3.0' 'linux<4.7' 'linux-headers' 'xorg-server>=1.7.0' 'xorg-server<1.13.0' 'libxrandr' 'libsm' 'fontconfig' 'libxcursor' 'libxi' 'gcc-libs' 'gcc>4.0.0' 'make' 'patch' 'libxinerama' 'mesa>=10.1.0-4')
optdepends=('qt4: to run ATi Catalyst Control Center (amdcccle)'
'libxxf86vm: to run ATi Catalyst Control Center (amdcccle)'
'opencl-headers: headers necessary for OpenCL development'
'acpid: acpi event support / atieventsd'
'linux-lts-headers: to build the fglrx module for the linux-lts kernel')
-conflicts=('libgl' 'xf86-video-ati' 'xf86-video-radeonhd' 'catalyst-test' 'nvidia-utils' 'nvidia' 'catalyst' 'catalyst-daemon' 'catalyst-generator' 'catalyst-hook' 'catalyst-utils' 'libcl')
-provides=('libgl' "libatical=${pkgver}" "catalyst=${pkgver}" "catalyst-utils=${pkgver}" "catalyst-hook=${pkgver}" "catalyst-libgl=${pkgver}" "opencl-catalyst=${pkgver}" 'libcl' 'dri' 'libtxc_dxtn')
+conflicts=('libgl' 'xf86-video-ati' 'xf86-video-radeonhd' 'catalyst-test' 'nvidia-utils' 'nvidia' 'catalyst' 'catalyst-daemon' 'catalyst-generator' 'catalyst-dkms' 'catalyst-utils' 'libcl')
+provides=('libgl' "libatical=${pkgver}" "catalyst=${pkgver}" "catalyst-utils=${pkgver}" "catalyst-dkms=${pkgver}" "catalyst-libgl=${pkgver}" "opencl-catalyst=${pkgver}" 'libcl' 'dri' 'libtxc_dxtn')
if [ "${CARCH}" = "x86_64" ]; then
warning "x86_64 system detected"
@@ -61,20 +62,15 @@ DLAGENTS="http::/usr/bin/curl --referer ${url_ref} -o %o %u"
source=(
http://www2.ati.com/drivers/legacy/amd-driver-installer-catalyst-${pkgver}-legacy-linux-x86.x86_64.zip
- catalyst_build_module
lib32-catalyst.sh
catalyst.sh
atieventsd.sh
atieventsd.service
ati-powermode.sh
- a-ac-aticonfig
- a-lid-aticonfig
+
catalyst.conf
arch-fglrx-authatieventsd_new.patch
- hook-fglrx
- ati_make.sh
makefile_compat.patch
- catalyst-hook.service
3.5-do_mmap.patch
arch-fglrx-3.7.patch
@@ -96,23 +92,23 @@ source=(
4.3-gentoo-mtrr.patch
gcc5-something_something_the_dark_side.patch
- 4.4-arch-block_signals.patch)
+ 4.4-arch-block_signals.patch
+ 4.6-arch-get_user_pages-page_cache_release.patch
+
+ dkms.conf
+ makesh-dont-check-gcc-version.patch
+ makesh-src_file.patch)
md5sums=('c07fd1332abe4c742a9a0d0e0d0a90de'
- '3c2ff823b56d16e8220d129726b43ff1'
'af7fb8ee4fc96fd54c5b483e33dc71c4'
'bdafe749e046bfddee2d1c5e90eabd83'
'9d9ea496eadf7e883d56723d65e96edf'
'b79e144932616221f6d01c4b05dc9306'
- '514899437eb209a1d4670df991cdfc10'
- '80fdfbff93d96a1dfca2c7f684be8cc1'
- '9054786e08cf3ea2a549fe22d7f2cd92'
+ '9e2a7ded987b7d2b2cfffc7281ebd8a5'
+
'3e19c2285c76f4cb92108435a1e9c302'
'b3ceefeb97c609037845f65d0956c4f0'
- '9126e1ef0c724f8b57d3ac0fe77efe2f'
- '62239156a9656c6f41e89a879578925c'
'3e1b82bd69774ea808da69c983d6a43b'
- 'a64e2eae5addc6d670911ccf94b8cda4'
'a450e2e3db61994b09e9d99d95bee837'
'ff60c162b46e21e9810a722718023451'
@@ -134,7 +130,12 @@ md5sums=('c07fd1332abe4c742a9a0d0e0d0a90de'
'98828e3eeaec2b3795e584883cc1b746'
'af80a9eb2016811ab79717c2bd370a25'
- 'd200e156e941ec7b0227e399fd20a9c2')
+ 'd200e156e941ec7b0227e399fd20a9c2'
+ 'd98bb6d66520bdaeac42b60b75b01ab4'
+
+ '23d569abfdd7de433d76e003e4b3ccf9'
+ '10829e3b992b3e80a6e78c8e27748703'
+ '6cdc15206cc61e3de456416a9011db07')
build() {
@@ -257,11 +258,9 @@ package() {
# 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
- # lets check our own files - V
+ install -m644 usr/share/doc/fglrx/examples/etc/acpi/events/* ${pkgdir}/etc/acpi/events
+ # put version modified by aslmaswd - 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
@@ -290,7 +289,7 @@ package() {
install -m644 ${srcdir}/catalyst.conf ${pkgdir}/etc/modules-load.d
-##catalyst-hook section
+##catalyst-dkms section
cd ${srcdir}/archive_files
patch -Np1 -i ../makefile_compat.patch
patch -Np1 -i ../3.5-do_mmap.patch
@@ -314,32 +313,30 @@ package() {
patch -Np1 -i ../4.3-gentoo-mtrr.patch
patch -Np1 -i ../gcc5-something_something_the_dark_side.patch
patch -Np1 -i ../4.4-arch-block_signals.patch
+ patch -Np1 -i ../4.6-arch-get_user_pages-page_cache_release.patch
+ patch -Np1 -i ../makesh-dont-check-gcc-version.patch
+ patch -Np1 -i ../makesh-src_file.patch
+
# Prepare modules source files
+ install -dm755 ${pkgdir}/usr/src/fglrx-${pkgver}/2.6.x
_archdir=x86_64
test "${CARCH}" = "i686" && _archdir=x86
- install -m755 -d ${pkgdir}/usr/share/ati/build_mod
+ install -m755 -d ${pkgdir}/usr/src/fglrx-${pkgver}
install -m644 common/lib/modules/fglrx/build_mod/*.c \
- ${pkgdir}/usr/share/ati/build_mod
+ ${pkgdir}/usr/src/fglrx-${pkgver}
install -m644 common/lib/modules/fglrx/build_mod/*.h \
- ${pkgdir}/usr/share/ati/build_mod/
+ ${pkgdir}/usr/src/fglrx-${pkgver}
install -m644 common/lib/modules/fglrx/build_mod/2.6.x/Makefile \
- ${pkgdir}/usr/share/ati/build_mod/
+ ${pkgdir}/usr/src/fglrx-${pkgver}/2.6.x
+ install -m644 common/lib/modules/fglrx/build_mod/make.sh \
+ ${pkgdir}/usr/src/fglrx-${pkgver}
install -m644 arch/${_archdir}/lib/modules/fglrx/build_mod/libfglrx_ip.a \
- ${pkgdir}/usr/share/ati/build_mod/
- install -m755 -d ${pkgdir}/usr/bin
- install -m755 ${srcdir}/catalyst_build_module ${pkgdir}/usr/bin
+ ${pkgdir}/usr/src/fglrx-${pkgver}
- # modified ati's make.sh script
- install -m755 ${srcdir}/ati_make.sh ${pkgdir}/usr/share/ati/build_mod
-
- # hook fglrx
- install -m755 -d ${pkgdir}/usr/lib/initcpio/install
- install -m644 ${srcdir}/hook-fglrx ${pkgdir}/usr/lib/initcpio/install/fglrx
-
- # systemd service to perform fglrx module build at shutdown
- install -m755 -d ${pkgdir}/usr/lib/systemd/system
- install -m644 ${srcdir}/catalyst-hook.service ${pkgdir}/usr/lib/systemd/system
+ # copy dkms.conf and set version
+ cp ${srcdir}/dkms.conf ${pkgdir}/usr/src/fglrx-${pkgver}/
+ sed -i -e "s/@VERSION@/${pkgver}/" "${pkgdir}/usr/src/fglrx-${pkgver}/dkms.conf"
##lib32-catalyst-utils section
diff --git a/a-ac-aticonfig b/a-ac-aticonfig
deleted file mode 100644
index 753e3af063f..00000000000
--- a/a-ac-aticonfig
+++ /dev/null
@@ -1,6 +0,0 @@
-# /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
deleted file mode 100644
index 021f834ba6d..00000000000
--- a/a-lid-aticonfig
+++ /dev/null
@@ -1,4 +0,0 @@
-# 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
index ded996c4305..6c2ad527d0c 100755
--- a/ati-powermode.sh
+++ b/ati-powermode.sh
@@ -5,6 +5,10 @@
#
getXuser() {
+# user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
+# if [ x"$user" = x"" ]; then
+# user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
+# fi
user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'`
if [ x"$user" = x"" ]; then
startx=`pgrep -n startx`
@@ -18,11 +22,30 @@ getXuser() {
else
export XAUTHORITY=""
fi
- export XUSER=$user
}
+
+grep -q closed /proc/acpi/button/lid/*/state
+if [ $? = 0 ]; then
+ lid_closed=1
+ echo "Lid Closed"
+else
+ lid_closed=0
+ echo "Lid Open"
+fi
+
+#grep -q off-line /proc/acpi/ac_adapter/*/state
+grep -q 0 /sys/class/power_supply/ADP*/online
+
+if [ $? = 0 ]; then
+ echo "On DC"
+ on_dc=1
+else
+ echo "On AC"
+ on_dc=0
+fi
+
#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;
@@ -30,10 +53,8 @@ for x in /tmp/.X11-unix/*; do
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"
@@ -42,65 +63,21 @@ 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
+
+
+if [ ${lid_closed} -eq 1 -o ${on_dc} -eq 1 ]; then
+ echo "Low power"
+ 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
+else
+ echo "high power"
+ 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
+fi \ No newline at end of file
diff --git a/ati_make.sh b/ati_make.sh
deleted file mode 100644
index 45fa26a4710..00000000000
--- a/ati_make.sh
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/bash
-### Vi0L0: it is ati's code from their make.sh file, modified a bit to fit our arch linux system, used inside PKGBUILD
-
-# Copyright 1999-2005 ATI Technologies Inc., Markham, Ontario, CANADA.
-# All Rights Reserved.
-#
-# Your use and or redistribution of this software in source and \ or
-# binary form, with or without modification, is subject to: (i) your
-# ongoing acceptance of and compliance with the terms and conditions of
-# the ATI Technologies Inc. software End User License Agreement; and (ii)
-# your inclusion of this notice in any version of this software that you
-# use or redistribute. A copy of the ATI Technologies Inc. software End
-# User License Agreement is included with this software and is also
-# available by contacting ATI Technologies Inc. at http://www.ati.com
-
-
-function _ati_check()
-{
-# ==============================================================
-# resolve if we are running a SMP enabled kernel
-
-SMP=0
-
-# 1
-# grep in OsVersion string for SMP specific keywords
-OsVersion=`uname -v`
-
-if [ `echo $OsVersion | grep [sS][mM][pP] -c` -ne 0 ]; then
- SMP=1
- echo "OsVersion says: SMP=$SMP"
-fi
-
-# 2
-# grep in /proc/ksyms for SMP specific kernel symbols
-# use triggerlevel of 10 occurences
-# (UP kernels might have 0-1, SMP kernels might have 32-45 or much more)
-
-src_file=/proc/kallsyms
-
-if [ -e $src_file ]; then
- if [ `fgrep smp $src_file -c` -gt 10 ]; then
- SMP=1
- echo "file $src_file says: SMP=$SMP"
- fi
-fi
-
-# 3
-# linux/autoconf.h may contain this: #define CONFIG_SMP 1
-
-# Before 2.6.33 autoconf.h is under linux/.
-# For 2.6.33 and later autoconf.h is under generated/.
-if [ -f /usr/lib/modules/${kernver}/build/include/generated/autoconf.h ]; then
- autoconf_h=/usr/lib/modules/${kernver}/build/include/generated/autoconf.h
-else
- autoconf_h=/usr/lib/modules/${kernver}/build/include/linux/autoconf.h
-fi
-src_file=$autoconf_h
-
-if [ ! -e $src_file ]; then
- echo "Warning:"
- echo "kernel includes at /usr/lib/modules/${kernver}/build/include not found or incomplete"
- echo "file: $src_file"
- echo ""
-else
- if [ `cat $src_file | grep "#undef" | grep "CONFIG_SMP" -c` = 0 ]; then
- SMP=`cat $src_file | grep CONFIG_SMP | cut -d' ' -f3`
- echo "file $src_file says: SMP=$SMP"
- fi
-fi
-
-if [ "$SMP" = 0 ]; then
- echo "assuming default: SMP=$SMP"
-fi
-
-# act on final result
-if [ ! "$SMP" = 0 ]; then
- smp="-SMP"
- def_smp=-D__SMP__
-fi
-# ==============================================================
-# resolve whether we need to set PAGE_ATTR_FIX
-PAGE_ATTR_FIX=0
-
-src_file=/proc/kallsyms
-
-if [ -e $src_file ]; then
- if [ `fgrep " change_page_attr\$" $src_file -c` -gt 0 ]; then
- PAGE_ATTR_FIX=1
- echo "file $src_file says: PAGE_ATTR_FIX=$PAGE_ATTR_FIX"
- fi
-fi
-# ==============================================================
-# resolve if we are running a MODVERSIONS enabled kernel
-
-MODVERSIONS=0
-
-# autoconf.h may contain this: #define CONFIG_MODVERSIONS 1
-src_file=$autoconf_h
-if [ ! -e $src_file ];
-then
- echo "Warning:"
- echo "kernel includes at /usr/lib/modules/${kernver}/build/include not found or incomplete"
- echo "file: $src_file"
- echo ""
-else
- if [ `cat $src_file | grep "#undef" | grep "CONFIG_MODVERSIONS" -c` = 0 ]
- then
- MODVERSIONS=`cat $src_file | grep CONFIG_MODVERSIONS | cut -d' ' -f3`
- echo "file $src_file says: MODVERSIONS=$MODVERSIONS"
- fi
-fi
-
-if [ "$MODVERSIONS" = 0 ]
-then
- echo "assuming default: MODVERSIONS=$MODVERSIONS"
-fi
-
-# act on final result
-if [ ! "$MODVERSIONS" = 0 ]
-then
- def_modversions="-DMODVERSIONS"
-fi
-
-# ==============================================================
-# resolve if we are building for a kernel with a fix for CVE-2010-3081
-# On kernels with the fix, use arch_compat_alloc_user_space instead
-# of compat_alloc_user_space since the latter is GPL-only
-
-COMPAT_ALLOC_USER_SPACE=compat_alloc_user_space
-
-src_file=/usr/lib/modules/${kernver}/build/arch/x86/include/asm/compat.h
-if [ ! -e $src_file ];
-then
- echo "Warning:"
- echo "kernel includes at /usr/lib/modules/${kernver}/build/include not found or incomplete"
- echo "file: $src_file"
- echo ""
-else
- if [ `cat $src_file | grep -c arch_compat_alloc_user_space` -gt 0 ]
- then
- COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
- fi
- echo "file $src_file says: COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE"
-fi
-} \ No newline at end of file
diff --git a/catalyst-hook.service b/catalyst-hook.service
deleted file mode 100644
index 10292498a23..00000000000
--- a/catalyst-hook.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Catalyst's fglrx kernel' module builder
-Before=umount.target
-
-[Service]
-SysVStartPriority=90
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/bin/true
-ExecStop=/usr/bin/catalyst_build_module check
-KillMode=none
-
-[Install]
-WantedBy=multi-user.target \ No newline at end of file
diff --git a/catalyst-total-hd234k.install b/catalyst-total-hd234k.install
index 0220416af21..c92c7114349 100644
--- a/catalyst-total-hd234k.install
+++ b/catalyst-total-hd234k.install
@@ -4,6 +4,8 @@ echo "5da725748a98681ea0dd5ee8eeeff730:65891c4ca7a95a2e96ec6f89c3dec30169961537a
whisperer(){
echo "----------------------------------------------------------------"
+ echo "Note: hook was replaced by dkms"
+ echo "----------------------------------------------------------------"
echo "Add nomodeset to your kernel line in /boot/grub/menu.lst , ie.:"
echo "kernel /boot/vmlinuz-linux root=/dev/sda1 ro nomodeset"
echo "----------------------------------------------------------------"
@@ -16,52 +18,30 @@ whisperer(){
echo "systemctl start atieventsd"
echo "----------------------------------------------------------------"
echo "For more info and troubleshooting visit:"
- echo "http://wiki.archlinux.org/index.php/ATI_Catalyst"
+ echo "http://wiki.archlinux.org/index.php/AMD_Catalyst"
echo "----------------------------------------------------------------"
- echo -e '\E[37;44m'"\033[1m----------------------------------------------------------------\033[0m"
- echo -e '\E[37;44m'"\033[1m ATTENTION!\033[0m"
- echo -e '\E[37;44m'"\033[1m----------------------------------------------------------------\033[0m"
- echo "To enable 'automatic re-compilation while system shutdown/reboot' "
- echo "testing feature run these commands as root:"
- echo "systemctl enable catalyst-hook"
- echo "systemctl start catalyst-hook"
- echo ""
- echo "More info here:"
- echo "https://bbs.archlinux.org/viewtopic.php?pid=1255575#p1255575"
- echo -e '\E[37;44m'"\033[1m----------------------------------------------------------------\033[0m"
}
-captain_hook(){
- # add hook fglrx to mkiniticpio
- hooks=$(grep ^HOOKS etc/mkinitcpio.conf | grep fglrx)
- if [ "$hooks" = "" ]; then
- sed 's/^HOOKS="\([^"]*\)"/HOOKS="\1 fglrx"/' -i etc/mkinitcpio.conf
- fi
+pre_upgrade(){
+ # remove hook fglrx
+ sed '/^HOOKS/s/ *fglrx//' -i etc/mkinitcpio.conf
+ systemctl stop catalyst-hook.service
+ systemctl disable catalyst-hook.service
+ # remove existing fglrx modules
+ usr/bin/catalyst_build_module ra
}
post_install(){
- captain_hook
- usr/bin/catalyst_build_module ra
- usr/bin/catalyst_build_module all
no_testing
whisperer
}
post_upgrade(){
- usr/bin/catalyst_build_module ra
- usr/bin/catalyst_build_module all
no_testing
whisperer
}
-pre_remove(){
- usr/bin/catalyst_build_module ra
-}
-
post_remove(){
- # remove hook fglrx
- sed '/^HOOKS/s/ *fglrx//' -i etc/mkinitcpio.conf
-
# remove log
rm -f var/log/catalyst-install.log
diff --git a/catalyst_build_module b/catalyst_build_module
deleted file mode 100755
index 13f6bcea548..00000000000
--- a/catalyst_build_module
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/bin/bash
-
-kernver=${KERNVER:-$(uname -r)}
-arch=${ARCH:-$(uname -m)}
-arch=${arch/i686/i386}
-LOG="/var/log/catalyst-install.log"
-
-
-install_module(){
- echo ""
- echo "--------"
- date '+%Y-%m-%d %H:%M:%S'
- echo "Building fglrx module for ${kernver} kernel ..."
- echo "--------"
-
-
- if [ ! -d "/usr/lib/modules/${kernver}/build" ]; then
- echo "Kernel header files are absent: directory /usr/lib/modules/${kernver}/build doesn't exist! Game over"
- return 1
- fi
- workdir=$(mktemp -du /tmp/catalyst.XXXXXX)
-# set -x
- cp "/usr/share/ati/build_mod" "${workdir}" -R
- cd "$workdir"
-
- ## include ati_make.sh and use _ati_check function from it
- . ati_make.sh
- _ati_check
-
-#------------------------------------------------------------------------------------------
-# putting our info into module
- modsymmd5=`md5sum /usr/lib/modules/${kernver}/build/Module.symvers | cut -d ' ' -f 1`
- sed "/MODULE_DESCRIPTION/a\MODULE_DESCRIPTION(\"__msm:$modsymmd5\");" -i firegl_public.c
-#------------------------------------------------------------------------------------------
-
- ## Compile module using _ati_check variables
- make -C /usr/lib/modules/${kernver}/build SUBDIRS="`pwd`" ARCH=${arch} \
- MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
- PAGE_ATTR_FIX=$PAGE_ATTR_FIX COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE modules || return 1
-
- gzip -9 fglrx.ko
-
- ## here we are checking kernel's extramodules dir
- for r in /usr/lib/modules/*; do
- if [[ ${r:17:3} = "ext" ]]; then
- if [[ `cat ${r}/version | grep -c ${kernver}` != 0 ]]; then
- destidir=${r}
- fi
- fi
- done
-
- install -m644 fglrx.ko.gz ${destidir} || return 1
-
- depmod ${kernver}
- rm -rf "${workdir}"
-# set +x
- echo "Ok."
-}
-
-build_all_modules(){
- for p in /usr/lib/modules/*; do
- if [ ${p:17:3} != "ext" ] && [ -d $p/build ] && [ -d $p/kernel ]; then
- /usr/bin/catalyst_build_module ${p##*/usr/lib/modules/}
- fi
- done
-}
-
-remove_module(){
- for p in /usr/lib/modules/*; do
- if [[ ${p:17:3} != "ext" ]]; then
- if [ ! -d $p/kernel ]; then
- if [[ -e $p/video/fglrx.ko.gz ]] || [[ -e $p/extramodules/fglrx.ko.gz ]] || [[ -e $p/video/fglrx.ko ]] || [[ -e $p/extramodules/fglrx.ko ]]; then
- echo "+ removing fglrx module from $p"
- rm "$p/video/fglrx.ko.gz" &>/dev/null
- rm "$p/video/fglrx.ko" &>/dev/null
- rm "$p/extramodules/fglrx.ko.gz" &>/dev/null
- rm "$p/extramodules/fglrx.ko" &>/dev/null
- rmdir -p "$p/video/" --ignore-fail-on-non-empty &>/dev/null
- fi
- if [ -d $p ]; then
- if [ -z "$(ls $p)" ]; then
- echo "+ removing empty directory: $p"
- rm -rf $p
- else echo "- $p looks like unused, maybe remove it manualy?"
- fi
- fi
- fi
- fi
- done
-}
-
-remove_all_modules(){
- for p in /usr/lib/modules/*; do
- if [[ ${p:17:3} != "ext" ]]; then
- if [[ -e $p/video/fglrx.ko.gz ]] || [[ -e $p/extramodules/fglrx.ko.gz ]] || [[ -e $p/video/fglrx.ko ]] || [[ -e $p/extramodules/fglrx.ko ]]; then
- echo "+ removing fglrx module from $p"
- rm "$p/video/fglrx.ko.gz" &>/dev/null
- rm "$p/video/fglrx.ko" &>/dev/null
- rm "$p/extramodules/fglrx.ko.gz" &>/dev/null
- rm "$p/extramodules/fglrx.ko" &>/dev/null
- rmdir -p "$p/video/" --ignore-fail-on-non-empty &>/dev/null
- depmod $(basename $p)
- fi
- if [ -d $p ]; then
- if [ -z "$(ls $p)" ]; then #check if /usr/lib/modules/p is empty
- echo "+ removing empty directory: $p"
- rm -rf $p
- elif [ ! -d $p/kernel ]; then
- echo "- $p looks like unused, maybe remove it manualy?"
- fi
- fi
- fi
- done
-}
-
-remove_old_modules(){
- for p in /lib/modules/*; do
- if [[ ${p:13:3} != "ext" ]]; then
- if [[ -e $p/video/fglrx.ko ]] || [[ -e $p/extramodules/fglrx.ko ]]; then
- echo "+ removing old fglrx module from $p"
- rm "$p/video/fglrx.ko" &>/dev/null
- rm "$p/extramodules/fglrx.ko" &>/dev/null
- rmdir -p "$p/video/" --ignore-fail-on-non-empty &>/dev/null
- depmod $(basename $p)
- fi
- fi
- done
-}
-
-hook_add(){
- # add hook fglrx to mkiniticpio
- hooks=$(grep ^HOOKS /etc/mkinitcpio.conf | grep fglrx)
- if [ "$hooks" = "" ]; then
- # add hook fglrx
- sed 's/^HOOKS="\([^"]*\)"/HOOKS="\1 fglrx"/' -i /etc/mkinitcpio.conf
- echo "fgkrx hook was added into /etc/mkinitcpio.conf"
- fi
-}
-
-hook_remove(){
- # remove hook fglrx
- sed '/^HOOKS/s/ *fglrx//' -i /etc/mkinitcpio.conf
- echo "fgkrx hook was removed from /etc/mkinitcpio.conf"
-}
-
-check_modules(){
- for p in /usr/lib/modules/*; do
- if [ ${p:17:3} != "ext" ] && [ -d $p/build ] && [ -d $p/kernel ]; then
- if [[ -e $p/extramodules/fglrx.ko.gz ]]; then
- compare=$(md5sum $p/build/Module.symvers | cut -d ' ' -f 1)
- test=$(modinfo -F description $p/extramodules/fglrx.ko.gz | grep "__msm:")
- if [ "$test" != "__msm:$compare" ]; then
- /usr/bin/catalyst_build_module ${p##*/usr/lib/modules/}
- fi
- else /usr/bin/catalyst_build_module ${p##*/usr/lib/modules/}
- fi
- fi
- done
-}
-
-case "$1" in
- help|--help)
- echo "usage: $0 {version|all|remove|remove_all|ra|hookadd|hookrm}"
- echo "- with no specified kernel version it will use the current kernel version to build module"
- echo "- all will try to build fglrx modules for all working system's kernels"
- echo "- remove is removing unused fglrx modules and all empty /usr/lib/modules/* directories"
- echo "- remove_all is removing all fglrx modules and all empty /usr/lib/modules/* directories"
- echo "- ra works same as remove_all"
- echo "- hookadd will add fglrx hook into mkinitcpio"
- echo "- hookrm will remove fglrx hook from mkinitcpio"
- ;;
- remove)
- remove_module
- ;;
- remove_all)
- remove_all_modules
- ;;
- ra)
- remove_all_modules
- ;;
- remove_old)
- remove_old_modules
- ;;
- hookadd)
- hook_add
- ;;
- hookrm)
- hook_remove
- ;;
- all)
- build_all_modules
- ;;
- check)
- check_modules
- ;;
- *)
- test "$1" != "" && kernver="$1"
- echo "Building fglrx module for ${kernver} kernel ..."
- install_module >> $LOG 2>&1 && echo "Ok." || echo -e '\E[37;44m'"\033[1mFailed!!! Check out log: $LOG\033[0m"
- ;;
-esac
diff --git a/dkms.conf b/dkms.conf
new file mode 100644
index 00000000000..66ae6a71115
--- /dev/null
+++ b/dkms.conf
@@ -0,0 +1,7 @@
+PACKAGE_NAME="fglrx"
+PACKAGE_VERSION=@VERSION@
+AUTOINSTALL="yes"
+
+MAKE[0]="sh make.sh --nohints --uname_r=$kernelver --norootcheck"
+BUILT_MODULE_NAME[0]="fglrx"
+DEST_MODULE_LOCATION[0]="/kernel/drivers/video" \ No newline at end of file
diff --git a/hook-fglrx b/hook-fglrx
deleted file mode 100644
index 0d6f9b2f4e9..00000000000
--- a/hook-fglrx
+++ /dev/null
@@ -1,14 +0,0 @@
-# vim: set ft=sh:
-
-build ()
-{
- /usr/bin/catalyst_build_module "$KERNELVERSION"
- /usr/bin/catalyst_build_module remove
-}
-
-help ()
-{
-cat<<HELPEOF
- This hook rebuilds fglrx module. It does nothing to the initrd image.
-HELPEOF
-}
diff --git a/makesh-dont-check-gcc-version.patch b/makesh-dont-check-gcc-version.patch
new file mode 100644
index 00000000000..314c85c8b30
--- /dev/null
+++ b/makesh-dont-check-gcc-version.patch
@@ -0,0 +1,11 @@
+--- 16.5/common/lib/modules/fglrx/build_mod/make.sh 2015-12-18 19:47:41.000000000 +0100
++++ 16.5b/common/lib/modules/fglrx/build_mod/make.sh 2016-05-11 22:04:56.681353509 +0200
+@@ -57,7 +57,7 @@
+
+ if [ -z "${CC}" ]; then
+ CC=gcc
+- set_GCC_version
++# set_GCC_version
+ fi
+
+ # ==============================================================
diff --git a/makesh-src_file.patch b/makesh-src_file.patch
new file mode 100644
index 00000000000..802b55010f6
--- /dev/null
+++ b/makesh-src_file.patch
@@ -0,0 +1,29 @@
+--- 16.6/common/lib/modules/fglrx/build_mod/make.sh 2016-06-12 17:29:48.000000000 +0200
++++ 16.6b/common/lib/modules/fglrx/build_mod/make.sh 2016-05-30 20:44:40.000000000 +0200
+@@ -202,11 +202,23 @@
+ # verify match with respective line in linux/version.h
+ # sample: #define UTS_RELEASE "2.4.0-test7"
+
+-src_file=$linuxincludes/linux/version.h
++# Before kernel 3.7.0 version.h is normally located at linux/version.h
++# For 3.7.0 and later version.h is in generated/uapi/linux/version.h
+
+-if [ ! -e $src_file ]; then
++headerexist=0
++
++for src_file in \
++ "$linuxincludes/linux/version.h" \
++ "$linuxincludes/generated/uapi/linux/version.h";
++do
++if [ -e $src_file ]; then
++ headerexist=1
++ break
++fi
++done
++
++if [ $headerexist -eq 0 ]; then
+ echo "kernel includes at $linuxincludes not found or incomplete" | tee -a $logfile
+- echo "file: $src_file" | tee -a $logfile
+ exit 1
+ fi
+