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 #endif /* __alpha__ */ +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#endif #include #include #include @@ -51,7 +56,6 @@ #include #include #include -#include #include #include /* For (un)lock_kernel */ #include 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 +#else #include +#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 +#else #include #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 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#endif #include #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 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#endif #include #include #include 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 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#endif #include #include #include 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 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#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 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#endif #include #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 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#endif #include #include 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 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#include +#else #include +#endif #include #include #include 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