From ca5653a9190f316859c3cd1b5cc506311a42d12e Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verison.net>
Date: Tue, 23 Mar 2010 22:52:53 +0000
Subject: catalyst: initial inclusion. **Untested** Proprietary ATI/AMD video
 drivers.

---
 abs/core-testing/catalyst/PKGBUILD           | 153 ++++++++++++++++++
 abs/core-testing/catalyst/amdcccle.desktop   |  11 ++
 abs/core-testing/catalyst/atieventsd.sh      |  41 +++++
 abs/core-testing/catalyst/catalyst.install   |  34 ++++
 abs/core-testing/catalyst/catalyst.sh        |  11 ++
 abs/core-testing/catalyst/fglrx-2.6.33.patch | 228 +++++++++++++++++++++++++++
 6 files changed, 478 insertions(+)
 create mode 100644 abs/core-testing/catalyst/PKGBUILD
 create mode 100644 abs/core-testing/catalyst/amdcccle.desktop
 create mode 100644 abs/core-testing/catalyst/atieventsd.sh
 create mode 100644 abs/core-testing/catalyst/catalyst.install
 create mode 100644 abs/core-testing/catalyst/catalyst.sh
 create mode 100644 abs/core-testing/catalyst/fglrx-2.6.33.patch

diff --git a/abs/core-testing/catalyst/PKGBUILD b/abs/core-testing/catalyst/PKGBUILD
new file mode 100644
index 0000000..c9f315e
--- /dev/null
+++ b/abs/core-testing/catalyst/PKGBUILD
@@ -0,0 +1,153 @@
+# Maintainer: Vi0L0 <vi0l093@gmail.com>
+# Contributor: Eduardo "kensai" Romero
+# Contributor: Anssi Hannula
+# Contributor: Stefan Bühler
+# Contributor: baghera
+# Contributor: Arlekino
+
+_kernver=`uname -r`
+
+pkgname=catalyst
+pkgver=10.1
+pkgrel=5
+pkgdesc="AMD/ATI drivers for Radeon brand cards. Stock kernel"
+arch=('i686' 'x86_64')
+url="http://www.ati.amd.com"
+license=('custom')
+depends=('xorg-server<1.7.0' 'kernel26>=2.6.28' 'kernel26<2.6.34' 'kernel-headers' 'netkit-bsd-finger' 'libstdc++5' 'libxrandr' 'libsm' 'fontconfig' 'libxcursor' 'libxi' 'gcc-libs')
+
+conflicts=('catalyst' 'catalyst-utils' 'nvidia' 'libgl' 'catalyst-leaked' 'xf86-input-evdev>2.2.5-1' 'xf86-input-keyboard>1.3.2-2' 'xf86-input-mouse>1.4.0-2' 'xf86-input-synaptics>1.1.3-1' 'xf86-video-vesa>2.2.0-1' 'xf86-video-ati' 'xf86-video-radeonhd' 'ati-dri')
+provides=('catalyst' 'libgl')
+install=catalyst.install
+source=(http://www2.ati.com/drivers/linux/ati-driver-installer-${pkgver/./-}-x86.x86_64.run
+    catalyst.sh amdcccle.desktop atieventsd.sh fglrx-2.6.33.patch)
+md5sums=('1edfe45ddf9d9315dec80ff3cc848ca3'
+	 'bdafe749e046bfddee2d1c5e90eabd83'
+         '4efa8414a8fe9eeb50da38b5522ef81d'
+         'f729bf913613f49b0b9759c246058a87'
+	 'c5eb5571782fed5232461f59a789fb08')
+
+build() {
+/bin/sh ./ati-driver-installer-${pkgver/./-}-x86.x86_64.run --extract archive_files
+
+##Build kernel modules
+
+if [ "${CARCH}" = "x86_64" ]; then
+BUILDARCH=x86_64
+_archdir=x86_64
+fi
+if [ "${CARCH}" = "i686" ]; then
+BUILDARCH=i386
+_archdir=x86
+fi
+
+##patching for kernel 2.6.33 or 2.6.34 support
+if [ `uname -r |grep -c "2.6.33"` != 0 ] || [ `uname -r |grep -c "2.6.34"` != 0 ]; then
+cd "${srcdir}/archive_files/"
+patch -Np1 -i ../fglrx-2.6.33.patch || return 1
+fi
+
+cd "${srcdir}/archive_files/common/lib/modules/fglrx/build_mod"
+cp "${srcdir}/archive_files/arch/${_archdir}/lib/modules/fglrx/build_mod/libfglrx_ip.a.GCC4" . || return 1
+cp 2.6.x/Makefile . || return 1
+
+make -C /lib/modules/${_kernver}/build SUBDIRS="`pwd`" ARCH=${BUILDARCH} modules || return 1
+
+install -m755 -d "${pkgdir}/lib/modules/${_kernver}/video/"
+install -m644 fglrx.ko "${pkgdir}/lib/modules/${_kernver}/video/" || return 1
+install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
+
+sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" $startdir/*.install
+
+##Install catalyst utilities
+
+# 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}/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/linux"
+
+install -m755 -d "${pkgdir}/usr/bin"
+install -m755 -d "${pkgdir}/usr/sbin"
+
+install -m755 -d "${pkgdir}/usr/include/X11/extensions"
+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 driver installation
+if [ "${CARCH}" = "i686" ]; then
+cd "${srcdir}/archive_files/x740/usr/X11R6/lib/modules" || return 1
+elif [ "${CARCH}" = "x86_64" ]; then
+cd "${srcdir}/archive_files/x740_64a/usr/X11R6/lib64/modules" || return 1
+fi
+
+install -m644 *.a "${pkgdir}/usr/lib/xorg/modules/" || return 1
+install -m755 *.so "${pkgdir}/usr/lib/xorg/modules/" || return 1
+install -m755 drivers/*.so "${pkgdir}/usr/lib/xorg/modules/drivers/" || return 1
+install -m755 linux/*.so "${pkgdir}/usr/lib/xorg/modules/linux/" || return 1
+install -m755 extensions/libglx.so "${pkgdir}/usr/lib/xorg/modules/extensions/" || return 1
+#install -m755 extensions/libdri.so "${pkgdir}/usr/lib/xorg/modules/extensions/libdri.ati" || return 1
+
+# Controlcenter / library installation
+if [ "${CARCH}" = "i686" ]; then
+cd "${srcdir}/archive_files/arch/x86/usr" || return 1
+_lib=lib
+elif [ "${CARCH}" = "x86_64" ]; then
+cd "${srcdir}/archive_files/arch/x86_64/usr" || return 1
+_lib=lib64
+fi
+
+install -m755 X11R6/bin/* "${pkgdir}/usr/bin/" || return 1
+install -m755 sbin/* "${pkgdir}/usr/sbin/" || return 1
+install -m755 X11R6/${_lib}/*.so* "${pkgdir}/usr/lib/" || return 1
+install -m644 X11R6/${_lib}/*.a "${pkgdir}/usr/lib/" || return 1 # really needed?
+install -m644 X11R6/${_lib}/*.cap "${pkgdir}/usr/lib/" || return 1
+install -m755 X11R6/${_lib}/modules/dri/*.so "${pkgdir}/usr/lib/xorg/modules/dri/" || return 1
+install -m755 ${_lib}/*.so* "${pkgdir}/usr/lib/" || return 1
+
+ln -sf /usr/lib/xorg/modules/dri ${pkgdir}/usr/lib/dri
+ln -sf libfglrx_dm.so.1.0 "${pkgdir}/usr/lib/libfglrx_dm.so.1"
+ln -sf libfglrx_pp.so.1.0 "${pkgdir}/usr/lib/libfglrx_pp.so.1"
+ln -sf libfglrx_tvout.so.1.0 "${pkgdir}/usr/lib/libfglrx_tvout.so.1"
+ln -sf libfglrx_gamma.so.1.0 "${pkgdir}/usr/lib/libfglrx_gamma.so.1"
+ln -sf libGL.so.1.2 "${pkgdir}/usr/lib/libGL.so.1"
+ln -sf libGL.so.1.2 "${pkgdir}/usr/lib/libGL.so"
+
+cd "${srcdir}"/archive_files/common
+install -m644 etc/ati/* "${pkgdir}/etc/ati/" || return 1
+chmod 755 "${pkgdir}/etc/ati/authatieventsd.sh" || return 1
+
+install -m644 usr/X11R6/include/X11/extensions/*.h "${pkgdir}/usr/include/X11/extensions/" || return 1
+install -m644 usr/X11R6/bin/amdupdaterandrconfig "${pkgdir}/usr/bin/" || return 1
+install -m644 usr/include/GL/*.h "${pkgdir}/usr/include/GL/" || return 1
+install -m755 usr/sbin/*.sh "${pkgdir}/usr/sbin/" || return 1
+install -m644 usr/share/ati/amdcccle/* "${pkgdir}/usr/share/ati/amdcccle/" || return 1 # ? what are these files for?
+# install -m644 usr/share/gnome/apps/amdcccle.desktop "${pkgdir}/usr/share/applications/" || return 1
+install -m644 usr/share/icons/*.xpm "${pkgdir}/usr/share/pixmaps/" || return 1
+install -m644 usr/share/man/man8/*.8 "${pkgdir}/usr/share/man/man8/" || return 1
+install -m644 "${srcdir}/amdcccle.desktop" "${pkgdir}/usr/share/applications/" || return 1
+
+# ACPI example files
+install -m755 usr/share/doc/fglrx/examples/etc/acpi/*.sh "${pkgdir}/etc/acpi/" || return 1
+sed -i -e 's/usr\/X11R6/usr/g' "${pkgdir}/etc/acpi/ati-powermode.sh" || return 1
+install -m644 usr/share/doc/fglrx/examples/etc/acpi/events/* "${pkgdir}/etc/acpi/events/" || return 1
+
+# Add ATI Events Daemon launcher
+install -m755 "${srcdir}/atieventsd.sh" "${pkgdir}/etc/rc.d/atieventsd" || return 1
+
+# thanks to cerebral, we dont need that damned symlink
+install -m755 "${srcdir}/catalyst.sh" "${pkgdir}/etc/profile.d/" || return 1
+
+# License
+install -m644 "${srcdir}/archive_files/ATI_LICENSE.TXT" "${pkgdir}/usr/share/licenses/${pkgname}/" || return 1
+}
diff --git a/abs/core-testing/catalyst/amdcccle.desktop b/abs/core-testing/catalyst/amdcccle.desktop
new file mode 100644
index 0000000..ba2ed4a
--- /dev/null
+++ b/abs/core-testing/catalyst/amdcccle.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=ATI Catalyst Control Center
+Comment=ATI graphics adapter settings
+Name[de]=ATI Catalyst Control Center
+Comment[de]=ATI grafics adapter settings
+Icon=ccc_large
+MiniIcon=ccc_small
+Exec=amdcccle
+Type=Application
+Terminal=false
+Categories=Settings;DesktopSettings;
diff --git a/abs/core-testing/catalyst/atieventsd.sh b/abs/core-testing/catalyst/atieventsd.sh
new file mode 100644
index 0000000..16bd9a4
--- /dev/null
+++ b/abs/core-testing/catalyst/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/abs/core-testing/catalyst/catalyst.install b/abs/core-testing/catalyst/catalyst.install
new file mode 100644
index 0000000..11bf0a7
--- /dev/null
+++ b/abs/core-testing/catalyst/catalyst.install
@@ -0,0 +1,34 @@
+KERNEL_VERSION=2.6.28-LinHES
+
+pre_install() {
+ if [ ! -e /usr/lib/xorg/modules/extensions/libdri.so ]; then
+    ln -sf /usr/lib/xorg/modules/extensions/libdri.xorg /usr/lib/xorg/modules/extensions/libdri.so
+ fi
+}
+
+post_install() {
+  depmod $KERNEL_VERSION
+ if [ ! -e /usr/lib/xorg/modules/extensions/libdri.so ]; then
+    ln -sf /usr/lib/xorg/modules/extensions/libdri.xorg /usr/lib/xorg/modules/extensions/libdri.so
+ fi
+  echo "--------------------------------------------------------------"
+  echo "You can use the tool 'aticonfig' to generate an xorg.conf file."
+  echo "Remember to add fglrx to the MODULES list in /etc/rc.conf."
+  echo "--------------------------------------------------------------"
+}
+
+post_upgrade() {
+  depmod $KERNEL_VERSION
+ if [ ! -e /usr/lib/xorg/modules/extensions/libdri.so ]; then
+    ln -sf /usr/lib/xorg/modules/extensions/libdri.xorg /usr/lib/xorg/modules/extensions/libdri.so
+ fi
+}
+
+post_remove() {
+  depmod $KERNEL_VERSION
+  # If the symlink is dead, remove it
+ if [ ! -e /usr/lib/xorg/modules/extensions/libdri.so ]; then
+    ln -sf /usr/lib/xorg/modules/extensions/libdri.xorg /usr/lib/xorg/modules/extensions/libdri.so
+ fi
+  echo "NOTE: Don't forget to recover your original xorg.conf file."
+}
diff --git a/abs/core-testing/catalyst/catalyst.sh b/abs/core-testing/catalyst/catalyst.sh
new file mode 100644
index 0000000..7aedd4f
--- /dev/null
+++ b/abs/core-testing/catalyst/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/abs/core-testing/catalyst/fglrx-2.6.33.patch b/abs/core-testing/catalyst/fglrx-2.6.33.patch
new file mode 100644
index 0000000..7ba9ecd
--- /dev/null
+++ b/abs/core-testing/catalyst/fglrx-2.6.33.patch
@@ -0,0 +1,228 @@
+Index: ati10.1/common/lib/modules/fglrx/build_mod/drmP.h
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/drmP.h
++++ ati10.1/common/lib/modules/fglrx/build_mod/drmP.h	2010-01-28 19:57:07.562644291 +0200
+@@ -42,7 +42,12 @@
+  * can build the DRM (part of PI DRI). 4/21/2000 S + B */
+ #include <asm/current.h>
+ #endif /* __alpha__ */
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+ #include <linux/miscdevice.h>
+@@ -51,7 +56,6 @@
+ #include <linux/init.h>
+ #include <linux/file.h>
+ #include <linux/pci.h>
+-#include <linux/version.h>
+ #include <linux/sched.h>
+ #include <linux/smp_lock.h>	/* For (un)lock_kernel */
+ #include <linux/mm.h>
+Index: ati10.1/common/lib/modules/fglrx/build_mod/firegl_public.c
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ ati10.1/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-01-29 14:21:58.687999115 +0200
+@@ -28,7 +28,11 @@
+ #error Kernel versions older than 2.6.0 are no longer supported by this module.
+ #endif 
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ 
+ #if !defined(CONFIG_X86) 
+ #if !defined(CONFIG_X86_PC) 
+@@ -163,8 +167,12 @@
+ 
+ //  For 2.6.18 or higher, the UTS_RELEASE is defined in the linux/utsrelease.h. 
+ #ifndef UTS_RELEASE 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/utsrelease.h>
++#else
+ #include <linux/utsrelease.h>
+ #endif
++#endif
+ 
+ #if defined(__i386__)
+ #ifndef do_div
+@@ -1472,7 +1472,16 @@
+ #ifndef __HAVE_ARCH_CMPXCHG
+     return __fgl_cmpxchg(ptr,old,new,size);
+ #else
+-    return __cmpxchg(ptr,old,new,size);
++    switch (size) {
++    case 1: { volatile u8 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
++    case 2: { volatile u16 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
++    case 4: { volatile u32 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
++#ifdef __x86_64__
++    case 8: { volatile u64 *_ptr = ptr; return cmpxchg(_ptr, old, new); }
++#endif
++    default:
++        return old;
++    }
+ #endif
+ }
+
+ 
+Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_acpi.c
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_acpi.c
++++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_acpi.c	2010-01-28 19:57:17.897225045 +0200
+@@ -15,7 +15,11 @@
+  ****************************************************************************/
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/acpi.h>
+ 
+ #include "kcl_config.h"
+Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_agp.c
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_agp.c
++++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_agp.c	2010-01-28 19:57:26.104892082 +0200
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/pci.h>
+ #include <linux/agp_backend.h>
+ #include <linux/string.h>
+Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_io.c
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_io.c
++++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_io.c	2010-01-28 19:57:34.337558105 +0200
+@@ -37,7 +37,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/poll.h>
+ #include <linux/signal.h>
+ #include <asm/io.h>
+Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
++++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_osconfig.h	2010-01-28 19:57:43.599182385 +0200
+@@ -20,7 +20,11 @@
+ #define KCL_OSCONFIG_H
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ 
+ // Choose modern way to call 32-on-64 IOCTLs if configured in the kernel
+ #if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
+Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_pci.c
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_pci.c
++++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_pci.c	2010-01-28 19:57:51.295870149 +0200
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/pci.h>
+ 
+ #include "kcl_config.h"
+Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_str.c
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_str.c
++++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_str.c	2010-01-28 19:57:59.728528058 +0200
+@@ -30,7 +30,12 @@
+  *
+  */
+ 
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/string.h>
+ #include <linux/module.h>
+ 
+Index: ati10.1/common/lib/modules/fglrx/build_mod/kcl_wait.c
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/kcl_wait.c
++++ ati10.1/common/lib/modules/fglrx/build_mod/kcl_wait.c	2010-01-28 19:58:08.936154527 +0200
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/wait.h>
+ #include <linux/highmem.h>
+ #include <linux/sched.h>
+Index: ati10.1/common/lib/modules/fglrx/build_mod/make.sh
+===================================================================
+--- ati10.1/common/lib/modules/fglrx/build_mod/make.sh
++++ ati10.1/common/lib/modules/fglrx/build_mod/make.sh	2010-01-28 19:55:10.849378991 +0200
+@@ -218,8 +218,15 @@
+         # UTS-define is in external version-*.h files, i.e. linux-2.2.14-5.0-RedHat does this flaw
+         kernel_release=`cat $linuxincludes/linux/version-*.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2` 
+     else
+-        # For 2.6.18 or higher, UTS-define is defined in utsrelease.h.
+-        kernel_release=`cat $linuxincludes/linux/utsrelease.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2` 
++        UTS_REL_COUNT=`cat $linuxincludes/generated/utsrelease.h 2>/dev/null | grep UTS_RELEASE -c`
++
++	if [ $UTS_REL_COUNT -gt 0 ]; then
++	    # 2.6.33+
++	    kernel_release=`cat $linuxincludes/generated/utsrelease.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2`
++	else
++            # For 2.6.18 to 2.6.32, UTS-define is defined in utsrelease.h.
++            kernel_release=`cat $linuxincludes/linux/utsrelease.h | grep UTS_RELEASE | grep \"$OsRelease\" | cut -d'"' -f2`
++	fi
+     fi
+   fi
+ fi
+@@ -302,7 +309,8 @@
+ # 3
+ # linux/autoconf.h may contain this: #define CONFIG_SMP 1
+ 
+-src_file=$linuxincludes/linux/autoconf.h
++src_file=$linuxincludes/generated/autoconf.h
++[ -e $src_file ] || src_file=$linuxincludes/linux/autoconf.h
+ 
+ if [ ! -e $src_file ]; then
+   echo "Warning:"                                                  >> $logfile
+@@ -355,7 +363,8 @@
+ MODVERSIONS=0
+ 
+ # linux/autoconf.h may contain this: #define CONFIG_MODVERSIONS 1
+-src_file=$linuxincludes/linux/autoconf.h
++src_file=$linuxincludes/generated/autoconf.h
++[ -e $src_file ] || src_file=$linuxincludes/linux/autoconf.h
+ if [ ! -e $src_file ];
+ then
+   echo "Warning:"                                                  >> $logfile
-- 
cgit v0.12