making ati dirvers compile again

See comments on the nixos patch
This commit is contained in:
Marc Weber 2012-10-07 18:03:06 +02:00
parent 4454e45955
commit 2e7847cd12
2 changed files with 27 additions and 9 deletions

View file

@ -2,13 +2,14 @@
# TODO gentoo removes some tools because there are xorg sources (?)
source $stdenv/setup
set -x
die(){ echo $@; exit 1; }
# custom unpack:
cp $src archive
sh archive --extract .
unzip $src
run_file=$(echo amd-driver-installer-*)
sh $run_file --extract .
kernelVersion=$(cd ${kernel}/lib/modules && ls)
@ -68,7 +69,7 @@ setModVersions(){
# 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
COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
for src_file in \
$kernelBuild/arch/x86/include/asm/compat.h \
@ -123,6 +124,8 @@ GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
echo .lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
echo 'This is a dummy file created to suppress this warning: could not find /lib/modules/fglrx/build_mod/2.6.x/.libfglrx_ip.a.GCC4.cmd for /lib/modules/fglrx/build_mod/2.6.x/libfglrx_ip.a.GCC4' > lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
sed -i -e "s@COMPAT_ALLOC_USER_SPACE@$COMPAT_ALLOC_USER_SPACE@" ../kcl_ioctl.c
make CC=${CC} \
LIBIP_PREFIX=$(echo "$LIBIP_PREFIX" | sed -e 's|^\([^/]\)|../\1|') \
MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
@ -143,12 +146,12 @@ GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
cp -r common/usr/share $out
cp -r common/usr/X11R6 $out
cp -r arch/$arch/lib $out/lib
# cp -r arch/$arch/lib $out/lib
# what are those files used for?
cp -r common/etc $out
DIR_DEPENDING_ON_XORG_VERSION=x750_64a
DIR_DEPENDING_ON_XORG_VERSION=xpic_64a
cp -r $DIR_DEPENDING_ON_XORG_VERSION/usr/X11R6/$lib_arch/* $out/lib/xorg
t=$out/lib/modules/${kernelVersion}/kernel/drivers/misc
@ -164,12 +167,18 @@ GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/modules/dri $out/lib
cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/modules/dri/* $out/lib
cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/*.so.* $out/lib
cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/fglrx/fglrx-libGL.so.1.2 $out/lib/fglrx-libGL.so.1.2
cp -r $TMP/arch/$arch/usr/$lib_arch/* $out/lib
# cp -r $TMP/arch/$arch/usr/$lib_arch/* $out/lib
ln -s libatiuki.so.1.0 $out/lib/libatiuki.so.1
ln -s libGL.so.1.2 $out/lib/libGL.so.1
ln -s fglrx-libGL.so.1.2 $out/lib/libGL.so.1
ln -s fglrx-libGL.so.1.2 $out/lib/libGL.so
ln -s libfglrx_gamma.so.1.0 $out/lib/libfglrx_gamma.so.1
# make xorg use the ati version
ln -s $out/lib/xorg/modules/extensions/{fglrx/fglrx-libglx.so,libglx.so}
}

View file

@ -2,6 +2,7 @@
, mesa # for fgl_glxgears
, libXxf86vm, xf86vidmodeproto # for fglrx_gamma
, xorg, makeWrapper, glibc, patchelf
, unzip
}:
# If you want to use a different Xorg version probably
@ -16,6 +17,9 @@
# http://wiki.cchtml.com/index.php/Main_Page
# There is one issue left:
# /usr/lib/dri/fglrx_dri.so must point to /run/opengl-driver/lib/fglrx_dri.so
assert stdenv.system == "x86_64-linux";
stdenv.mkDerivation rec {
@ -27,14 +31,19 @@ stdenv.mkDerivation rec {
inherit libXxf86vm xf86vidmodeproto;
src = fetchurl {
url = https://www2.ati.com/drivers/linux/ati-driver-installer-10-11-x86.x86_64.run;
sha256 = "1z33w831ayx1j5lm9d1xv6whkmzsz9v8li3s8c96hwnwki6zpimr";
url = http://www2.ati.com/drivers/linux/amd-driver-installer-12-8-x86.x86_64.zip;
sha256 = "0hdv89vdap6v0dnwhddizfmlkwyh0j910sp4wyj2lq5pn9rm2lk2";
# beta
# url = "http://www2.ati.com/drivers/beta/amd-driver-installer-12-9-beta-x86.x86_64.zip";
# sha256 = "02dmflzfrgr07fa1hv34m7ad8pra21xv7qbk500gqm6v8s9vbplk";
};
buildInputs =
[ xlibs.libXext xlibs.libX11
xlibs.libXrandr which imake makeWrapper
patchelf
unzip
];
inherit kernel glibc /* glibc only used for setting interpreter */;