diff options
-rw-r--r-- | .SRCINFO | 55 | ||||
-rw-r--r-- | PKGBUILD | 109 | ||||
-rw-r--r-- | ati_make.sh | 145 | ||||
-rw-r--r-- | autofglrx.sh | 116 | ||||
-rw-r--r-- | catalyst-daemon.install | 63 | ||||
-rwxr-xr-x | catalyst_build_module | 233 | ||||
-rw-r--r-- | cold-fglrx-3.14-current_euid.patch | 14 | ||||
-rw-r--r-- | fglrx_3.17rc6-no_hotplug.patch | 29 | ||||
-rw-r--r-- | fglrx_gpl_symbol.patch | 11 | ||||
-rw-r--r-- | kolasa-3.19-get_cpu_var.patch | 28 | ||||
-rw-r--r-- | kolasa_4.0-cr4-strn.patch | 70 | ||||
-rw-r--r-- | kolasa_4.1_remove-IRQF_DISABLED.patch | 15 | ||||
-rw-r--r-- | lano1106_fglrx-13.8_proc.patch | 50 | ||||
-rw-r--r-- | lano1106_fglrx_intel_iommu.patch | 11 | ||||
-rw-r--r-- | lano1106_kcl_agp_13_4.patch | 90 | ||||
-rw-r--r-- | makefile_compat.patch | 10 |
16 files changed, 1049 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..9df0f30e9e37 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,55 @@ +pkgbase = catalyst-daemon + pkgdesc = AMD/ATI drivers. Auto re-compile the fglrx module (while system's start) if kernel was updated. DOES NOT SUPPORT SYSTEMD + pkgver = 15.5 + pkgrel = 1 + url = http://www.amd.com + install = catalyst-daemon.install + arch = i686 + arch = x86_64 + license = custom + depends = catalyst-utils + depends = gcc-libs + depends = gcc>4.0.0 + depends = make + depends = patch + provides = catalyst=15.5 + conflicts = catalyst-test + conflicts = catalyst-hook + conflicts = catalyst + conflicts = catalyst-generator + conflicts = catalyst-dkms + options = staticlibs + options = libtool + options = !strip + options = !upx + source = http://www2.ati.com/drivers/linux/amd-catalyst-omega-15.5-linux-run-installers.zip + source = autofglrx.sh + source = catalyst_build_module + source = ati_make.sh + source = makefile_compat.patch + source = lano1106_fglrx_intel_iommu.patch + source = lano1106_kcl_agp_13_4.patch + source = lano1106_fglrx-13.8_proc.patch + source = cold-fglrx-3.14-current_euid.patch + 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.patch + md5sums = 979f9f2e0948fa6e92ff0125f5c6b575 + md5sums = e35dd2ffe748bb976cacab1846a02efd + md5sums = ec268cc09c49bc927fba7375209a0539 + md5sums = f9866a8e58665f9a91251e3f8e7edc72 + md5sums = 3e1b82bd69774ea808da69c983d6a43b + md5sums = 5184b94a2a40216a67996999481dd9ee + md5sums = c5156eddf81c8a1719b160d05a2e8d67 + md5sums = 2ab4837233de42332753882445373d7b + md5sums = ba33b6ef10896d3e1b5e4cd96390b771 + md5sums = ef97fc080ce7e5a275fe0c372bc2a418 + md5sums = 67a22f624bae95a76638ce269392cb01 + md5sums = 3aa45013515b724a71bbd8e01f98ad99 + md5sums = dee3df1c5d3ed87363f4304da917fc00 + md5sums = 81a9e38dee025151cccb7e5db2362cfb + +pkgname = catalyst-daemon + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..df196ef4868e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,109 @@ +# Maintainer: Vi0L0 <vi0l093@gmail.com> +# Great Contributor: B. M. Kwapinski <lord.xml@web.de> (autofglrx daemon idea and most important code) +# Great Contributor: Shen Miren <dickeny@gmail.com> (build_module/hook idea and code) +# Contributor: aidanlinz +# Contributor: Rip-Rip +# Contributor: nob +# Contributor: lano1106 (patch to fix support of intel's iommu and to remove dependency of kernel's CONFIG_AGP option) +# Contributor: lano1106 (patch to remove dependency of kernel's CONFIG_AGP option) +# Contributor: lano1106 (patch to improve jacob's patch) +# Contributor: zoopp +# Contributor: Cold (current_euid patch) +# Contributor: kolasa (3.19, 4.0 & 4.1 kernel patch) + +pkgname=catalyst-daemon +pkgver=15.5 +pkgrel=1 +#_amdver=15.101.1001 +pkgdesc="AMD/ATI drivers. Auto re-compile the fglrx module (while system's start) if kernel was updated. DOES NOT SUPPORT SYSTEMD" +arch=('i686' 'x86_64') +url="http://www.amd.com" +license=('custom') +options=('staticlibs' 'libtool' '!strip' '!upx') +depends=('catalyst-utils' 'gcc-libs' 'gcc>4.0.0' 'make' 'patch') +conflicts=('catalyst-test' 'catalyst-hook' 'catalyst' 'catalyst-generator' 'catalyst-dkms') +provides=("catalyst=${pkgver}") +install=${pkgname}.install + +url_ref="http://support.amd.com/en-us/download/desktop?os=Linux+x86" +DLAGENTS="http::/usr/bin/curl --referer ${url_ref} -o %o %u" + +source=( + http://www2.ati.com/drivers/linux/amd-catalyst-omega-${pkgver}-linux-run-installers.zip + autofglrx.sh + catalyst_build_module + ati_make.sh + makefile_compat.patch + lano1106_fglrx_intel_iommu.patch + lano1106_kcl_agp_13_4.patch + lano1106_fglrx-13.8_proc.patch + cold-fglrx-3.14-current_euid.patch + 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.patch) + +md5sums=('979f9f2e0948fa6e92ff0125f5c6b575' + 'e35dd2ffe748bb976cacab1846a02efd' + 'ec268cc09c49bc927fba7375209a0539' + 'f9866a8e58665f9a91251e3f8e7edc72' + '3e1b82bd69774ea808da69c983d6a43b' + '5184b94a2a40216a67996999481dd9ee' + 'c5156eddf81c8a1719b160d05a2e8d67' + '2ab4837233de42332753882445373d7b' + 'ba33b6ef10896d3e1b5e4cd96390b771' + 'ef97fc080ce7e5a275fe0c372bc2a418' + '67a22f624bae95a76638ce269392cb01' + '3aa45013515b724a71bbd8e01f98ad99' + 'dee3df1c5d3ed87363f4304da917fc00' + '81a9e38dee025151cccb7e5db2362cfb') + + +build() { + ## Unpack archive + /bin/sh ./amd-catalyst-omega-${pkgver}-linux-run-installers.run --extract archive_files +} + +package() { + # License + install -m755 -d ${pkgdir}/usr/share/licenses/${pkgname} + install -m644 ${srcdir}/archive_files/LICENSE.TXT ${pkgdir}/usr/share/licenses/${pkgname} + + cd ${srcdir}/archive_files + + patch -Np1 -i ../makefile_compat.patch + patch -Np1 -i ../lano1106_fglrx_intel_iommu.patch + patch -Np1 -i ../lano1106_kcl_agp_13_4.patch + patch -Np1 -i ../lano1106_fglrx-13.8_proc.patch + patch -Np1 -i ../cold-fglrx-3.14-current_euid.patch + patch -Np1 -i ../fglrx_3.17rc6-no_hotplug.patch + patch -Np1 -i ../kolasa-3.19-get_cpu_var.patch +# test "${CARCH}" = "i686" && patch -Np1 -i ../fglrx_gpl_symbol.patch +# since 3.19 not only i686 needs gpl symbol - V + 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.patch + + # Prepare modules source files + _archdir=x86_64 + test "${CARCH}" = "i686" && _archdir=x86 + install -m755 -d ${pkgdir}/usr/share/ati/build_mod + install -m644 common/lib/modules/fglrx/build_mod/*.c \ + ${pkgdir}/usr/share/ati/build_mod + install -m644 common/lib/modules/fglrx/build_mod/*.h \ + ${pkgdir}/usr/share/ati/build_mod + install -m644 common/lib/modules/fglrx/build_mod/2.6.x/Makefile \ + ${pkgdir}/usr/share/ati/build_mod + 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 + + # modified ati's make.sh script + install -m755 ${srcdir}/ati_make.sh ${pkgdir}/usr/share/ati/build_mod + + # fglrx daemon + install -m755 -d ${pkgdir}/etc/rc.d + install -m755 ${srcdir}/autofglrx.sh ${pkgdir}/etc/rc.d/autofglrx +}
\ No newline at end of file diff --git a/ati_make.sh b/ati_make.sh new file mode 100644 index 000000000000..5d8e56ac1344 --- /dev/null +++ b/ati_make.sh @@ -0,0 +1,145 @@ +#!/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 ${where_modules}/${kernver}/build/include/generated/autoconf.h ]; then + autoconf_h=${where_modules}/${kernver}/build/include/generated/autoconf.h +else + autoconf_h=${where_modules}/${kernver}/build/include/linux/autoconf.h +fi +src_file=$autoconf_h + +if [ ! -e $src_file ]; then + echo "Warning:" + echo "kernel includes at ${where_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 ${where_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=${where_modules}/${kernver}/build/arch/x86/include/asm/compat.h +if [ ! -e $src_file ]; +then + echo "Warning:" + echo "kernel includes at ${where_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/autofglrx.sh b/autofglrx.sh new file mode 100644 index 000000000000..c721893bffdb --- /dev/null +++ b/autofglrx.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + + + +LOG="/var/log/catalyst-install.log" + +kernel=$(uname -r) +if [ -d "/usr/lib/modules/${kernel}" ]; then + where_modules="usr/lib/modules" + elif [ -d "/lib/modules/${kernel}" ]; then + where_modules="lib/modules" +fi + + +build_fglrx() { + rmmod fglrx >/dev/null 2>&1 + /usr/bin/catalyst_build_module "${kernel}" >/dev/null 2>&1 + /usr/bin/catalyst_build_module remove &>> $LOG + + + if [ $? -ne 0 ] + then + stat_append "ERROR: see ${LOG} for details" + stat_die + fi +} + + +check_fglrx() { + compare=$(uname -v) + + if [[ -e /${where_modules}/${kernel}/video/fglrx.ko ]] || [[ -e /${where_modules}/${kernel}/extramodules/fglrx.ko ]] || [[ -e /${where_modules}/${kernel}/video/fglrx.ko.gz ]] || [[ -e /${where_modules}/${kernel}/extramodules/fglrx.ko.gz ]] + then + test=$(modinfo -F description fglrx | grep "__unv:") || stat_die + else + return 0 + fi + + if [ "$test" != "__unv:$compare" ] + then + return 0 + else + return 1 + fi +} + + +load_fglrx() { + stat_append ": Loading fglrx" + modprobe fglrx + + if [ $? -ne 0 ] + then + stat_die + else + stat_done + fi +} + + + +case "$1" in + start) + stat_busy "Checking fglrx" + + + check_fglrx + + if [ $? -eq 0 ] + then + stat_append ": Building fglrx " + build_fglrx + fi + + + load_fglrx + ;; + + stop) + stat_busy "Unloading fglrx" + + + rmmod fglrx + + if [ $? -ne 0 ] + then + stat_fail + else + stat_done + fi + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + status) + if [ -n "$(lsmod | grep fglrx)" ] + then + stat_busy "Module fglrx is loaded" + stat_done + else + stat_busy "Module fglrx is not loaded" + stat_fail + fi + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" +esac + diff --git a/catalyst-daemon.install b/catalyst-daemon.install new file mode 100644 index 000000000000..2a73c8f3fe4a --- /dev/null +++ b/catalyst-daemon.install @@ -0,0 +1,63 @@ + +whisperer(){ + echo "----------------------------------------------------------------" + echo "Automatic re-compilation is enabled now." + echo "----------------------------------------------------------------" + echo "Provide headers to your kernel ie:" + echo "linux-headers if you are using linux." + echo "Most of custom kernels provides own headers." + echo "----------------------------------------------------------------" + echo "You may safely remove fglrx from MODULES array of /etc/rc.conf" + 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 "---------------------------------------- ^^^^^^^^^ -------------" + echo "If experiencing problems with building module or using more than" + echo "one kernel use catalyst_build_module command as root, more info:" + echo "# catalyst_build_module help" + echo "- ^^^^^^^^^^^^^^^^^^^^^ ----------------------------------------" + echo "For more info and more troubleshooting visit:" + echo "http://wiki.archlinux.org/index.php/ATI_Catalyst" + echo "----------------------------------------------------------------" +} + +mr_daemon(){ + ##removing hook's entries + # remove hook fglrx + sed '/^HOOKS/s/ *fglrx//' -i etc/mkinitcpio.conf + # remove heads + sed '/^SyncFirst/s/ *kernel26-headers//' -i etc/pacman.conf + + # add autofglrx daemon to rc.conf + angel=$(grep ^DAEMONS etc/rc.conf | grep autofglrx) + if [ "$angel" = "" ]; then + sed 's/DAEMONS=(/DAEMONS=(autofglrx /' -i etc/rc.conf + fi +} + + +post_install(){ + mr_daemon + usr/bin/catalyst_build_module remove_old + usr/bin/catalyst_build_module + whisperer +} + +post_upgrade(){ + mr_daemon + usr/bin/catalyst_build_module remove_old + usr/bin/catalyst_build_module +} + +pre_remove(){ + usr/bin/catalyst_build_module remove_all +} + +post_remove(){ + # remove autofglrx + sed 's/DAEMONS=(autofglrx /DAEMONS=(/' -i etc/rc.conf + # If the symlink is dead, remove it + + # remove log + rm -f var/log/catalyst-install.log +} diff --git a/catalyst_build_module b/catalyst_build_module new file mode 100755 index 000000000000..a01ed0f5f187 --- /dev/null +++ b/catalyst_build_module @@ -0,0 +1,233 @@ +#!/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}" ]; then + where_modules="/usr/lib/modules" + elif [ -d "/lib/modules/${kernver}" ]; then + where_modules="/lib/modules" + fi + + if [ ! -d "${where_modules}/${kernver}/build" ]; then + echo "Kernel header files are absent: directory ${where_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 + sed "/MODULE_DESCRIPTION/a\MODULE_DESCRIPTION(\"__unv:$(uname -v)\");" -i firegl_public.c +#------------------------------------------------------------------------------------------ + + ## 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 ${where_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 + + gzip -9 fglrx.ko + + ## here we are checking kernel's extramodules dir + for r in ${where_modules}/*; do + if [ $where_modules = "/usr/lib/modules" ]; then + s=${r:17} + elif [ $where_modules = "/lib/modules" ]; then + s=${r:13} + fi + if [[ ${s:0:3} = "ext" ]]; then + if [[ `cat ${r}/version | grep -c ${kernver}` != 0 ]]; then + destidir=${s} + fi + elif [[ ${s} = ${kernver} ]] && [[ ! -e ${r}/extramodules ]]; then + destidir=${kernver}/video + fi + done + + install -m755 -d "${where_modules}/${destidir}/" || return 1 + install -m644 fglrx.ko.gz "${where_modules}/${destidir}/" || return 1 + + + depmod ${kernver} + rm -rf "${workdir}" +# set +x + echo "Ok. Module built succesfully." +} + +remove_module(){ +if [ -d "/usr/lib/modules" ]; then + for p in /usr/lib/modules/*; do + if [[ ${p:17:3} != "ext" ]]; then + if [ ! -d $p/kernel ]; then #check if /usr/lib/modules/p/kernel directory does NOT exist + 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 #check if ${where_modules}/p exist + if [ -z "$(ls $p)" ]; then #check if ${where_modules}/p is empty + echo "+ removing empty directory: $p" + rm -rf $p + else echo "- $p looks like unused, maybe remove it manualy?" + fi + fi + fi + fi + done +fi + +if [ -d "/lib/modules" ]; then + for p in /lib/modules/*; do + if [[ ${p:13:3} != "ext" ]]; then + if [ ! -d $p/kernel ]; then #check if /lib/modules/p/kernel directory does NOT exist + 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 #check if ${where_modules}/p exist + if [ -z "$(ls $p)" ]; then #check if ${where_modules}/p is empty + echo "+ removing empty directory: $p" + rm -rf $p + else echo "- $p looks like unused, maybe remove it manualy?" + fi + fi + fi + fi + done +fi +} + +remove_all_modules(){ +if [ -d "/usr/lib/modules" ]; then + 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 #check if /usr/lib/modules/p exist + 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 +fi + +if [ -d "/lib/modules" ]; then + for p in /lib/modules/*; do + if [[ ${p:13: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 #check if ${where_modules}/p exist + if [ -z "$(ls $p)" ]; then #check if ${where_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 +fi +} + +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 +} + +auto_recompile(){ + # add autofglrx daemon to rc.conf + angel=$(grep ^DAEMONS /etc/rc.conf | grep autofglrx) + if [ "$angel" = "" ]; then + sed 's/DAEMONS=(/DAEMONS=(autofglrx /' -i /etc/rc.conf + fi + echo "Auto re-compilation is Enabled." +} + +auto_recompile_off(){ + # remove autofglrx + sed '/^DAEMONS/s/ *autofglrx //' -i /etc/rc.conf + echo "Auto re-compilation is Disabled." +} + +case "$1" in + help|--help) + echo "usage: $0 {remove|remove_all|auto|autooff}" + echo "- remove is removing unused fglrx modules and all empty /lib/modules/* directories" + echo "- remove_all is removing all fglrx modules and all empty /lib/modules/* directories" + echo "- auto will turn ON 'auto re-compilation of fglrx module when system is starting'" + echo "- autooff will turn off auto re-compilation of fglrx module" + ;; + remove) + remove_module + ;; + remove_all) + remove_all_modules + ;; + remove_old) + remove_old_modules + ;; + auto) + auto_recompile + ;; + autooff) + auto_recompile_off + ;; + *) + echo "Building fglrx module for ${kernver} kernel ..." + install_module >> $LOG 2>&1 && echo "Ok." || echo "Failed!!! Check out log: $LOG" + ;; +esac + diff --git a/cold-fglrx-3.14-current_euid.patch b/cold-fglrx-3.14-current_euid.patch new file mode 100644 index 000000000000..77bfe2565492 --- /dev/null +++ b/cold-fglrx-3.14-current_euid.patch @@ -0,0 +1,14 @@ +--- 14.1/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-02-23 19:26:52.215995002 +0100 ++++ 14.1/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-02-23 19:27:59.320999596 +0100 +@@ -1761,7 +1761,11 @@ + #else + + #ifdef current_euid ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) ++ return __kuid_val(current_euid()); ++#else + return current_euid(); ++#endif + #else + return current->euid; + #endif diff --git a/fglrx_3.17rc6-no_hotplug.patch b/fglrx_3.17rc6-no_hotplug.patch new file mode 100644 index 000000000000..7fbe1a25064c --- /dev/null +++ b/fglrx_3.17rc6-no_hotplug.patch @@ -0,0 +1,29 @@ +diff -uNr 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c +--- 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-09-09 16:10:17.000000000 +0200 ++++ 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-09-26 19:01:44.000000000 +0200 +@@ -1093,6 +1093,9 @@ + // directly here to allow suspend/resume without X server start. + firegl_pci_save_state((KCL_PCI_DevHandle)pdev, privdev); + pci_disable_device(pdev); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) ++ pci_ignore_hotplug(pdev); ++#endif + PMSG_EVENT(pdev->dev.power.power_state) = state; + } + else +diff -uNr 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c +--- 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2014-09-09 16:10:17.000000000 +0200 ++++ 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2014-09-26 18:57:27.000000000 +0200 +@@ -840,10 +840,12 @@ + if(tdev != NULL) + { + device = (acpi_device_adr(tdev) >> 16) & 0xffff; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0) + if(PCI_SLOT(pdev->devfn) == device) + { + tdev->flags.no_hotplug = true; + } ++#endif + } + #endif + return 0; diff --git a/fglrx_gpl_symbol.patch b/fglrx_gpl_symbol.patch new file mode 100644 index 000000000000..2030b9eadd57 --- /dev/null +++ b/fglrx_gpl_symbol.patch @@ -0,0 +1,11 @@ +--- 13.1/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-01-15 22:33:27.000000000 +0100 ++++ 13.1/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-08-18 20:05:44.327520475 +0200 +@@ -250,7 +250,7 @@ + #endif + + #ifdef MODULE_LICENSE +-MODULE_LICENSE("Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY"); ++MODULE_LICENSE("GPL\0Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY"); + #endif + #ifdef MODULE_DEVICE_TABLE + MODULE_DEVICE_TABLE(pci, fglrx_pci_table); diff --git a/kolasa-3.19-get_cpu_var.patch b/kolasa-3.19-get_cpu_var.patch new file mode 100644 index 000000000000..5a571da9fd96 --- /dev/null +++ b/kolasa-3.19-get_cpu_var.patch @@ -0,0 +1,28 @@ +--- 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-12-11 00:15:11.000000000 +0100 ++++ 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-01-01 21:39:40.471543282 +0100 +@@ -4823,8 +4823,13 @@ + { + unsigned long orig_level; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) ++ orig_level = __this_cpu_read(kasExecutionLevel); ++ __this_cpu_write(kasExecutionLevel,level); ++#else + orig_level = __get_cpu_var(kasExecutionLevel); + __get_cpu_var(kasExecutionLevel) = level; ++#endif + + return orig_level; + } +@@ -4836,7 +4841,11 @@ + */ + static unsigned long kas_GetExecutionLevel(void) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) ++ return __this_cpu_read(kasExecutionLevel); ++#else + return __get_cpu_var(kasExecutionLevel); ++#endif + } + + /** \brief Type definition for kas_spin_lock() parameter */ diff --git a/kolasa_4.0-cr4-strn.patch b/kolasa_4.0-cr4-strn.patch new file mode 100644 index 000000000000..7bce698bad33 --- /dev/null +++ b/kolasa_4.0-cr4-strn.patch @@ -0,0 +1,70 @@ +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.patch b/kolasa_4.1_remove-IRQF_DISABLED.patch new file mode 100644 index 000000000000..f0b1b62756e9 --- /dev/null +++ b/kolasa_4.1_remove-IRQF_DISABLED.patch @@ -0,0 +1,15 @@ +--- 15.3/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-03-06 17:44:48.000000000 +0100 ++++ 15.3/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-06-04 12:12:04.997661763 +0200 +@@ -3496,7 +3496,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_NOBALANCING) : (IRQF_SHARED)), ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) ++ ((useMSI) ? (IRQF_DISABLED | IRQF_NOBALANCING) : (IRQF_SHARED)), ++#else ++ ((useMSI) ? (IRQF_NOBALANCING) : (IRQF_SHARED)), ++#endif + #endif + dev_name, + context); diff --git a/lano1106_fglrx-13.8_proc.patch b/lano1106_fglrx-13.8_proc.patch new file mode 100644 index 000000000000..e2ec7c30d0d0 --- /dev/null +++ b/lano1106_fglrx-13.8_proc.patch @@ -0,0 +1,50 @@ +--- 13.8/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-09-26 00:59:28.292596334 -0400 ++++ 13.8/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-09-26 01:02:35.036252455 -0400 +@@ -821,7 +821,7 @@ static struct proc_dir_entry *firegl_pro + KCL_DEBUG1(FN_FIREGL_PROC, "minor %d, proc_list 0x%08lx\n", minor, (unsigned long)proc_list); + if (!minor) + { +- root = KCL_create_proc_dir(NULL, "ati", S_IRUGO|S_IXUGO); ++ root = KCL_create_proc_dir(NULL, "ati", 0); + } + + if (!root) +@@ -835,7 +835,7 @@ static struct proc_dir_entry *firegl_pro + // Global major debice number entry and Global debug entry + while (globallist->rp || globallist->fops) + { +- ent = KCL_create_proc_entry(root, globallist->name, S_IFREG|S_IRUGO, globallist->fops, globallist->rp, globallist->wp, dev); ++ ent = KCL_create_proc_entry(root, globallist->name, 0, globallist->fops, globallist->rp, globallist->wp, dev); + if (!ent) + { + KCL_remove_proc_dir_entry(NULL, "ati"); +@@ -847,7 +847,7 @@ static struct proc_dir_entry *firegl_pro + } + + sprintf(name, "%d", minor); +- *dev_root = KCL_create_proc_dir(root, name, S_IRUGO|S_IXUGO); ++ *dev_root = KCL_create_proc_dir(root, name, 0); + if (!*dev_root) { + KCL_remove_proc_dir_entry(root, "major"); + KCL_remove_proc_dir_entry(NULL, "ati"); +@@ -857,7 +857,7 @@ static struct proc_dir_entry *firegl_pro + + while (list->rp || list->fops) + { +- ent = KCL_create_proc_entry(*dev_root, list->name, S_IFREG|S_IRUGO, list->fops, list->rp, list->wp, ++ ent = KCL_create_proc_entry(*dev_root, list->name, 0, list->fops, list->rp, list->wp, + ((dev->pubdev.signature == FGL_DEVICE_SIGNATURE)? firegl_find_device(minor) : (dev))); + if (!ent) + { +@@ -6358,9 +6358,9 @@ void * KCL_create_proc_dir(void *root_di + dir = create_proc_entry(name, S_IFDIR | access, (struct proc_dir_entry *)root_dir); + #else + if (root_dir == NULL) +- dir = proc_mkdir_mode(name, S_IFDIR | access, NULL); ++ dir = proc_mkdir_mode(name, access, NULL); + else +- dir = proc_mkdir_mode(name, S_IFDIR | access, (struct proc_dir_entry *)root_dir); ++ dir = proc_mkdir_mode(name, access, (struct proc_dir_entry *)root_dir); + #endif + + return dir; diff --git a/lano1106_fglrx_intel_iommu.patch b/lano1106_fglrx_intel_iommu.patch new file mode 100644 index 000000000000..101654c41c68 --- /dev/null +++ b/lano1106_fglrx_intel_iommu.patch @@ -0,0 +1,11 @@ +--- 13.4/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-04-16 23:29:55.000000000 +0200 ++++ 13.4/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-05-21 17:05:34.726681102 +0200 +@@ -93,7 +93,7 @@ + and they use different config options. These options can only be enabled + on x86_64 with newer 2.6 kernels (2.6.23 for intel, 2.6.26 for amd). + */ +-#if defined(CONFIG_AMD_IOMMU) || defined(CONFIG_DMAR) ++#if defined(CONFIG_AMD_IOMMU) || defined(CONFIG_INTEL_IOMMU) + #define FIREGL_DMA_REMAPPING + #endif + diff --git a/lano1106_kcl_agp_13_4.patch b/lano1106_kcl_agp_13_4.patch new file mode 100644 index 000000000000..d39c5aaeb108 --- /dev/null +++ b/lano1106_kcl_agp_13_4.patch @@ -0,0 +1,90 @@ +--- 13.4/common/lib/modules/fglrx/build_mod/kcl_agp.c 2013-05-24 16:45:52.236740084 -0400 ++++ 13.4/common/lib/modules/fglrx/build_mod/kcl_agp.c 2013-05-24 16:49:29.283579408 -0400 +@@ -56,6 +56,43 @@ unsigned int KCL_AGP_IsInUse(void) + return kcl_agp_is_in_use; + } + ++/** \brief Find AGP caps registers in PCI config space ++ ** \param dev PCI device handle ++ ** \return Positive register index on success, negative errno on error ++ */ ++int ATI_API_CALL KCL_AGP_FindCapsRegisters(KCL_PCI_DevHandle dev) ++{ ++ u8 capndx; ++ u32 cap_id; ++ ++ if (!dev) ++ { ++ return -ENODEV; ++ } ++ ++ pci_read_config_byte((struct pci_dev*)dev, 0x34, &capndx); ++ ++ if (capndx == 0x00) ++ { ++ return -ENODATA; ++ } ++ ++ do ++ { // search capability list for AGP caps ++ pci_read_config_dword((struct pci_dev*)dev, capndx, &cap_id); ++ ++ if ((cap_id & 0xff) == 0x02) ++ { ++ return capndx; ++ } ++ ++ capndx = (cap_id >> 8) & 0xff; ++ } ++ while (capndx != 0x00); ++ ++ return -ENODATA; ++} ++ + #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) + + typedef struct { +@@ -272,43 +309,6 @@ int ATI_API_CALL KCL_AGP_Enable(unsigned + } + } + +-/** \brief Find AGP caps registers in PCI config space +- ** \param dev PCI device handle +- ** \return Positive register index on success, negative errno on error +- */ +-int ATI_API_CALL KCL_AGP_FindCapsRegisters(KCL_PCI_DevHandle dev) +-{ +- u8 capndx; +- u32 cap_id; +- +- if (!dev) +- { +- return -ENODEV; +- } +- +- pci_read_config_byte((struct pci_dev*)dev, 0x34, &capndx); +- +- if (capndx == 0x00) +- { +- return -ENODATA; +- } +- +- do +- { // search capability list for AGP caps +- pci_read_config_dword((struct pci_dev*)dev, capndx, &cap_id); +- +- if ((cap_id & 0xff) == 0x02) +- { +- return capndx; +- } +- +- capndx = (cap_id >> 8) & 0xff; +- } +- while (capndx != 0x00); +- +- return -ENODATA; +-} +- + /** \brief Get AGP caps + ** \param dev PCI device handle + ** \param caps pointer to caps vector diff --git a/makefile_compat.patch b/makefile_compat.patch new file mode 100644 index 000000000000..defa3d8d8d5e --- /dev/null +++ b/makefile_compat.patch @@ -0,0 +1,10 @@ +--- 10.10/common/lib/modules/fglrx/build_mod/2.6.x/Makefile 2010-09-22 09:15:33.000000000 +0200 ++++ 10.10/common/lib/modules/fglrx/build_mod/2.6.x/Makefile 2010-10-01 17:57:21.057820899 +0200 +@@ -66,6 +66,7 @@ + -DFGL_GART_RESERVED_SLOT \ + -DFGL_LINUX253P1_VMA_API \ + -DPAGE_ATTR_FIX=$(PAGE_ATTR_FIX) \ ++ -DCOMPAT_ALLOC_USER_SPACE=$(COMPAT_ALLOC_USER_SPACE) \ + + ifeq ($(KERNELRELEASE),) + # on first call from remote location we get into this path |