patches:
commit 81c03dbfd9160210ed7ec7d7af9cb9e22ab88eba Author: Marc Weber <[email protected]> Date: Mon May 17 15:57:19 2010 +0200 patches: === NIXOS commit 0c0d48718238d6a7d03371e6e8f4ff300126f668 Author: Marc Weber <[email protected]> Date: Mon May 17 16:39:50 2010 +0200 t/ati-drivers add support for proprietary ati drivers Signed-off-by: Marc Weber <[email protected]> diff --git a/modules/services/x11/xserver.nix b/modules/services/x11/xserver.nix index 658a5d4..34eefd3 100644 --- a/modules/services/x11/xserver.nix +++ b/modules/services/x11/xserver.nix @@ -14,6 +14,7 @@ let # Map video driver names to driver packages. knownVideoDrivers = { ati = { modules = [ xorg.xf86videoati ]; }; + ati_unfree = { modules = [ kernelPackages.ati_drivers_x11 ]; driverName = "fglrx"; }; cirrus = { modules = [ xorg.xf86videocirrus ]; }; i810 = { modules = [ xorg.xf86videoi810 ]; }; intel = { modules = [ xorg.xf86videointel ]; }; @@ -362,7 +363,8 @@ in boot.extraModulePackages = optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11 ++ optional (elem "nvidiaLegacy" driverNames) kernelPackages.nvidia_x11_legacy ++ - optional (elem "virtualbox" driverNames) kernelPackages.virtualboxGuestAdditions; + optional (elem "virtualbox" driverNames) kernelPackages.virtualboxGuestAdditions ++ + optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11; environment.etc = optionals cfg.exportConfiguration [ { source = "${configFile}"; @@ -388,7 +390,8 @@ in ] ++ optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11 ++ optional (elem "nvidiaLegacy" driverNames) kernelPackages.nvidia_x11_legacy - ++ optional (elem "virtualbox" driverNames) xorg.xrefresh; + ++ optional (elem "virtualbox" driverNames) xorg.xrefresh + ++ optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11; environment.systemPackages = config.environment.x11Packages; @@ -408,6 +411,9 @@ in LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11}/lib"; } // optionalAttrs (elem "nvidiaLegacy" driverNames) { LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy}/lib"; + } // optionalAttrs (elem "ati_unfree" driverNames) { + LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.ati_drivers_x11}/lib:${kernelPackages.ati_drivers_x11}/X11R6/lib64/modules/linux"; + XORG_DRI_DRIVER_PATH = "${kernelPackages.ati_drivers_x11}/lib/dri"; # is ignored because ati drivers ship their own unpatched libglx.so ! } // cfg.displayManager.job.environment; preStart = == NIXPKGS commit 692efc2850f6c4c8db7bf2c86f32fd25a5f19313 Author: Marc Weber <[email protected]> Date: Mon May 17 16:45:12 2010 +0200 t/ati-drivers adding ati-drivers Signed-off-by: Marc Weber <[email protected]> diff --git a/pkgs/os-specific/linux/ati-drivers/builder.sh b/pkgs/os-specific/linux/ati-drivers/builder.sh new file mode 100644 index 0000000..898c4f6 --- /dev/null +++ b/pkgs/os-specific/linux/ati-drivers/builder.sh @@ -0,0 +1,200 @@ +# TODO use LIBGL_DRIVERS_PATH +# TODO gentoo removes some tools because there are xorg sources (?) +# TODO: compile: fglrx_xgamma (lib, executable?) ? +# done: compile fgl_glxgears ? + +source $stdenv/setup + +set -x + +die(){ echo $@; exit 1; } + + +# custom unpack: +cp $src archive +sh archive --extract . + + +kernelVersion=$(cd ${kernel}/lib/modules && ls) +kernelBuild=$(echo ${kernel}/lib/modules/$kernelVersion/build) + + +# note: maybe the .config file should be used to determine this ? +# current kbuild infrastructure allows using CONFIG_* defines +# but ati sources don't use them yet.. +# copy paste from make.sh +setSMP(){ + + linuxincludes=$kernelBuild/include + + # copied and stripped. source: make.sh: + + # 3 + # linux/autoconf.h may contain this: #define CONFIG_SMP 1 + + src_file=$linuxincludes/linux/autoconf.h + [ -e $src_file ] || die "$src_file not found" + + 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 + + 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 + +} + +setModVersions(){ + ! grep CONFIG_MODVERSIONS=y $kernel/config || + def_modversions="-DMODVERSIONS" + # make.sh contains much more code to determine this whether its enabled +} + + +# make.sh contains some code figuring out whether to use these or not.. +PAGE_ATTR_FIX=0 +setSMP +setModVersions +CC=gcc +MODULE=fglrx +case "$system" in + x86_64-linux) + arch=x86_64 + lib_arch=lib64 + ;; + i686-linux) + arch=x86 + lib_arch=lib + ;; + *) exit 1;; +esac +LIBIP_PREFIX=$TMP/arch/$arch/lib/modules/fglrx/build_mod +[ -d $LIBIP_PREFIX ] +GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`" + +{ # build .ko module + cd ./common/lib/modules/fglrx/build_mod/2.6.x + 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 + + 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" \ + KVER=$kernelVersion \ + KDIR=$kernelBuild \ + PAGE_ATTR_FIX=$PAGE_ATTR_FIX \ + -j4 + + cd $TMP +} + +{ # install + + ensureDir $out/lib/xorg + + cp -r common/usr/include $out + cp -r common/usr/sbin $out + cp -r common/usr/share $out + cp -r common/usr/X11R6 $out + + 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 + cp -r $DIR_DEPENDING_ON_XORG_VERSION/usr/X11R6/$lib_arch/* $out/lib/xorg + + t=$out/lib/modules/${kernelVersion}/kernel/drivers/misc + ensureDir $t + + cp ./common/lib/modules/fglrx/build_mod/2.6.x/fglrx.ko $t + + # should this be installed at all? + # its used by the example fglrx_gamma only + # don't use $out/lib/modules/dri because this will cause the kernel module + # aggregator code to see both: kernel version and the dri direcotry. It'll + # fail saying different kernel versions + 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/$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 + +} + +{ # build samples + ensureDir $out/bin + + mkdir -p samples + cd samples + tar xfz ../common/usr/src/ati/fglrx_sample_source.tgz + + + ( # build and install fgl_glxgears + cd fgl_glxgears; + gcc -DGL_ARB_texture_multisample=1 -g \ + -I$mesa/include \ + -I$out/include \ + -L$mesa/lib -lGL -lGLU -lX11 -lm \ + -o $out/bin/fgl_glxgears -Wall fgl_glxgears.c + ) + + true || ( # build and install + + # doesn't build undefined reference to `FGLRX_X11SetGamma' + # wich should be contained in -lfglrx_gamma + + cd programs/fglrx_gamma + gcc -fPIC -I${libXxf86vm}/include \ + -I${xf86vidmodeproto}/include \ + -I$out/X11R6/include \ + -L$out/lib \ + -Wall -lm -lfglrx_gamma -lX11 -lXext -o fglrx_xgamma fglrx_xgamma.c + ) + + { # copy binaries and wrap them: + BIN=$TMP/arch/$arch/usr/X11R6/bin + cp $BIN/* $out/bin + for prog in $BIN/*; do + patchelf --set-interpreter $(echo $glibc/lib/ld-linux*.so.2) $out/bin/$(basename $prog) + wrapProgram $out/bin/$(basename $prog) --prefix LD_LIBRARY_PATH : $out/lib:$LD_LIBRARY_PATH + done + } + + rm -fr $out/lib/modules/fglrx # don't think those .a files are needed. They cause failure of the mod + +} + + + +exit 0 +# shared libraries: +fglrx-info: +0x0000000000000001 (NEEDED) Shared library: [libGL.so.1] < unfree +0x0000000000000001 (NEEDED) Shared library: [libX11.so.6] +0x0000000000000001 (NEEDED) Shared library: [libXext.so.6] +0x0000000000000001 (NEEDED) Shared library: [libc.so.6] + +ati-config +0x0000000000000001 (NEEDED) Shared library: [libXrandr.so.2] libXrandr +0x0000000000000001 (NEEDED) Shared library: [libXrender.so.1] libXrender +0x0000000000000001 (NEEDED) Shared library: [libXext.so.6] libXext +0x0000000000000001 (NEEDED) Shared library: [libX11.so.6] libX11 + +0x0000000000000001 (NEEDED) Shared library: [libm.so.6] +0x0000000000000001 (NEEDED) Shared library: [libGL.so.1] +0x0000000000000001 (NEEDED) Shared library: [libc.so.6] +0x0000000000000001 (NEEDED) Shared library: [libdl.so.2] + diff --git a/pkgs/os-specific/linux/ati-drivers/default.nix b/pkgs/os-specific/linux/ati-drivers/default.nix new file mode 100644 index 0000000..5f94ed2 --- /dev/null +++ b/pkgs/os-specific/linux/ati-drivers/default.nix @@ -0,0 +1,65 @@ +{stdenv, fetchurl , kernel, xlibs, which, imake +, mesa # for fgl_glxgears +, libXxf86vm, xf86vidmodeproto # for fglrx_gamma +, xorg, makeWrapper, glibc, patchelf +}: + +# If you want to use a different Xorg version probably +# DIR_DEPENDING_ON_XORG_VERSION in builder.sh has to be adopted (?) +# make sure libglx.so of ati is used. xorg.xorgserver does provide it as well +# assert xorg.xorgserver.name == "xorg-server-1.7.5"; + +# The gentoo ebuild contains much more magic.. + +let lib = stdenv.lib; + inherit (lib) concatStringsSep; +in +# http://wiki.cchtml.com/index.php/Main_Page + +stdenv.mkDerivation { + name = "ati-drivers"; + + builder = ./builder.sh; + + inherit libXxf86vm xf86vidmodeproto; + + 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"; + }; + + buildInputs = [xlibs.libXext xlibs.libX11 + xlibs.libXrandr which imake makeWrapper + patchelf + ]; + inherit kernel glibc /* glibc only used for setting interpreter */; + + LD_LIBRARY_PATH = concatStringsSep ":" + [ "${xorg.libXrandr}/lib" + "${xorg.libXrender}/lib" + "${xorg.libXext}/lib" + "${xorg.libX11}/lib" + ]; + + inherit mesa; # only required to build examples + + meta = { + description = "ati drivers"; + homepage = http://support.amd.com/us/gpudownload/Pages/index.aspx; + license = "unfree"; + maintainers = [stdenv.lib.maintainers.marcweber]; + platforms = stdenv.lib.platforms.linux; + }; +} + +/* may be of interest: + + + sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \ + "${MODULE_DIR}/firegl_public.c" \ + || die "Failed to enable debug output." + + +*/ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 277e3aa..280bbde 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6255,6 +6255,12 @@ let inherit kernel; + ati_drivers_x11 = import ../os-specific/linux/ati-drivers { + inherit stdenv fetchurl kernel xlibs which mesa xorg makeWrapper + patchelf glibc; + inherit (xorg) imake libXxf86vm xf86vidmodeproto; + }; + aufs = import ../os-specific/linux/aufs { inherit fetchurl stdenv kernel; }; _______________________________________________ nix-dev mailing list [email protected] https://mail.cs.uu.nl/mailman/listinfo/nix-dev
