diff options
author | Vi0L0 | 2015-06-08 20:45:00 +0200 |
---|---|---|
committer | Vi0L0 | 2015-06-08 20:45:00 +0200 |
commit | 27357157125bc30c297ff1ddf9efc3462e1fe359 (patch) | |
tree | 4d2c77cbbafcadba72bf46209046225d004f8e75 | |
download | aur-27357157125bc30c297ff1ddf9efc3462e1fe359.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 108 | ||||
-rw-r--r-- | 3.5-do_mmap.patch | 50 | ||||
-rw-r--r-- | PKGBUILD | 355 | ||||
-rw-r--r-- | arch-fglrx-3.7.patch | 132 | ||||
-rw-r--r-- | arch-fglrx-3.8.patch | 13 | ||||
-rw-r--r-- | arch-fglrx-authatieventsd_new.patch | 88 | ||||
-rw-r--r-- | arch_3.13_kernel_acpi_node.patch | 13 | ||||
-rw-r--r-- | ati_make.sh | 145 | ||||
-rw-r--r-- | atieventsd.service | 9 | ||||
-rw-r--r-- | atieventsd.sh | 41 | ||||
-rw-r--r-- | catalyst-hook.service | 14 | ||||
-rw-r--r-- | catalyst-total-hd234k.install | 71 | ||||
-rw-r--r-- | catalyst.conf | 1 | ||||
-rw-r--r-- | catalyst.sh | 11 | ||||
-rwxr-xr-x | catalyst_build_module | 201 | ||||
-rw-r--r-- | cold-fglrx-3.14-current_euid.patch | 14 | ||||
-rw-r--r-- | fglrx_gpl_symbol.patch | 11 | ||||
-rw-r--r-- | foutrelis_3.10_fix_for_legacy.patch | 13 | ||||
-rw-r--r-- | gentoo_linux-3.10-proc.diff | 293 | ||||
-rw-r--r-- | hook-fglrx | 14 | ||||
-rw-r--r-- | kolasa-3.19-get_cpu_var.patch | 28 | ||||
-rw-r--r-- | kolasa_4.0-cr4-strn.patch | 70 | ||||
-rw-r--r-- | lano1106_fglrx_intel_iommu.patch | 11 | ||||
-rw-r--r-- | lano1106_kcl_agp_13_4.patch | 90 | ||||
-rw-r--r-- | lib32-catalyst.sh | 2 | ||||
-rw-r--r-- | makefile_compat.patch | 10 |
26 files changed, 1808 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..095205d1996f --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,108 @@ +pkgbase = catalyst-total-hd234k + pkgdesc = AMD/ATI legacy drivers. catalyst-hook + catalyst-utils + lib32-catalyst-utils + pkgver = 13.1 + pkgrel = 30 + url = http://www.amd.com + install = catalyst-total-hd234k.install + arch = i686 + arch = x86_64 + license = custom + depends = linux>=3.0 + depends = linux<4.1 + depends = linux-headers + depends = xorg-server>=1.7.0 + depends = xorg-server<1.13.0 + depends = netkit-bsd-finger + depends = libxrandr + depends = libsm + depends = fontconfig + depends = libxcursor + depends = libxi + depends = gcc-libs + depends = gcc>4.0.0 + depends = make + depends = patch + depends = libxinerama + depends = mesa>=10.1.0-4 + 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 + optdepends = acpid: acpi event support / atieventsd + optdepends = linux-lts-headers: to build the fglrx module for the linux-lts kernel + provides = libgl + provides = libatical=13.1 + provides = catalyst=13.1 + provides = catalyst-utils=13.1 + provides = catalyst-hook=13.1 + provides = catalyst-libgl=13.1 + provides = opencl-catalyst=13.1 + provides = libcl + provides = dri + provides = libtxc_dxtn + conflicts = libgl + conflicts = xf86-video-ati + conflicts = xf86-video-radeonhd + conflicts = catalyst-test + conflicts = nvidia-utils + conflicts = nvidia + conflicts = catalyst + conflicts = catalyst-daemon + conflicts = catalyst-generator + conflicts = catalyst-hook + conflicts = catalyst-utils + conflicts = libcl + options = staticlibs + options = libtool + 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 = 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 = arch-fglrx-3.8.patch + source = gentoo_linux-3.10-proc.diff + source = foutrelis_3.10_fix_for_legacy.patch + source = lano1106_fglrx_intel_iommu.patch + source = lano1106_kcl_agp_13_4.patch + source = arch_3.13_kernel_acpi_node.patch + source = cold-fglrx-3.14-current_euid.patch + source = fglrx_gpl_symbol.patch + source = kolasa-3.19-get_cpu_var.patch + source = kolasa_4.0-cr4-strn.patch + md5sums = c07fd1332abe4c742a9a0d0e0d0a90de + md5sums = 769d233666d4353f514b5d7ff035f6b6 + md5sums = af7fb8ee4fc96fd54c5b483e33dc71c4 + md5sums = bdafe749e046bfddee2d1c5e90eabd83 + md5sums = f729bf913613f49b0b9759c246058a87 + md5sums = bccf181a981ff429fe66f6ca5c3ea75a + md5sums = 3e19c2285c76f4cb92108435a1e9c302 + md5sums = b3ceefeb97c609037845f65d0956c4f0 + md5sums = 9126e1ef0c724f8b57d3ac0fe77efe2f + md5sums = 62239156a9656c6f41e89a879578925c + md5sums = 3e1b82bd69774ea808da69c983d6a43b + md5sums = a64e2eae5addc6d670911ccf94b8cda4 + md5sums = a450e2e3db61994b09e9d99d95bee837 + md5sums = ff60c162b46e21e9810a722718023451 + md5sums = 52a79bddac813f19f72fcb32acebb1b9 + md5sums = 5872d95907a93ada44982e355e91e59d + md5sums = 5d6b5ae55adfb4909e042f50400a4e2d + md5sums = 5184b94a2a40216a67996999481dd9ee + md5sums = c5156eddf81c8a1719b160d05a2e8d67 + md5sums = 25e7c640aeafb08bb5593b647c69cf9b + md5sums = ba33b6ef10896d3e1b5e4cd96390b771 + md5sums = ef97fc080ce7e5a275fe0c372bc2a418 + md5sums = 3aa45013515b724a71bbd8e01f98ad99 + md5sums = dee3df1c5d3ed87363f4304da917fc00 + +pkgname = catalyst-total-hd234k + diff --git a/3.5-do_mmap.patch b/3.5-do_mmap.patch new file mode 100644 index 000000000000..04248eb7bc5d --- /dev/null +++ b/3.5-do_mmap.patch @@ -0,0 +1,50 @@ +--- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2012-06-15 18:30:13.483762070 +0200 ++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2012-06-17 17:47:36.543041869 +0200 +@@ -2106,6 +2106,12 @@ + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) ++# define NO_DO_MMAP ++# define do_mmap(a,b,c,d,e,f) vm_mmap(a, b, c, d, e, f) ++# define do_munmap(a,b,c) vm_munmap(b, c) ++#endif ++ + unsigned long ATI_API_CALL KCL_MEM_AllocLinearAddrInterval( + KCL_IO_FILE_Handle file, + unsigned long addr, +@@ -2117,10 +2123,13 @@ + + flags = MAP_SHARED; + prot = PROT_READ|PROT_WRITE; +- ++#ifdef NO_DO_MMAP ++ vaddr = (void *) vm_mmap(file, 0, len, prot, flags, pgoff); ++#else + down_write(¤t->mm->mmap_sem); + vaddr = (void *) do_mmap(file, 0, len, prot, flags, pgoff); + up_write(¤t->mm->mmap_sem); ++#endif + if (IS_ERR(vaddr)) + return 0; + else +@@ -2131,7 +2140,9 @@ + { + int retcode = 0; + ++#ifndef NO_DO_MMAP + down_write(¤t->mm->mmap_sem); ++#endif + #ifdef FGL_LINUX_RHEL_MUNMAP_API + retcode = do_munmap(current->mm, + addr, +@@ -2142,7 +2153,9 @@ + addr, + len); + #endif ++#ifndef NO_DO_MMAP + up_write(¤t->mm->mmap_sem); ++#endif + return retcode; + } + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..263c2113766c --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,355 @@ +# Maintainer: Vi0L0 <vi0l093@gmail.com> +# Great Contributor: Shen Miren <dickeny@gmail.com> (build_module/hook idea and code) +# Great Contributor: Eduardo "kensai" Romero (previous catalyst and catalyst-utils maintainer) +# Contributor: Manuel Gaul <inkaine@hotmail.com> (previous lib32-catalyst-utils maintainer) +# Contributor: osmano807 +# Contributor: csslayer +# Contributor: cyberpatrol +# Contributor: aidanlinz +# Contributor: Rip-Rip +# Contributor: OvsInc +# Contributor: Enverex & kidoz +# Contributor: nob +# Contributor: lordheavy +# Contributor: lano1106 (patch to fix support of intel's iommu and to remove dependency of kernel's CONFIG_AGP option) +# Contributor: Emil Karlson from gentoo (3.10 kernel patch) +# Contributor: zoqaeski (authatieventsd' patch for lightdm) +# Contributor: zoopp +# Contributor: solar (authatieventsd' patch s/-1/255) +# Contributor: Cold (current_euid patch) +# Contributor: kolasa (3.19 and 4.0 kernel patch) + + +# 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=30 +pkgdesc="AMD/ATI legacy drivers. catalyst-hook + 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.1' 'linux-headers' 'xorg-server>=1.7.0' 'xorg-server<1.13.0' 'netkit-bsd-finger' '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') + +if [ "${CARCH}" = "x86_64" ]; then + warning "x86_64 system detected" + warning "[multilib] repository must be uncommented in /etc/pacman.conf to add lib32-catalyst-utils into the package" + if [[ `cat /etc/pacman.conf | grep -c "#\[multilib]"` = 0 ]]; then + warning "OK, lib32-catalyst-utils will be added to the package" + depends+=('lib32-libxext' 'lib32-libdrm' 'lib32-libxinerama' 'lib32-mesa>=10.1.0-4') + conflicts+=('lib32-libgl' 'lib32-nvidia-utils' 'lib32-catalyst-utils' 'lib32-libcl') + provides+=('lib32-libgl' "lib32-catalyst-utils=${pkgver}" "lib32-catalyst-libgl=${pkgver}" "lib32-opencl-catalyst=${pkgver}" 'lib32-dri' 'lib32-libtxc_dxtn' 'lib32-libcl') + else + warning "lib32-catalyst-utils will NOT be added to the package" + fi +fi + +install=${pkgname}.install + +url_ref="http://support.amd.com/en-us/kb-articles/Pages/latest-linux-beta-driver.aspx" +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 + 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 + arch-fglrx-3.8.patch + gentoo_linux-3.10-proc.diff + foutrelis_3.10_fix_for_legacy.patch + lano1106_fglrx_intel_iommu.patch + lano1106_kcl_agp_13_4.patch + arch_3.13_kernel_acpi_node.patch + cold-fglrx-3.14-current_euid.patch + fglrx_gpl_symbol.patch + kolasa-3.19-get_cpu_var.patch + kolasa_4.0-cr4-strn.patch) + +md5sums=('c07fd1332abe4c742a9a0d0e0d0a90de' + '769d233666d4353f514b5d7ff035f6b6' + 'af7fb8ee4fc96fd54c5b483e33dc71c4' + 'bdafe749e046bfddee2d1c5e90eabd83' + 'f729bf913613f49b0b9759c246058a87' + 'bccf181a981ff429fe66f6ca5c3ea75a' + '3e19c2285c76f4cb92108435a1e9c302' + 'b3ceefeb97c609037845f65d0956c4f0' + '9126e1ef0c724f8b57d3ac0fe77efe2f' + '62239156a9656c6f41e89a879578925c' + '3e1b82bd69774ea808da69c983d6a43b' + 'a64e2eae5addc6d670911ccf94b8cda4' + 'a450e2e3db61994b09e9d99d95bee837' + 'ff60c162b46e21e9810a722718023451' + '52a79bddac813f19f72fcb32acebb1b9' + '5872d95907a93ada44982e355e91e59d' + '5d6b5ae55adfb4909e042f50400a4e2d' + '5184b94a2a40216a67996999481dd9ee' + 'c5156eddf81c8a1719b160d05a2e8d67' + '25e7c640aeafb08bb5593b647c69cf9b' + 'ba33b6ef10896d3e1b5e4cd96390b771' + 'ef97fc080ce7e5a275fe0c372bc2a418' + '3aa45013515b724a71bbd8e01f98ad99' + 'dee3df1c5d3ed87363f4304da917fc00') + + +build() { + ## Unpack archive + /bin/sh ./amd-driver-installer-catalyst-${pkgver}-legacy-linux-x86.x86_64.run --extract archive_files +} + +package() { +##catalyst-utils section + ## Install userspace tools and libraries + # Create directories + install -m755 -d ${pkgdir}/etc/ati + install -m755 -d ${pkgdir}/etc/rc.d + install -m755 -d ${pkgdir}/etc/profile.d + install -m755 -d ${pkgdir}/etc/acpi/events + install -m755 -d ${pkgdir}/etc/security/console.apps + install -m755 -d ${pkgdir}/etc/OpenCL/vendors + + install -m755 -d ${pkgdir}/usr/lib/xorg/modules/dri + install -m755 -d ${pkgdir}/usr/lib/xorg/modules/drivers + install -m755 -d ${pkgdir}/usr/lib/xorg/modules/extensions + install -m755 -d ${pkgdir}/usr/lib/xorg/modules/extensions/fglrx + install -m755 -d ${pkgdir}/usr/lib/xorg/modules/linux + install -m755 -d ${pkgdir}/usr/lib/dri + install -m755 -d ${pkgdir}/usr/lib/fglrx + install -m755 -d ${pkgdir}/usr/lib/systemd/system + + install -m755 -d ${pkgdir}/usr/bin + + install -m755 -d ${pkgdir}/usr/include/GL + + install -m755 -d ${pkgdir}/usr/share/applications + install -m755 -d ${pkgdir}/usr/share/ati/amdcccle + install -m755 -d ${pkgdir}/usr/share/licenses/${pkgname} + install -m755 -d ${pkgdir}/usr/share/man/man8 + install -m755 -d ${pkgdir}/usr/share/pixmaps + + # X.org driver + if [ "${CARCH}" = "i686" ]; then + cd ${srcdir}/archive_files/xpic/usr/X11R6/lib/modules + elif [ "${CARCH}" = "x86_64" ]; then + cd ${srcdir}/archive_files/xpic_64a/usr/X11R6/lib64/modules + fi + + install -m755 *.so ${pkgdir}/usr/lib/xorg/modules + install -m755 drivers/*.so ${pkgdir}/usr/lib/xorg/modules/drivers + install -m755 linux/*.so ${pkgdir}/usr/lib/xorg/modules/linux + install -m755 extensions/fglrx/fglrx-libglx.so ${pkgdir}/usr/lib/xorg/modules/extensions/fglrx/fglrx-libglx.so + ln -snf /usr/lib/xorg/modules/extensions/fglrx/fglrx-libglx.so ${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so + + # Controlcenter / libraries + if [ "${CARCH}" = "i686" ]; then + cd ${srcdir}/archive_files/arch/x86/usr + _lib=lib + elif [ "${CARCH}" = "x86_64" ]; then + cd ${srcdir}/archive_files/arch/x86_64/usr + _lib=lib64 + fi + + install -m755 X11R6/bin/* ${pkgdir}/usr/bin + install -m755 sbin/* ${pkgdir}/usr/bin + install -m755 X11R6/${_lib}/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib/fglrx + ln -snf /usr/lib/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib/fglrx/libGL.so.1.2 + ln -snf /usr/lib/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib/fglrx-libGL.so.1.2 + ln -snf /usr/lib/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib/libGL.so.1.2 + ln -snf /usr/lib/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib/libGL.so.1 + ln -snf /usr/lib/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib/libGL.so + install -m755 X11R6/${_lib}/libAMDXvBA.so.1.0 ${pkgdir}/usr/lib + ln -snf libAMDXvBA.so.1.0 ${pkgdir}/usr/lib/libAMDXvBA.so.1 + ln -snf libAMDXvBA.so.1.0 ${pkgdir}/usr/lib/libAMDXvBA.so + install -m755 X11R6/${_lib}/libatiadlxx.so ${pkgdir}/usr/lib + install -m755 X11R6/${_lib}/libfglrx_dm.so.1.0 ${pkgdir}/usr/lib + install -m755 X11R6/${_lib}/libXvBAW.so.1.0 ${pkgdir}/usr/lib + ln -snf libXvBAW.so.1.0 ${pkgdir}/usr/lib/libXvBAW.so.1 + ln -snf libXvBAW.so.1.0 ${pkgdir}/usr/lib/libXvBAW.so + install -m644 X11R6/${_lib}/*.a ${pkgdir}/usr/lib + install -m644 X11R6/${_lib}/*.cap ${pkgdir}/usr/lib + install -m755 X11R6/${_lib}/modules/dri/*.so ${pkgdir}/usr/lib/xorg/modules/dri + install -m755 ${_lib}/*.so* ${pkgdir}/usr/lib + + ## QT libs (only 2 files) - un-comment 2 lines below if you don't want to install qt package +# install -m755 -d ${pkgdir}/usr/share/ati/${_lib} +# install -m755 share/ati/${_lib}/*.so* ${pkgdir}/usr/share/ati/${_lib} + + ln -snf /usr/lib/xorg/modules/dri/fglrx_dri.so ${pkgdir}/usr/lib/dri/fglrx_dri.so + ln -snf libfglrx_dm.so.1.0 ${pkgdir}/usr/lib/libfglrx_dm.so.1 + ln -snf libfglrx_dm.so.1.0 ${pkgdir}/usr/lib/libfglrx_dm.so + ln -snf libatiuki.so.1.0 ${pkgdir}/usr/lib/libatiuki.so.1 + ln -snf libatiuki.so.1.0 ${pkgdir}/usr/lib/libatiuki.so + ln -snf libOpenCL.so.1 ${pkgdir}/usr/lib/libOpenCL.so + + # We have to provide symlinks to mesa, as catalyst doesn't ship them + ln -s /usr/lib/mesa/libEGL.so.1.0.0 ${pkgdir}/usr/lib/libEGL.so.1.0.0 + ln -s libEGL.so.1.0.0 ${pkgdir}/usr/lib/libEGL.so.1 + ln -s libEGL.so.1.0.0 ${pkgdir}/usr/lib/libEGL.so + + ln -s /usr/lib/mesa/libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib/libGLESv1_CM.so.1.1.0 + ln -s libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib/libGLESv1_CM.so.1 + ln -s libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib/libGLESv1_CM.so + + ln -s /usr/lib/mesa/libGLESv2.so.2.0.0 ${pkgdir}/usr/lib/libGLESv2.so.2.0.0 + ln -s libGLESv2.so.2.0.0 ${pkgdir}/usr/lib/libGLESv2.so.2 + ln -s libGLESv2.so.2.0.0 ${pkgdir}/usr/lib/libGLESv2.so + + cd ${srcdir}/archive_files/common + patch -Np2 -i ${srcdir}/arch-fglrx-authatieventsd_new.patch + install -m644 etc/ati/* ${pkgdir}/etc/ati + chmod 755 ${pkgdir}/etc/ati/authatieventsd.sh + + install -m644 etc/security/console.apps/amdcccle-su ${pkgdir}/etc/security/console.apps + + install -m755 usr/X11R6/bin/* ${pkgdir}/usr/bin + install -m644 usr/include/GL/*.h ${pkgdir}/usr/include/GL + install -m755 usr/sbin/*.sh ${pkgdir}/usr/bin + install -m644 usr/share/ati/amdcccle/* ${pkgdir}/usr/share/ati/amdcccle + install -m644 usr/share/icons/*.xpm ${pkgdir}/usr/share/pixmaps + install -m644 usr/share/man/man8/*.8 ${pkgdir}/usr/share/man/man8 + 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 + + # Add ATI Events Daemon launcher + install -m755 ${srcdir}/atieventsd.sh ${pkgdir}/etc/rc.d/atieventsd + install -m644 ${srcdir}/atieventsd.service ${pkgdir}/usr/lib/systemd/system + + # thanks to cerebral, we dont need that damned symlink + install -m755 ${srcdir}/catalyst.sh ${pkgdir}/etc/profile.d + + # License + install -m644 ${srcdir}/archive_files/LICENSE.TXT ${pkgdir}/usr/share/licenses/${pkgname} + install -m644 ${srcdir}/archive_files/common/usr/share/doc/amdcccle/ccc_copyrights.txt \ + ${pkgdir}/usr/share/licenses/${pkgname}/amdcccle_copyrights.txt + + # since 11.11 : opencl files + if [ "${CARCH}" = "i686" ]; then + cd ${srcdir}/archive_files/arch/x86 + _arc=32 + elif [ "${CARCH}" = "x86_64" ]; then + cd ${srcdir}/archive_files/arch/x86_64 + _arc=64 + fi + + install -m644 etc/OpenCL/vendors/amdocl${_arc}.icd ${pkgdir}/etc/OpenCL/vendors + install -m755 usr/bin/clinfo ${pkgdir}/usr/bin + install -m755 -d ${pkgdir}/etc/modules-load.d + install -m644 ${srcdir}/catalyst.conf ${pkgdir}/etc/modules-load.d + + +##catalyst-hook section + cd ${srcdir}/archive_files + patch -Np1 -i ../makefile_compat.patch + patch -Np1 -i ../3.5-do_mmap.patch + patch -Np1 -i ../arch-fglrx-3.7.patch + patch -Np1 -i ../arch-fglrx-3.8.patch + patch -Np0 -i ../gentoo_linux-3.10-proc.diff + patch -l -Np1 -i ../foutrelis_3.10_fix_for_legacy.patch + patch -Np1 -i ../lano1106_fglrx_intel_iommu.patch + patch -Np1 -i ../lano1106_kcl_agp_13_4.patch + patch -Np1 -i ../arch_3.13_kernel_acpi_node.patch + patch -Np1 -i ../cold-fglrx-3.14-current_euid.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 + + # 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 + + # 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 + + +##lib32-catalyst-utils section + if [ "${CARCH}" = "x86_64" ] && [[ `cat /etc/pacman.conf | grep -c "#\[multilib]"` = 0 ]]; then + cd ${srcdir} + install -D -m755 lib32-catalyst.sh ${pkgdir}/etc/profile.d/lib32-catalyst.sh + cd ${srcdir}/archive_files/arch/x86/usr + install -dm755 ${pkgdir}/usr/lib32 + install -dm755 ${pkgdir}/usr/lib32/fglrx + install -dm755 ${pkgdir}/usr/lib32/xorg/modules/dri + install -m755 lib/*.so* ${pkgdir}/usr/lib32 + install -m755 X11R6/lib/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib32/fglrx + ln -sf /usr/lib32/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib32/fglrx/libGL.so.1.2 + ln -sf /usr/lib32/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib32/fglrx-libGL.so.1.2 + ln -sf /usr/lib32/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib32/libGL.so.1.2 + ln -sf /usr/lib32/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib32/libGL.so.1 + ln -sf /usr/lib32/fglrx/fglrx-libGL.so.1.2 ${pkgdir}/usr/lib32/libGL.so + install -m755 X11R6/lib/libAMDXvBA.so.1.0 ${pkgdir}/usr/lib32 + install -m755 X11R6/lib/libatiadlxx.so ${pkgdir}/usr/lib32 + install -m755 X11R6/lib/libfglrx_dm.so.1.0 ${pkgdir}/usr/lib32 + install -m755 X11R6/lib/libXvBAW.so.1.0 ${pkgdir}/usr/lib32 + install -m755 X11R6/lib/modules/dri/*.so ${pkgdir}/usr/lib32/xorg/modules/dri + ln -snf /usr/lib32/xorg/modules/dri ${pkgdir}/usr/lib32/dri + + cd $pkgdir/usr/lib32 + ln -sf libfglrx_dm.so.1.0 libfglrx_dm.so.1 + ln -sf libAMDXvBA.so.1.0 libAMDXvBA.so.1 + ln -sf libAMDXvBA.so.1.0 libAMDXvBA.so + ln -sf libXvBAW.so.1.0 libXvBAW.so.1 + ln -sf libXvBAW.so.1.0 libXvBAW.so + ln -sf libatiuki.so.1.0 libatiuki.so.1 + ln -sf libatiuki.so.1.0 libatiuki.so + ln -sf libOpenCL.so.1 libOpenCL.so + + # We have to provide symlinks to lib32-mesa, as catalyst doesn't ship them + ln -s /usr/lib32/mesa/libEGL.so.1.0.0 ${pkgdir}/usr/lib32/libEGL.so.1.0.0 + ln -s libEGL.so.1.0.0 ${pkgdir}/usr/lib32/libEGL.so.1 + ln -s libEGL.so.1.0.0 ${pkgdir}/usr/lib32/libEGL.so + + ln -s /usr/lib32/mesa/libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib32/libGLESv1_CM.so.1.1.0 + ln -s libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib32/libGLESv1_CM.so.1 + ln -s libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib32/libGLESv1_CM.so + + ln -s /usr/lib32/mesa/libGLESv2.so.2.0.0 ${pkgdir}/usr/lib32/libGLESv2.so.2.0.0 + ln -s libGLESv2.so.2.0.0 ${pkgdir}/usr/lib32/libGLESv2.so.2 + ln -s libGLESv2.so.2.0.0 ${pkgdir}/usr/lib32/libGLESv2.so + + # OpenCL + install -m755 -d ${pkgdir}/etc/OpenCL/vendors + install -m644 ${srcdir}/archive_files/arch/x86/etc/OpenCL/vendors/amdocl32.icd ${pkgdir}/etc/OpenCL/vendors + fi +} diff --git a/arch-fglrx-3.7.patch b/arch-fglrx-3.7.patch new file mode 100644 index 000000000000..47cd425aa5cf --- /dev/null +++ b/arch-fglrx-3.7.patch @@ -0,0 +1,132 @@ +--- 12.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2012-09-26 15:04:28.000000000 +0200 ++++ 12.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2012-10-16 20:30:42.146523753 +0200 +@@ -3892,7 +3892,11 @@ + KCL_DEBUG_ERROR(REMAP_PAGE_RANGE_STR " failed\n"); + return -EAGAIN; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */ ++#else ++ vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */ ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + vma->vm_ops = &vm_ops; + break; + +@@ -3922,14 +3926,22 @@ + KCL_DEBUG_ERROR(REMAP_PAGE_RANGE_STR " failed\n"); + return -EAGAIN; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */ ++#else ++ vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */ ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + vma->vm_ops = &vm_ops; + } + break; + #endif + + case __KE_SHM: ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */ ++#else ++ vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */ ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + vma->vm_ops = &vm_shm_ops; + break; + +@@ -3937,7 +3949,11 @@ + + pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_RESERVED; ++#else ++ vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + + //vma->vm_flags |= VM_SHM | VM_LOCKED; /* DDDDDDDDDDon't swap */ + //vma->vm_mm->locked_vm += pages; /* Kernel tracks aqmount of locked pages */ +@@ -3946,14 +3962,22 @@ + + case __KE_CTX: + pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_LOCKED | VM_SHM | VM_RESERVED; /* Don't swap */ ++#else ++ vma->vm_flags |= VM_LOCKED | VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */ ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + vma->vm_mm->locked_vm += pages; /* Kernel tracks aqmount of locked pages */ + vma->vm_ops = &vm_ctx_ops; + break; + + case __KE_PCI_BQS: + pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_LOCKED | VM_SHM | VM_RESERVED; /* Don't swap */ ++#else ++ vma->vm_flags |= VM_LOCKED | VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */ ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + vma->vm_mm->locked_vm += pages; /* Kernel tracks aqmount of locked pages */ + vma->vm_ops = &vm_pci_bq_ops; + break; +@@ -3984,9 +4008,17 @@ + return -EAGAIN; + } + #ifdef __x86_64__ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_RESERVED; + #else ++ vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ ++#else ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */ ++#else ++ vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */ ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + #endif + vma->vm_ops = &vm_ops; + } +@@ -4015,9 +4047,17 @@ + return -EAGAIN; + } + #ifdef __x86_64__ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_RESERVED; + #else ++ vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ ++#else ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */ ++#else ++ vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; /* Don't swap */ ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + #endif + vma->vm_ops = &vm_agp_bq_ops; + } +@@ -4025,7 +4065,11 @@ + #endif /* __AGP__BUILTIN__ */ + + case __KE_KMAP: ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_SHM | VM_RESERVED; ++#else ++ vma->vm_flags |= VM_SHM | VM_DONTEXPAND | VM_DONTDUMP; ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + vma->vm_ops = &vm_kmap_ops; + if (readonly && (vma->vm_flags & VM_WRITE)) + { +@@ -4046,7 +4090,11 @@ + #endif + // fall through + case __KE_GART_CACHEABLE: ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) + vma->vm_flags |= VM_RESERVED; ++#else ++ vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + vma->vm_ops = &vm_gart_ops; + break; + default: diff --git a/arch-fglrx-3.8.patch b/arch-fglrx-3.8.patch new file mode 100644 index 000000000000..ad2f3f18cfbc --- /dev/null +++ b/arch-fglrx-3.8.patch @@ -0,0 +1,13 @@ +--- 12.11/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2012-10-23 22:44:52.000000000 +0200 ++++ 12.11/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2012-12-22 22:11:30.289750331 +0100 +@@ -775,7 +775,9 @@ + unsigned int ATI_API_CALL KCL_ACPI_GetHandles(kcl_match_info_t *pInfo) + { + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12) +- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) ++ pInfo->video_handle = pInfo->pcidev->dev.acpi_node.handle; ++ #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) + pInfo->video_handle = pInfo->pcidev->dev.archdata.acpi_handle; + #else + pInfo->video_handle = pInfo->pcidev->dev.firmware_data; diff --git a/arch-fglrx-authatieventsd_new.patch b/arch-fglrx-authatieventsd_new.patch new file mode 100644 index 000000000000..80467cf3ced5 --- /dev/null +++ b/arch-fglrx-authatieventsd_new.patch @@ -0,0 +1,88 @@ +--- 14.1/common/etc/ati/authatieventsd.sh 2014-01-30 15:36:26.000000000 +0100 ++++ 14.1/common/etc/ati/authatieventsd.sh 2014-02-02 14:10:19.529653688 +0100 +@@ -32,7 +32,7 @@ + # vary depending upon whether X was started via xdm/kdm, gdm or startx, so + # check each one in turn. + +- # Check xdm/kdm ++ # Check xdm + + XDM_AUTH_MASK=/var/lib/xdm/authdir/authfiles/A$1* + XDM_AUTH_FILE=`ls -t $XDM_AUTH_MASK 2>/dev/null | head -n 1` # Choose the newest file +@@ -42,12 +42,32 @@ + return 0 + fi + +- # Check gdm ++ # Check kdm + +- GDM_AUTH_FILE=/var/lib/gdm/$1.Xauth ++ KDM_AUTH_MASK=/var/run/xauth/A$1* ++ KDM_AUTH_FILE=`ls -t $KDM_AUTH_MASK 2>/dev/null | head -n 1` # Choose the newest file ++ if [ -n "$KDM_AUTH_FILE" ]; then ++ SERVER_AUTH_FILE=$KDM_AUTH_FILE ++ DISP_SEARCH_STRING="#ffff#" ++ return 0 ++ fi ++ ++ # Check gdm 3 ++ ++ GDM_AUTH_FILE=/var/run/gdm/auth-for-gdm-*/database + if [ -e $GDM_AUTH_FILE ]; then + SERVER_AUTH_FILE=$GDM_AUTH_FILE +- DISP_SEARCH_STRING="$1" ++ DISP_SEARCH_STRING="unix$1" ++ return 0 ++ fi ++ ++ # Check lightdm ++ # Not sure if this will work ++ LIGHTDM_AUTH_FILE=/var/run/lightdm/root/$1 ++ if [ -e $LIGHTDM_AUTH_FILE ]; then ++ SERVER_AUTH_FILE=$LIGHTDM_AUTH_FILE ++ # Not sure if this is correct ++ DISP_SEARCH_STRING="unix$1" + return 0 + fi + +@@ -65,7 +85,7 @@ + + # Couldn't find the key + +- return -1 ++ return 255 + } + + # Main part of script +@@ -78,25 +98,25 @@ + # + + PATH=$PATH:/usr/bin:/usr/X11R6/bin +-which xauth > /dev/null || exit -1 ++which xauth > /dev/null || exit 255 + + case "$1" in + grant) +- GetServerAuthFile $2 || exit -1 ++ GetServerAuthFile $2 || exit 255 + DISP_AUTH_KEY=`xauth -f $SERVER_AUTH_FILE list | grep $DISP_SEARCH_STRING | awk '{ print $3 }'` + if [ -n "$DISP_AUTH_KEY" ]; then +- xauth -f $3 add $2 . $DISP_AUTH_KEY || exit -1 ++ xauth -f $3 add $2 . $DISP_AUTH_KEY || exit 255 + else +- exit -1 ++ exit 255 + fi + ;; + + revoke) +- xauth -f $3 remove $2 || exit -1 ++ xauth -f $3 remove $2 || exit 255 + ;; + + *) +- exit -1 ++ exit 255 + ;; + esac + exit 0 diff --git a/arch_3.13_kernel_acpi_node.patch b/arch_3.13_kernel_acpi_node.patch new file mode 100644 index 000000000000..ca26556d3c9f --- /dev/null +++ b/arch_3.13_kernel_acpi_node.patch @@ -0,0 +1,13 @@ +--- 13.11/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2013-11-22 19:52:37.000000000 +0100 ++++ 13.11/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2013-11-25 11:48:51.227678982 +0100 +@@ -778,7 +778,9 @@ + unsigned int ATI_API_CALL KCL_ACPI_GetHandles(kcl_match_info_t *pInfo) + { + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12) +- #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) ++ pInfo->video_handle = pInfo->pcidev->dev.acpi_node.companion; ++ #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) + pInfo->video_handle = pInfo->pcidev->dev.acpi_node.handle; + #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) + pInfo->video_handle = pInfo->pcidev->dev.archdata.acpi_handle; diff --git a/ati_make.sh b/ati_make.sh new file mode 100644 index 000000000000..45fa26a4710e --- /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 /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/atieventsd.service b/atieventsd.service new file mode 100644 index 000000000000..ccf3a5975f1f --- /dev/null +++ b/atieventsd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Catalyst event Daemon +Requires=acpid.socket + +[Service] +ExecStart=/usr/sbin/atieventsd --nodaemon + +[Install] +WantedBy=multi-user.target diff --git a/atieventsd.sh b/atieventsd.sh new file mode 100644 index 000000000000..16bd9a4fa7b5 --- /dev/null +++ b/atieventsd.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +ATID_PID=`pidof -o %PPID /usr/sbin/atieventsd` + +case "$1" in + start) + rc=0 + stat_busy "Starting ATI Events Daemon" + [ -z "$ATID_PID" ] && /usr/sbin/atieventsd + rc=$(($rc+$?)) + if [ $rc -gt 0 ]; then + stat_fail + else + add_daemon atieventsd + stat_done + fi + ;; + stop) + rc=0 + stat_busy "Stopping ATI Events Daemon" + kill $ATID_PID &>/dev/null + rc=$(($rc+$?)) + if [ $rc -gt 0 ]; then + stat_fail + else + rm_daemon atieventsd + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/catalyst-hook.service b/catalyst-hook.service new file mode 100644 index 000000000000..10292498a235 --- /dev/null +++ b/catalyst-hook.service @@ -0,0 +1,14 @@ +[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 new file mode 100644 index 000000000000..0220416af21a --- /dev/null +++ b/catalyst-total-hd234k.install @@ -0,0 +1,71 @@ +no_testing(){ +echo "5da725748a98681ea0dd5ee8eeeff730:65891c4ca7a95a2e96ec6f89c3dec30169961537a7d93c5780ea66d8dddfc2:6b921d4dbbfb5c7dc1ea3fd1db8ec55564914017bcfe5027c3ee3a8d8ddcc7016b9e1c42bbad5b29c1ea3ad1dd8cc20765974015bcae0c26c4b93a8e8ddd" > /etc/ati/signature +} + +whisperer(){ + 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 "You can use the tool 'aticonfig' to generate an xorg.conf file." + echo "--------------------- ^^^^^^^^^ --------------------------------" + echo "fglrx was added into /etc/modules-load.d/catalyst.conf" + echo "----------------------------------------------------------------" + echo " atieventsd (needs acpid pkg) on systemd:" + echo "systemctl enable atieventsd" + echo "systemctl start atieventsd" + echo "----------------------------------------------------------------" + echo "For more info and troubleshooting visit:" + echo "http://wiki.archlinux.org/index.php/ATI_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 +} + +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 + + echo "----------------------------------------------------------------" + echo " Don't forget to recover your original xorg.conf file." + echo "----------------------------------------------------------------" +}
\ No newline at end of file diff --git a/catalyst.conf b/catalyst.conf new file mode 100644 index 000000000000..17f9ce9168c5 --- /dev/null +++ b/catalyst.conf @@ -0,0 +1 @@ +fglrx
\ No newline at end of file diff --git a/catalyst.sh b/catalyst.sh new file mode 100644 index 000000000000..7aedd4f526cf --- /dev/null +++ b/catalyst.sh @@ -0,0 +1,11 @@ +if [ $LIBGL_DRIVERS_PATH ] +then + if ! set | grep LIBGL_DRIVERS_PATH | grep /usr/lib/xorg/modules/dri/ > /dev/null + then + LIBGL_DRIVERS_PATH=$LIBGL_DRIVERS_PATH:/usr/lib/xorg/modules/dri/ + export LIBGL_DRIVERS_PATH + fi +else + LIBGL_DRIVERS_PATH=/usr/lib/xorg/modules/dri/ + export LIBGL_DRIVERS_PATH +fi diff --git a/catalyst_build_module b/catalyst_build_module new file mode 100755 index 000000000000..1476035c007f --- /dev/null +++ b/catalyst_build_module @@ -0,0 +1,201 @@ +#!/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
\ No newline at end of file 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_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/foutrelis_3.10_fix_for_legacy.patch b/foutrelis_3.10_fix_for_legacy.patch new file mode 100644 index 000000000000..6f9a59351cc7 --- /dev/null +++ b/foutrelis_3.10_fix_for_legacy.patch @@ -0,0 +1,13 @@ +--- 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-19 12:05:33.842076474 +0200 +@@ -34,6 +34,10 @@ + #include <linux/autoconf.h> + #endif + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++#include <linux/seq_file.h> ++#endif ++ + #if !defined(CONFIG_X86) + #if !defined(CONFIG_X86_PC) + #if !defined(CONFIG_X86_XEN)
\ No newline at end of file diff --git a/gentoo_linux-3.10-proc.diff b/gentoo_linux-3.10-proc.diff new file mode 100644 index 000000000000..ce4871c0658b --- /dev/null +++ b/gentoo_linux-3.10-proc.diff @@ -0,0 +1,293 @@ +diff -Nur common/lib/modules/fglrx/build_mod/drmP.h common-r1/lib/modules/fglrx/build_mod/drmP.h +--- common/lib/modules/fglrx/build_mod/drmP.h 2013-05-15 09:26:23.555752577 +0300 ++++ common-r1/lib/modules/fglrx/build_mod/drmP.h 2013-05-16 10:39:17.496212055 +0300 +@@ -901,10 +901,6 @@ + int DRM(stub_unregister)(int minor); + + /* Proc support (drm_proc.h) */ +-extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, +- int minor, +- struct proc_dir_entry *root, +- struct proc_dir_entry **dev_root); + extern int DRM(proc_cleanup)(int minor, + struct proc_dir_entry *root, + struct proc_dir_entry *dev_root); +diff -Nur common/lib/modules/fglrx/build_mod/drm_proc.h common-r1/lib/modules/fglrx/build_mod/drm_proc.h +--- common/lib/modules/fglrx/build_mod/drm_proc.h 2013-05-15 09:26:23.555752577 +0300 ++++ common-r1/lib/modules/fglrx/build_mod/drm_proc.h 2013-05-19 02:16:16.584406160 +0300 +@@ -75,61 +75,6 @@ + #define DRM_PROC_ENTRIES (sizeof(DRM(proc_list))/sizeof(DRM(proc_list)[0])) + + /** +- * Initialize the DRI proc filesystem for a device. +- * +- * \param dev DRM device. +- * \param minor device minor number. +- * \param root DRI proc dir entry. +- * \param dev_root resulting DRI device proc dir entry. +- * \return root entry pointer on success, or NULL on failure. +- * +- * Create the DRI proc root entry "/proc/ati", the device proc root entry +- * "/proc/ati/%minor%/", and each entry in proc_list as +- * "/proc/ati/%minor%/%name%". +- */ +-struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, int minor, +- struct proc_dir_entry *root, +- struct proc_dir_entry **dev_root) +-{ +- struct proc_dir_entry *ent; +- int i, j; +- char name[64]; +- +- if (!minor) root = create_proc_entry("dri", S_IFDIR, NULL); +- if (!root) { +- DRM_ERROR("Cannot create /proc/ati\n"); +- return NULL; +- } +- +- sprintf(name, "%d", minor); +- *dev_root = create_proc_entry(name, S_IFDIR, root); +- if (!*dev_root) { +- DRM_ERROR("Cannot create /proc/ati/%s\n", name); +- return NULL; +- } +- +- for (i = 0; i < DRM_PROC_ENTRIES; i++) { +- ent = create_proc_entry(DRM(proc_list)[i].name, +- S_IFREG|S_IRUGO, *dev_root); +- if (!ent) { +- DRM_ERROR("Cannot create /proc/ati/%s/%s\n", +- name, DRM(proc_list)[i].name); +- for (j = 0; j < i; j++) +- remove_proc_entry(DRM(proc_list)[i].name, +- *dev_root); +- remove_proc_entry(name, root); +- if (!minor) remove_proc_entry("dri", NULL); +- return NULL; +- } +- ent->read_proc = DRM(proc_list)[i].f; +- ent->data = dev; +- } +- +- return root; +-} +- +- +-/** + * Cleanup the proc filesystem resources. + * + * \param minor device minor number. +diff -Nur common/lib/modules/fglrx/build_mod/firegl_public.c common-r1/lib/modules/fglrx/build_mod/firegl_public.c +--- common/lib/modules/fglrx/build_mod/firegl_public.c 2013-05-15 09:26:23.545752925 +0300 ++++ common-r1/lib/modules/fglrx/build_mod/firegl_public.c 2013-05-19 03:07:10.236552522 +0300 +@@ -583,6 +583,202 @@ + { "NULL", NULL, NULL} // Terminate List!!! + }; + ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++typedef int (read_proc_t)(char *page, char **start, off_t off, int count, int *eof, void *data); ++typedef int (write_proc_t)(struct file *file, const char __user *buffer, unsigned long count, void *data); ++#else ++#define PDE_DATA(inode) (PDE((inode))->data) ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++typedef struct { ++ read_proc_t *read_func; ++ write_proc_t *write_func; ++ void *data; ++} gentoo_proc_wrapper_t; ++ ++#define GENTOO_PROC_WRAPPER_OVERFLOW_MAGIC 939750305 ++ ++static ssize_t gentoo_proc_wrapper_read (struct file *myfile, char __user *buffer, size_t count, loff_t *offset) { ++ int is_eof=0, retval; ++ char *start, *usebuffer=NULL; ++ gentoo_proc_wrapper_t* wrapper_data=(gentoo_proc_wrapper_t*)(myfile->private_data); ++ if (PAGE_SIZE<*offset) { ++ printk(KERN_ERR "Trying to read beyond 4k on proc\n"); ++ return -EIO; ++ } ++ //printk(KERN_NOTICE " call with: dev %p, func %p\n", wrapper_data->data, wrapper_data->read_func); ++ ++ usebuffer=kmalloc(2*PAGE_SIZE, GFP_KERNEL); ++ if (!usebuffer) ++ return -ENOMEM; ++ ((u32*)usebuffer)[1024]=GENTOO_PROC_WRAPPER_OVERFLOW_MAGIC; ++ ++ retval=wrapper_data->read_func(usebuffer, &start, *offset, count, &is_eof, wrapper_data->data); ++ ++ BUG_ON(GENTOO_PROC_WRAPPER_OVERFLOW_MAGIC != ((u32*)usebuffer)[1024]); ++ ++ if (0 > retval) ++ { ++ printk(KERN_ERR "Proc read failed with %d", retval); ++ goto out; ++ } ++ ++ if (copy_to_user(buffer, start, retval)) { ++ printk(KERN_NOTICE "copy to user failed in amd drivers proc code\n"); ++ retval=-EFAULT; ++ goto out; ++ } ++ *offset+=retval; ++ ++out: ++ if (usebuffer) ++ kfree(usebuffer); ++ return retval; ++} ++static ssize_t gentoo_proc_wrapper_write (struct file *myfile, const char __user *buffer, size_t count, loff_t *offset) { ++ gentoo_proc_wrapper_t* wrapper_data=(gentoo_proc_wrapper_t*)(myfile->private_data); ++ int retval=0; ++ void *usebuffer=NULL; ++ ++ BUG_ON(*offset); ++ if (!wrapper_data->write_func) ++ return -EPERM; ++ ++ usebuffer=kmalloc(count, GFP_KERNEL); ++ if (!usebuffer) ++ return -ENOMEM; ++ if (copy_from_user(usebuffer, buffer, count)) { ++ printk(KERN_NOTICE "copy from user failed in amd drivers proc code\n"); ++ retval=-EFAULT; ++ goto out; ++ } ++ ++ retval=wrapper_data->write_func(myfile, buffer, count, wrapper_data->data); ++ *offset+=retval; ++out: ++ if (usebuffer) ++ kfree(usebuffer); ++ return retval; ++} ++static int gentoo_proc_wrapper_open(struct inode *myinode, struct file *myfile) { ++ myfile->private_data=PDE_DATA(myinode); ++ return generic_file_open(myinode, myfile); ++} ++struct file_operations gentoo_proc_fops = { ++ .read=gentoo_proc_wrapper_read, ++ .write=gentoo_proc_wrapper_write, ++ .open=gentoo_proc_wrapper_open, ++}; ++ ++static void *gentoo_proc_wrapper_data(read_proc_t *reader, write_proc_t *writer, void *mydata) { ++ gentoo_proc_wrapper_t *retval=kmalloc(sizeof(gentoo_proc_wrapper_t), GFP_KERNEL); ++ if (!retval) ++ return retval; ++ retval->read_func=reader; ++ retval->write_func=writer; ++ retval->data=mydata; ++ return retval; ++} ++ ++static struct proc_dir_entry *firegl_proc_init( device_t *dev, ++ int minor, ++ struct proc_dir_entry *root, ++ struct proc_dir_entry **dev_root, ++ kcl_proc_list_t *proc_list ) // proc_list must be terminated! ++{ ++ struct proc_dir_entry *ent; ++ char name[64]; ++ kcl_proc_list_t *list = proc_list; ++ void *tempdata; ++ KCL_DEBUG1(FN_FIREGL_PROC, "minor %d, proc_list 0x%08lx\n", minor, (unsigned long)proc_list); ++ if (!minor) ++ { ++ root = proc_mkdir("ati", NULL); ++ } ++ ++ if (!root) ++ { ++ KCL_DEBUG_ERROR("Cannot create /proc/ati\n"); ++ return NULL; ++ } ++ ++ if (minor == 0) ++ { ++ // Global major debice number entry ++ tempdata=gentoo_proc_wrapper_data((read_proc_t*)firegl_major_proc_read, NULL, NULL); ++ if (!tempdata) ++ return NULL; ++ ent = proc_create_data("major", S_IFREG|S_IRUGO, root, &gentoo_proc_fops, tempdata); ++ if (!ent) ++ { ++ remove_proc_entry("ati", NULL); ++ KCL_DEBUG_ERROR("Cannot create /proc/ati/major\n"); ++ return NULL; ++ } ++ } ++ ++ sprintf(name, "%d", minor); ++ *dev_root = proc_mkdir(name, root); ++ if (!*dev_root) { ++ remove_proc_entry("major", root); ++ remove_proc_entry("ati", NULL); ++ KCL_DEBUG_ERROR("Cannot create /proc/ati/%s\n", name); ++ return NULL; ++ } ++ ++ while (list->f || list->fops) ++ { ++ struct file_operations *my_fops = &gentoo_proc_fops; ++ if (list->fops) ++ { ++ my_fops = (struct file_operations*)list->fops; ++ tempdata=(dev->pubdev.signature == FGL_DEVICE_SIGNATURE)? firegl_find_device(minor) : (dev); ++ } ++ else { ++ BUG_ON(!list->f); ++ tempdata=gentoo_proc_wrapper_data((read_proc_t*)list->f, NULL, (dev->pubdev.signature == FGL_DEVICE_SIGNATURE)? firegl_find_device(minor) : (dev) ); ++ if (!tempdata) ++ return NULL; ++ } ++ //printk(KERN_NOTICE "name %s, dev %p, func %p, data %p\n", list->name, (dev->pubdev.signature == FGL_DEVICE_SIGNATURE)? firegl_find_device(minor) : (dev), list->f, tempdata); ++ ent = proc_create_data(list->name, S_IFREG|S_IRUGO, *dev_root, my_fops, tempdata); ++ ++ if (!ent) ++ { ++ KCL_DEBUG_ERROR("Cannot create /proc/ati/%s/%s\n", name, list->name); ++ while (proc_list != list) ++ { ++ remove_proc_entry(proc_list->name, *dev_root); ++ proc_list++; ++ } ++ remove_proc_entry(name, root); ++ if (!minor) ++ { ++ remove_proc_entry("major", root); ++ remove_proc_entry("ati", NULL); ++ } ++ return NULL; ++ } ++ ++ list++; ++ } ++ ++ if (minor == 0) ++ { ++ // Global debug entry, only create it once ++ tempdata=gentoo_proc_wrapper_data((read_proc_t*)firegl_debug_proc_read_wrap, (write_proc_t*)firegl_debug_proc_write_wrap, dev); ++ if (!tempdata) ++ return NULL; ++ ent=proc_create_data("debug", S_IFREG|S_IRUGO, root, &gentoo_proc_fops, tempdata); ++ if (!ent) ++ return NULL; ++ } ++ ++ return root; ++} ++#else + static struct proc_dir_entry *firegl_proc_init( device_t *dev, + int minor, + struct proc_dir_entry *root, +@@ -677,6 +873,7 @@ + + return root; + } ++#endif + + static int firegl_proc_cleanup( int minor, + struct proc_dir_entry *root, diff --git a/hook-fglrx b/hook-fglrx new file mode 100644 index 000000000000..0d6f9b2f4e93 --- /dev/null +++ b/hook-fglrx @@ -0,0 +1,14 @@ +# 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/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/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/lib32-catalyst.sh b/lib32-catalyst.sh new file mode 100644 index 000000000000..4f5d55be79b8 --- /dev/null +++ b/lib32-catalyst.sh @@ -0,0 +1,2 @@ +# Hope theyre still same as in fglrx, thanks Pierre +export LIBGL_DRIVERS_PATH=$LIBGL_DRIVERS_PATH:/usr/lib32/xorg/modules/dri 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 |