about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/ati-drivers
diff options
context:
space:
mode:
authorEvgeny Egorochkin <phreedom.stdin@gmail.com>2010-10-26 00:35:38 +0000
committerEvgeny Egorochkin <phreedom.stdin@gmail.com>2010-10-26 00:35:38 +0000
commit3748bba1268f7fa2f518e4ba452dd868bc17d5ad (patch)
tree46a996da8f0e32e15422da97fc799c7b44b67880 /pkgs/os-specific/linux/ati-drivers
parent19e0cda8d8890fb251e3a0a3e29e6ace9b5058d1 (diff)
downloadnixlib-3748bba1268f7fa2f518e4ba452dd868bc17d5ad.tar
nixlib-3748bba1268f7fa2f518e4ba452dd868bc17d5ad.tar.gz
nixlib-3748bba1268f7fa2f518e4ba452dd868bc17d5ad.tar.bz2
nixlib-3748bba1268f7fa2f518e4ba452dd868bc17d5ad.tar.lz
nixlib-3748bba1268f7fa2f518e4ba452dd868bc17d5ad.tar.xz
nixlib-3748bba1268f7fa2f518e4ba452dd868bc17d5ad.tar.zst
nixlib-3748bba1268f7fa2f518e4ba452dd868bc17d5ad.zip
ati-drivers: version bump and fix name/version. Patch by Cillian de Róiste.
svn path=/nixpkgs/trunk/; revision=24479
Diffstat (limited to 'pkgs/os-specific/linux/ati-drivers')
-rw-r--r--pkgs/os-specific/linux/ati-drivers/builder.sh46
-rw-r--r--pkgs/os-specific/linux/ati-drivers/default.nix9
2 files changed, 49 insertions, 6 deletions
diff --git a/pkgs/os-specific/linux/ati-drivers/builder.sh b/pkgs/os-specific/linux/ati-drivers/builder.sh
index f830e1e066f8..1fd6234b48e2 100644
--- a/pkgs/os-specific/linux/ati-drivers/builder.sh
+++ b/pkgs/os-specific/linux/ati-drivers/builder.sh
@@ -13,6 +13,7 @@ sh archive --extract .
 
 kernelVersion=$(cd ${kernel}/lib/modules && ls)
 kernelBuild=$(echo ${kernel}/lib/modules/$kernelVersion/build)
+linuxsources=$(echo ${kernel}/lib/modules/$kernelVersion/source)
 
 
 # note: maybe the .config file should be used to determine this ?
@@ -28,7 +29,15 @@ setSMP(){
   # 3
   # linux/autoconf.h may contain this: #define CONFIG_SMP 1
 
-  src_file=$linuxincludes/linux/autoconf.h
+  # Before 2.6.33 autoconf.h is under linux/.
+  # For 2.6.33 and later autoconf.h is under generated/.
+  if [ -f $linuxincludes/generated/autoconf.h ]; then
+      autoconf_h=$linuxincludes/generated/autoconf.h
+  else
+      autoconf_h=$linuxincludes/linux/autoconf.h
+  fi
+  src_file=$autoconf_h
+
   [ -e $src_file ] || die "$src_file not found"
 
   if [ `cat $src_file | grep "#undef" | grep "CONFIG_SMP" -c` = 0 ]; then
@@ -54,6 +63,39 @@ setModVersions(){
   # make.sh contains much more code to determine this whether its enabled
 }
 
+# ==============================================================
+# 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
+
+for src_file in \
+    $kernelBuild/arch/x86/include/asm/compat.h \
+    $linuxsources/arch/x86/include/asm/compat.h \
+    $kernelBuild/include/asm-x86_64/compat.h \
+    $linuxsources/include/asm-x86_64/compat.h \
+    $kernelBuild/include/asm/compat.h;
+do
+  if [ -e $src_file ];
+  then
+    break
+  fi
+done
+if [ ! -e $src_file ];
+then
+  echo "Warning: x86 compat.h not found in kernel headers"        
+  echo "neither arch/x86/include/asm/compat.h nor include/asm-x86_64/compat.h" 
+  echo "could be found in $kernelBuild or $linuxsources"            
+  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
+
 
 # make.sh contains some code figuring out whether to use these or not..
 PAGE_ATTR_FIX=0
@@ -83,7 +125,7 @@ GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
 
   make CC=${CC} \
       LIBIP_PREFIX=$(echo "$LIBIP_PREFIX" | sed -e 's|^\([^/]\)|../\1|') \
-      MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX $def_smp $def_modversions" \
+      MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
       KVER=$kernelVersion \
       KDIR=$kernelBuild \
       PAGE_ATTR_FIX=$PAGE_ATTR_FIX \
diff --git a/pkgs/os-specific/linux/ati-drivers/default.nix b/pkgs/os-specific/linux/ati-drivers/default.nix
index 65c42e09039a..db25bebb06c9 100644
--- a/pkgs/os-specific/linux/ati-drivers/default.nix
+++ b/pkgs/os-specific/linux/ati-drivers/default.nix
@@ -19,8 +19,9 @@ let lib = stdenv.lib;
 in
 # http://wiki.cchtml.com/index.php/Main_Page
 
-stdenv.mkDerivation {
-  name = "ati-drivers";
+stdenv.mkDerivation rec {
+  name = "ati-drivers-${version}";
+  version = "10-10-x86";
 
   builder = ./builder.sh;
 
@@ -29,8 +30,8 @@ stdenv.mkDerivation {
   src =
     assert stdenv.system == "x86_64-linux";
   fetchurl {
-    url = https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/ati-driver-installer-10-4-x86.x86_64.run;
-    sha256 = "1rlqbfv729lray1c72ga4528kj7v4a5nmdznbgx7izwaxip2a45z";
+    url = https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/ati-driver-installer-10-10-x86.x86_64.run;
+    sha256 = "1g71sj8qbarshw3hfds2v6y9q7lma3d36d0x79c7vvgllcd5c76x";
   };
 
   buildInputs = [xlibs.libXext xlibs.libX11