summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/alsa-lib/default.nix11
-rw-r--r--pkgs/os-specific/linux/alsa-lib/mips-atomic.patch39
-rw-r--r--pkgs/os-specific/linux/alsa-utils/default.nix3
-rw-r--r--pkgs/os-specific/linux/dmidecode/default.nix6
-rw-r--r--pkgs/os-specific/linux/fbterm/stdenv.nix35
-rw-r--r--pkgs/os-specific/linux/hal/default.nix13
-rw-r--r--pkgs/os-specific/linux/kbd/default.nix17
-rw-r--r--pkgs/os-specific/linux/kernel-headers/2.6.28.nix1
-rw-r--r--pkgs/os-specific/linux/kernel-headers/2.6.32.nix1
-rw-r--r--pkgs/os-specific/linux/kernel/builder.sh143
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.34.nix241
-rw-r--r--pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.35.nix241
-rw-r--r--pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.36.nix241
-rw-r--r--pkgs/os-specific/linux/kernel/mips_restart.patch12
-rw-r--r--pkgs/os-specific/linux/kernel/patches.nix14
-rw-r--r--pkgs/os-specific/linux/kernel/sheevaplug_modules-2.6.35.patch63
-rw-r--r--pkgs/os-specific/linux/klibc/default.nix46
-rw-r--r--pkgs/os-specific/linux/klibc/make382.patch35
-rw-r--r--pkgs/os-specific/linux/libcap/default.nix29
-rw-r--r--pkgs/os-specific/linux/libcap/man.nix15
-rw-r--r--pkgs/os-specific/linux/libcap/pam.nix17
-rw-r--r--pkgs/os-specific/linux/libcap/progs.nix15
-rw-r--r--pkgs/os-specific/linux/lvm2/default.nix2
-rw-r--r--pkgs/os-specific/linux/mingetty/default.nix4
-rw-r--r--pkgs/os-specific/linux/mountall/default.nix6
-rw-r--r--pkgs/os-specific/linux/nfs-utils/default.nix6
-rw-r--r--pkgs/os-specific/linux/pam/default.nix4
-rw-r--r--pkgs/os-specific/linux/procps/default.nix2
-rw-r--r--pkgs/os-specific/linux/procps/gnumake3.82.patch13
-rw-r--r--pkgs/os-specific/linux/sysvinit/default.nix11
-rw-r--r--pkgs/os-specific/linux/sysvinit/sysvinit-2.85-exec.patch22
-rw-r--r--pkgs/os-specific/linux/uclibc/default.nix91
-rw-r--r--pkgs/os-specific/linux/util-linux-ng/default.nix21
34 files changed, 1250 insertions, 176 deletions
diff --git a/pkgs/os-specific/linux/alsa-lib/default.nix b/pkgs/os-specific/linux/alsa-lib/default.nix
index 727db1c9642..5ebf5264439 100644
--- a/pkgs/os-specific/linux/alsa-lib/default.nix
+++ b/pkgs/os-specific/linux/alsa-lib/default.nix
@@ -14,6 +14,12 @@ stdenv.mkDerivation rec {
   postPatch = ''
     sed -i -e 's|//int snd_pcm_mixer_element(snd_pcm_t \*pcm, snd_mixer_t \*mixer, snd_mixer_elem_t \*\*elem);|/\*int snd_pcm_mixer_element(snd_pcm_t \*pcm, snd_mixer_t \*mixer, snd_mixer_elem_t \*\*elem);\*/|' include/pcm.h
   '';
+
+  crossAttrs = {
+    patchPhase = ''
+      sed -i s/extern/static/g include/iatomic.h
+    '';
+  };
   
   meta = {
     description = "ALSA, the Advanced Linux Sound Architecture libraries";
@@ -33,5 +39,10 @@ stdenv.mkDerivation rec {
        See http://thread.gmane.org/gmane.linux.distributions.nixos/3435
     */
     ./alsa-plugin-dirs.patch
+
+    /* patch provided by larsc on irc.
+       it may be a compiler problem on mips; without this, alsa does not build
+       on mips, because lacks some symbols atomic_add/atomic_sub  */
+    ./mips-atomic.patch
   ];
 }
diff --git a/pkgs/os-specific/linux/alsa-lib/mips-atomic.patch b/pkgs/os-specific/linux/alsa-lib/mips-atomic.patch
new file mode 100644
index 00000000000..3af7c5d4deb
--- /dev/null
+++ b/pkgs/os-specific/linux/alsa-lib/mips-atomic.patch
@@ -0,0 +1,39 @@
+diff --git a/include/iatomic.h b/include/iatomic.h
+index e92dbfd..364bc5c 100644
+--- a/include/iatomic.h
++++ b/include/iatomic.h
+@@ -720,7 +720,7 @@ typedef struct { volatile int counter; } atomic_t;
+  * Atomically adds @i to @v.  Note that the guaranteed useful range
+  * of an atomic_t is only 24 bits.
+  */
+-extern __inline__ void atomic_add(int i, atomic_t * v)
++static __inline__ void atomic_add(int i, atomic_t * v)
+ {
+ 	unsigned long temp;
+ 
+@@ -744,7 +744,7 @@ extern __inline__ void atomic_add(int i, atomic_t * v)
+  * Atomically subtracts @i from @v.  Note that the guaranteed
+  * useful range of an atomic_t is only 24 bits.
+  */
+-extern __inline__ void atomic_sub(int i, atomic_t * v)
++static __inline__ void atomic_sub(int i, atomic_t * v)
+ {
+ 	unsigned long temp;
+ 
+@@ -763,7 +763,7 @@ extern __inline__ void atomic_sub(int i, atomic_t * v)
+ /*
+  * Same as above, but return the result value
+  */
+-extern __inline__ int atomic_add_return(int i, atomic_t * v)
++static __inline__ int atomic_add_return(int i, atomic_t * v)
+ {
+ 	unsigned long temp, result;
+ 
+@@ -784,7 +784,7 @@ extern __inline__ int atomic_add_return(int i, atomic_t * v)
+ 	return result;
+ }
+ 
+-extern __inline__ int atomic_sub_return(int i, atomic_t * v)
++static __inline__ int atomic_sub_return(int i, atomic_t * v)
+ {
+ 	unsigned long temp, result;
diff --git a/pkgs/os-specific/linux/alsa-utils/default.nix b/pkgs/os-specific/linux/alsa-utils/default.nix
index e20163bfc97..ad092fa7821 100644
--- a/pkgs/os-specific/linux/alsa-utils/default.nix
+++ b/pkgs/os-specific/linux/alsa-utils/default.nix
@@ -8,7 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "1c7pl5k3d60wacnha8zfn2dixz7hiiaxvijis4559y15bs8mxl5p";
   };
   
-  buildInputs = [ alsaLib gettext ncurses ];
+  buildInputs = [ alsaLib ncurses ];
+  buildNativeInputs = [ gettext ];
   
   configureFlags = "--disable-xmlto";
 
diff --git a/pkgs/os-specific/linux/dmidecode/default.nix b/pkgs/os-specific/linux/dmidecode/default.nix
index 4e9c49e4f58..7a291cba26c 100644
--- a/pkgs/os-specific/linux/dmidecode/default.nix
+++ b/pkgs/os-specific/linux/dmidecode/default.nix
@@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
     sha256 = "1h72r5scrpvgw60hif5msjg6vw2x0jd6z094lhbh6cjk6gls6x2d";
   };
 
+  # Taken from gentoo, to build with gnumake 3.82
+  # http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/dmidecode/dmidecode-2.10.ebuild?r1=1.5&r2=1.6
+  patchPhase = ''
+    sed -i -e '/^PROGRAMS !=/d' Makefile
+  '';
+
   makeFlags = "prefix=$(out)";
 
   meta = {
diff --git a/pkgs/os-specific/linux/fbterm/stdenv.nix b/pkgs/os-specific/linux/fbterm/stdenv.nix
new file mode 100644
index 00000000000..893dba11b60
--- /dev/null
+++ b/pkgs/os-specific/linux/fbterm/stdenv.nix
@@ -0,0 +1,35 @@
+# Quick version to be able to cross-build fbterm meanwhile builderDefs cannot
+# cross-build with an equivalent to the stdenvCross adapter.
+{ stdenv, fetchurl, gpm, freetype, fontconfig, pkgconfig, ncurses }:
+
+let
+  version="1.5";
+  name="fbterm-1.5";
+  hash="05qzc6g9a79has3cy7dlw70n4pn13r552a2i1g4xy23acnpvvjsb";
+  url="http://fbterm.googlecode.com/files/fbterm-${version}.tar.gz";
+in
+
+stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    inherit url;
+    sha256 = hash;
+  };
+
+  buildNativeInputs = [ ncurses ];
+  buildInputs = [ gpm freetype fontconfig pkgconfig ];
+
+  patchPhase = ''
+    sed -e '/ifdef SYS_signalfd/atypedef long long loff_t;' -i src/fbterm.cpp
+
+    sed -e '/install-exec-hook:/,/^[^\t]/{d}; /.NOEXPORT/iinstall-exec-hook:\
+    ' -i src/Makefile.in
+
+    export HOME=$PWD;
+
+    export NIX_LDFLAGS="$NIX_LDFLAGS -lfreetype"
+    # This is only relevant cross-building
+    export NIX_CROSS_LDFLAGS="$NIX_CROSS_LDFLAGS -lfreetype"
+  '';
+}
diff --git a/pkgs/os-specific/linux/hal/default.nix b/pkgs/os-specific/linux/hal/default.nix
index 6672b111d17..718d54f3106 100644
--- a/pkgs/os-specific/linux/hal/default.nix
+++ b/pkgs/os-specific/linux/hal/default.nix
@@ -7,6 +7,12 @@
 
 assert stdenv ? glibc;
 
+let
+  isPC = stdenv.isi686 || stdenv.isx86_64;
+  changeDmidecode = if isPC then
+    "--replace /usr/sbin/dmidecode ${dmidecode}/sbin/dmidecode"
+    else "";
+in
 stdenv.mkDerivation rec {
   name = "hal-0.5.14";
 
@@ -19,8 +25,7 @@ stdenv.mkDerivation rec {
     pkgconfig python pciutils expat libusb dbus.libs dbus_glib glib
     libuuid perl perlXMLParser gettext zlib gperf
     consolekit policykit
-    # !!! libsmbios is broken; it doesn't install headers.
-  ] ++ stdenv.lib.optional (stdenv.system != "armv5tel-linux") [ libsmbios ];
+  ];
 
   # !!! Hm, maybe the pci/usb.ids location should be in /etc, so that
   # we don't have to rebuild HAL when we update the PCI/USB IDs.
@@ -34,7 +39,7 @@ stdenv.mkDerivation rec {
   '';
 
   propagatedBuildInputs = [ libusb ]
-    ++ stdenv.lib.optionals (stdenv.system != "armv5tel-linux") [ libsmbios ];
+    ++ stdenv.lib.optional isPC libsmbios;
 
   preConfigure = ''
     for i in hald/linux/probing/probe-smbios.c hald/linux/osspec.c \
@@ -44,7 +49,7 @@ stdenv.mkDerivation rec {
              tools/linux/hal-*-linux
     do
       substituteInPlace $i \
-        --replace /usr/sbin/dmidecode ${dmidecode}/sbin/dmidecode \
+        ${changeDmidecode} \
         ${if udev != null then "--replace /sbin/udevadm ${udev}/sbin/udevadm" else ""} \
         --replace /bin/mount ${utillinuxng}/bin/mount \
         --replace /bin/umount ${utillinuxng}/bin/umount \
diff --git a/pkgs/os-specific/linux/kbd/default.nix b/pkgs/os-specific/linux/kbd/default.nix
index 77d53adeb81..c54ac4c2c73 100644
--- a/pkgs/os-specific/linux/kbd/default.nix
+++ b/pkgs/os-specific/linux/kbd/default.nix
@@ -1,19 +1,22 @@
 { stdenv, fetchurl, bison, flex, autoconf, automake }:
 
 stdenv.mkDerivation rec {
-  name = "kbd-1.15.1";
+  name = "kbd-1.15.2";
 
   src = fetchurl {
     url = "ftp://ftp.altlinux.org/pub/people/legion/kbd/${name}.tar.gz";
-    sha256 = "1klrxas8vjikx6jm6m2lcpmn88lhxb6p3whwgdwq9d9flf1qrf4i";
+    sha256 = "0ff674y6d3b6ix08b9l2yzv8igns768biyp5y92vip7iz4xv2p2j";
   };
 
-  buildInputs = [ bison flex autoconf automake  ];
+  buildNativeInputs = [ bison flex autoconf automake ];
 
-  # We get a warning in armv5tel-linux, so we disable -Werror in it
-  patchPhase = if (stdenv.system == "armv5tel-linux") then ''
-    sed -i s/-Werror// src/Makefile.am
-  '' else "";
+  # We get a warning in armv5tel-linux and the fuloong2f,
+  # so we disable -Werror in it
+  patchPhase = if (stdenv.system == "armv5tel-linux" ||
+    stdenv.system == "mips64-linux")
+    then ''
+      sed -i s/-Werror// src/Makefile.am
+    '' else "";
 
   # Grrr, kbd 1.15.1 doesn't include a configure script.
   preConfigure = "autoreconf";
diff --git a/pkgs/os-specific/linux/kernel-headers/2.6.28.nix b/pkgs/os-specific/linux/kernel-headers/2.6.28.nix
index 82840f8a51f..a85e6f79bf1 100644
--- a/pkgs/os-specific/linux/kernel-headers/2.6.28.nix
+++ b/pkgs/os-specific/linux/kernel-headers/2.6.28.nix
@@ -20,6 +20,7 @@ stdenv.mkDerivation {
     if stdenv.system == "x86_64-linux" then "x86_64" else
     if stdenv.system == "powerpc-linux" then "powerpc" else
     if stdenv.system == "armv5tel-linux" then "arm" else
+    if stdenv.system == "mips64-linux" then "mips" else
     abort "don't know what the kernel include directory is called for this platform";
 
   buildInputs = [perl];
diff --git a/pkgs/os-specific/linux/kernel-headers/2.6.32.nix b/pkgs/os-specific/linux/kernel-headers/2.6.32.nix
index 936ef5ec40d..a4e86658193 100644
--- a/pkgs/os-specific/linux/kernel-headers/2.6.32.nix
+++ b/pkgs/os-specific/linux/kernel-headers/2.6.32.nix
@@ -26,6 +26,7 @@ stdenv.mkDerivation {
     if stdenv.system == "x86_64-linux" then "x86_64" else
     if stdenv.system == "powerpc-linux" then "powerpc" else
     if stdenv.system == "armv5tel-linux" then "arm" else
+    if stdenv.platform ? kernelArch then stdenv.platform.kernelArch else
     abort "don't know what the kernel include directory is called for this platform";
 
   buildInputs = [perl];
diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh
index e7d25e86883..bb030abaa6c 100644
--- a/pkgs/os-specific/linux/kernel/builder.sh
+++ b/pkgs/os-specific/linux/kernel/builder.sh
@@ -68,81 +68,88 @@ installPhase() {
     if test "$arch" = um; then
         ensureDir $out/bin
         cp linux $out/bin
-    else
+    elif test "$kernelTarget" != "vmlinux"; then
+        # In any case we copy the 'vmlinux' ELF in the next lines
         cp arch/$archDir/boot/$kernelTarget $out
     fi
 
     cp vmlinux $out
 
-    # Install the modules in $out/lib/modules with matching paths
-    # in modules.dep (i.e., refererring to $out/lib/modules, not
-    # /lib/modules).  The depmod_opts= is to prevent the kernel
-    # from passing `-b PATH' to depmod.
-    export MODULE_DIR=$out/lib/modules/
-    substituteInPlace Makefile --replace '-b $(INSTALL_MOD_PATH)' ''
-    make modules_install \
-        DEPMOD=$module_init_tools/sbin/depmod depmod_opts= \
-        $makeFlags "${makeFlagsArray[@]}" \
-        $installFlags "${installFlagsArray[@]}"
-
-    if test -z "$dontStrip"; then
-        # Strip the kernel modules.
-	echo "Stripping kernel modules..."
-	if [ -z "$crossConfig" ]; then
-            find $out -name "*.ko" -print0 | xargs -0 strip -S
-	else
-            find $out -name "*.ko" -print0 | xargs -0 $crossConfig-strip -S
-	fi
+    if grep -q "CONFIG_MODULES=y" .config; then
+        # Install the modules in $out/lib/modules with matching paths
+        # in modules.dep (i.e., refererring to $out/lib/modules, not
+        # /lib/modules).  The depmod_opts= is to prevent the kernel
+        # from passing `-b PATH' to depmod.
+        export MODULE_DIR=$out/lib/modules/
+        substituteInPlace Makefile --replace '-b $(INSTALL_MOD_PATH)' ''
+        make modules_install \
+            DEPMOD=$module_init_tools/sbin/depmod depmod_opts= \
+            $makeFlags "${makeFlagsArray[@]}" \
+            $installFlags "${installFlagsArray[@]}"
+
+        if test -z "$dontStrip"; then
+            # Strip the kernel modules.
+        echo "Stripping kernel modules..."
+        if [ -z "$crossConfig" ]; then
+                find $out -name "*.ko" -print0 | xargs -0 strip -S
+        else
+                find $out -name "*.ko" -print0 | xargs -0 $crossConfig-strip -S
+        fi
+        fi
+
+        # move this to install later on
+        # largely copied from early FC3 kernel spec files
+        version=$(cd $out/lib/modules && ls -d *)
+
+        # remove symlinks and create directories
+        rm -f $out/lib/modules/$version/build
+        rm -f $out/lib/modules/$version/source
+        mkdir $out/lib/modules/$version/build
+
+        # copy config
+        cp .config $out/lib/modules/$version/build/.config
+        ln -s $out/lib/modules/$version/build/.config $out/config
+
+        if test "$arch" != um; then
+            # copy all Makefiles and Kconfig files
+            ln -s $out/lib/modules/$version/build $out/lib/modules/$version/source
+            cp --parents `find  -type f -name Makefile -o -name "Kconfig*"` $out/lib/modules/$version/build
+            cp Module.symvers $out/lib/modules/$version/build
+
+        if test "$dontStrip" = "1"; then
+            # copy any debugging info that can be found
+            cp --parents -rv `find -name \*.debug -o -name debug.a`	\
+               "$out/lib/modules/$version/build"
+        fi
+
+            # weed out unneeded stuff
+            rm -rf $out/lib/modules/$version/build/Documentation
+            rm -rf $out/lib/modules/$version/build/scripts
+            rm -rf $out/lib/modules/$version/build/include
+
+            # copy architecture dependent files
+            cp -a arch/$archDir/scripts $out/lib/modules/$version/build/ || true
+            cp -a arch/$archDir/*lds $out/lib/modules/$version/build/ || true
+            cp -a arch/$archDir/Makefile*.cpu $out/lib/modules/$version/build/arch/$archDir/ || true
+            cp -a --parents arch/$archDir/kernel/asm-offsets.s $out/lib/modules/$version/build/arch/$archDir/kernel/ || true
+
+            # copy scripts
+            rm -f scripts/*.o
+            rm -f scripts/*/*.o
+            cp -a scripts $out/lib/modules/$version/build
+
+            # copy include files
+            includeDir=$out/lib/modules/$version/build/include
+            mkdir -p $includeDir
+            (cd include && cp -a * $includeDir)
+        (cd arch/$archDir/include && cp -a * $includeDir || true)
+        (cd arch/$archDir/include && cp -a asm/* $includeDir/asm/ || true)
+        (cd arch/$archDir/include/asm/mach-generic && cp -a * $includeDir/ || true)
+        fi
     fi
 
-    # move this to install later on
-    # largely copied from early FC3 kernel spec files
-    version=$(cd $out/lib/modules && ls -d *)
-
-    # remove symlinks and create directories
-    rm -f $out/lib/modules/$version/build
-    rm -f $out/lib/modules/$version/source
-    mkdir $out/lib/modules/$version/build
-
-    # copy config
-    cp .config $out/lib/modules/$version/build/.config
-    ln -s $out/lib/modules/$version/build/.config $out/config
-
-    if test "$arch" != um; then
-        # copy all Makefiles and Kconfig files
-        ln -s $out/lib/modules/$version/build $out/lib/modules/$version/source
-        cp --parents `find  -type f -name Makefile -o -name "Kconfig*"` $out/lib/modules/$version/build
-        cp Module.symvers $out/lib/modules/$version/build
-
-	if test "$dontStrip" = "1"; then
-	    # copy any debugging info that can be found
-	    cp --parents -rv `find -name \*.debug -o -name debug.a`	\
-	       "$out/lib/modules/$version/build"
-	fi
-
-        # weed out unneeded stuff
-        rm -rf $out/lib/modules/$version/build/Documentation
-        rm -rf $out/lib/modules/$version/build/scripts
-        rm -rf $out/lib/modules/$version/build/include
-
-        # copy architecture dependent files
-        cp -a arch/$archDir/scripts $out/lib/modules/$version/build/ || true
-        cp -a arch/$archDir/*lds $out/lib/modules/$version/build/ || true
-        cp -a arch/$archDir/Makefile*.cpu $out/lib/modules/$version/build/arch/$archDir/ || true
-        cp -a --parents arch/$archDir/kernel/asm-offsets.s $out/lib/modules/$version/build/arch/$archDir/kernel/ || true
-
-        # copy scripts
-        rm -f scripts/*.o
-        rm -f scripts/*/*.o
-        cp -a scripts $out/lib/modules/$version/build
-
-        # copy include files
-        includeDir=$out/lib/modules/$version/build/include
-        mkdir -p $includeDir
-        (cd include && cp -a * $includeDir)
-	(cd arch/$archDir/include && cp -a * $includeDir || true)
-	(cd arch/$archDir/include && cp -a asm/* $includeDir/asm/ || true)
-	(cd arch/$archDir/include/asm/mach-generic && cp -a * $includeDir/ || true)
+    if test -n "$postInstall"; then 
+        eval "$postInstall"; 
     fi
 }
 
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index da3f6862a10..42cefd5b584 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -34,11 +34,12 @@
 , preConfigure ? ""
 , extraMeta ? {}
 , ubootChooser ? null
+, postInstall ? ""
 , ...
 }:
 
 assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"
-  || stdenv.system == "armv5tel-linux";
+  || stdenv.system == "armv5tel-linux" || stdenv.system == "mips64-linux";
 
 assert stdenv.platform.name == "sheevaplug" -> stdenv.platform.uboot != null;
 
@@ -69,7 +70,7 @@ stdenv.mkDerivation {
 
   generateConfig = ./generate-config.pl;
 
-  inherit preConfigure src module_init_tools localVersion;
+  inherit preConfigure src module_init_tools localVersion postInstall;
 
   patches = map (p: p.patch) kernelPatches;
 
@@ -94,6 +95,7 @@ stdenv.mkDerivation {
     if stdenv.system == "i686-linux" then "i386" else
     if stdenv.system == "x86_64-linux" then "x86_64" else
     if stdenv.system == "armv5tel-linux" then "arm" else
+    if stdenv.system == "mips64-linux" then "mips" else
     abort "Platform ${stdenv.system} is not supported.";
 
   crossAttrs = let
diff --git a/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.34.nix b/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.34.nix
new file mode 100644
index 00000000000..0eb291d5b55
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.34.nix
@@ -0,0 +1,241 @@
+args @ { stdenv, fetchurl, fetchsvn, userModeLinux ? false, extraConfig ? ""
+, ... }:
+
+let
+  configWithPlatform = kernelPlatform :
+    ''
+      # Don't include any debug features.
+      DEBUG_KERNEL n
+
+      # Support drivers that need external firmware.
+      STANDALONE n
+
+      # Make /proc/config.gz available.
+      IKCONFIG_PROC y
+
+      # Optimize with -O2, not -Os.
+      CC_OPTIMIZE_FOR_SIZE n
+
+      # Enable the kernel's built-in memory tester.
+      MEMTEST y
+
+      # Include the CFQ I/O scheduler in the kernel, rather than as a
+      # module, so that the initrd gets a good I/O scheduler.
+      IOSCHED_CFQ y
+
+      # Disable some expensive (?) features.
+      FTRACE n
+      KPROBES n
+      NUMA? n
+      PM_TRACE_RTC n
+
+      # Enable various subsystems.
+      ACCESSIBILITY y # Accessibility support
+      AUXDISPLAY y # Auxiliary Display support
+      DONGLE y # Serial dongle support
+      HIPPI y
+      MTD_COMPLEX_MAPPINGS y # needed for many devices
+      NET_POCKET y # enable pocket and portable adapters
+      SCSI_LOWLEVEL y # enable lots of SCSI devices
+      SCSI_LOWLEVEL_PCMCIA y
+      SPI y # needed for many devices
+      SPI_MASTER y
+      WAN y
+
+      # Networking options.
+      IP_PNP n
+      IPV6_PRIVACY y
+      NETFILTER_ADVANCED y
+      IP_VS_PROTO_TCP y
+      IP_VS_PROTO_UDP y
+      IP_VS_PROTO_ESP y
+      IP_VS_PROTO_AH y
+      IP_DCCP_CCID3 n # experimental
+      CLS_U32_PERF y
+      CLS_U32_MARK y
+
+      # Wireless networking.
+      IPW2100_MONITOR y # support promiscuous mode
+      IPW2200_MONITOR y # support promiscuous mode
+      IWL4965 y # Intel Wireless WiFi 4965AGN
+      IWL5000 y # Intel Wireless WiFi 5000AGN
+      HOSTAP_FIRMWARE y # Support downloading firmware images with Host AP driver
+      HOSTAP_FIRMWARE_NVRAM y
+
+      # Some settings to make sure that fbcondecor works - in particular,
+      # disable tileblitting and the drivers that need it.
+
+      # Enable various FB devices.
+      FB y
+      FB_EFI y
+      FB_NVIDIA_I2C y # Enable DDC Support
+      FB_RIVA_I2C y
+      FB_ATY_CT y # Mach64 CT/VT/GT/LT (incl. 3D RAGE) support
+      FB_ATY_GX y # Mach64 GX support
+      FB_SAVAGE_I2C y
+      FB_SAVAGE_ACCEL y
+      FB_SIS_300 y
+      FB_SIS_315 y
+      FB_3DFX_ACCEL y
+      FB_GEODE y
+
+      # Video configuration
+      # The intel drivers already require KMS
+      DRM_I915_KMS y
+
+      # Sound.
+      SND_AC97_POWER_SAVE y # AC97 Power-Saving Mode
+      SND_HDA_INPUT_BEEP y # Support digital beep via input layer
+      SND_USB_CAIAQ_INPUT y
+      PSS_MIXER y # Enable PSS mixer (Beethoven ADSP-16 and other compatible)
+
+      # USB serial devices.
+      USB_SERIAL_GENERIC y # USB Generic Serial Driver
+      USB_SERIAL_KEYSPAN_MPR y # include firmware for various USB serial devices
+      USB_SERIAL_KEYSPAN_USA28 y
+      USB_SERIAL_KEYSPAN_USA28X y
+      USB_SERIAL_KEYSPAN_USA28XA y
+      USB_SERIAL_KEYSPAN_USA28XB y
+      USB_SERIAL_KEYSPAN_USA19 y
+      USB_SERIAL_KEYSPAN_USA18X y
+      USB_SERIAL_KEYSPAN_USA19W y
+      USB_SERIAL_KEYSPAN_USA19QW y
+      USB_SERIAL_KEYSPAN_USA19QI y
+      USB_SERIAL_KEYSPAN_USA49W y
+      USB_SERIAL_KEYSPAN_USA49WLC y
+
+      # Filesystem options - in particular, enable extended attributes and
+      # ACLs for all filesystems that support them.
+      EXT2_FS_XATTR y # Ext2 extended attributes
+      EXT2_FS_POSIX_ACL y # Ext2 POSIX Access Control Lists
+      EXT2_FS_SECURITY y # Ext2 Security Labels
+      EXT2_FS_XIP y # Ext2 execute in place support
+      EXT4_FS_POSIX_ACL y
+      EXT4_FS_SECURITY y
+      REISERFS_FS_XATTR y
+      REISERFS_FS_POSIX_ACL y
+      REISERFS_FS_SECURITY y
+      JFS_POSIX_ACL y
+      JFS_SECURITY y
+      XFS_QUOTA y
+      XFS_POSIX_ACL y
+      XFS_RT y # XFS Realtime subvolume support
+      OCFS2_DEBUG_MASKLOG n
+      BTRFS_FS_POSIX_ACL y
+      UBIFS_FS_XATTR y
+      UBIFS_FS_ADVANCED_COMPR y
+      NFSD_V2_ACL y
+      NFSD_V3 y
+      NFSD_V3_ACL y
+      NFSD_V4 y
+      CIFS_XATTR y
+      CIFS_POSIX y
+
+      # Security related features.
+      STRICT_DEVMEM y # Filter access to /dev/mem
+      SECURITY_SELINUX_BOOTPARAM_VALUE 0 # disable SELinux by default
+
+      # Misc. options.
+      8139TOO_8129 y
+      8139TOO_PIO n # PIO is slower
+      AIC79XX_DEBUG_ENABLE n
+      AIC7XXX_DEBUG_ENABLE n
+      AIC94XX_DEBUG n
+      B43_PCMCIA y
+      BLK_DEV_BSG n
+      BLK_DEV_CMD640_ENHANCED y # CMD640 enhanced support
+      BLK_DEV_IDEACPI y # IDE ACPI support
+      BLK_DEV_INTEGRITY y
+      BSD_PROCESS_ACCT_V3 y
+      BT_HCIUART_BCSP y
+      BT_HCIUART_H4 y # UART (H4) protocol support
+      BT_HCIUART_LL y
+      BT_RFCOMM_TTY y # RFCOMM TTY support
+      CPU_FREQ_DEBUG n
+      CRASH_DUMP n
+      DMAR? n # experimental
+      DVB_DYNAMIC_MINORS y # we use udev
+      FUSION y # Fusion MPT device support
+      IDE_GD_ATAPI y # ATAPI floppy support
+      IRDA_ULTRA y # Ultra (connectionless) protocol
+      JOYSTICK_IFORCE_232 y # I-Force Serial joysticks and wheels
+      JOYSTICK_IFORCE_USB y # I-Force USB joysticks and wheels
+      JOYSTICK_XPAD_FF y # X-Box gamepad rumble support
+      JOYSTICK_XPAD_LEDS y # LED Support for Xbox360 controller 'BigX' LED
+      KALLSYMS_EXTRA_PASS n
+      LDM_PARTITION y # Windows Logical Disk Manager (Dynamic Disk) support
+      LEDS_TRIGGER_IDE_DISK y # LED IDE Disk Trigger
+      LOGIRUMBLEPAD2_FF y # Logitech Rumblepad 2 force feedback
+      LOGO n # not needed
+      MEDIA_ATTACH y
+      MEGARAID_NEWGEN y
+      MICROCODE_AMD y
+      MODVERSIONS y
+      MOUSE_PS2_ELANTECH y # Elantech PS/2 protocol extension
+      MTRR_SANITIZER y
+      NET_FC y # Fibre Channel driver support
+      PPP_MULTILINK y # PPP multilink support
+      REGULATOR y # Voltage and Current Regulator Support
+      SCSI_LOGGING y # SCSI logging facility
+      SERIAL_8250 y # 8250/16550 and compatible serial support
+      SLIP_COMPRESSED y # CSLIP compressed headers
+      SLIP_SMART y
+      THERMAL_HWMON y # Hardware monitoring support
+      USB_DEBUG n
+      USB_EHCI_ROOT_HUB_TT y # Root Hub Transaction Translators
+      X86_CHECK_BIOS_CORRUPTION y
+      X86_MCE y
+
+      ${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
+      ${extraConfig}
+    '';
+in
+
+import ./generic.nix (
+
+  rec {
+    version = "qi_lb60-2.6.34.1-openwrt-22513";
+  
+    src = fetchurl {
+      url = "mirror://kernel/linux/kernel/v2.6/linux-2.6.34.1.tar.bz2";
+      sha256 = "0v78yvkwr100v7bnrkkabxmpv5hjg1ngrjbr5d0kkzsw4d7bmm5x";
+    };
+
+    srcPatch = fetchsvn {
+      url = "svn://svn.openwrt.org/openwrt/trunk/target/linux";
+      rev = 22513;
+      sha256 = "0b7wzgqnbq8sq32z9ik08n1b7fnc9v9d91zwvb6qz7vj3dlrxw3g";
+    };
+
+    preConfigure = ''
+      cp -R ${srcPatch}/generic/files/* .
+      chmod +w -R *
+      GLOBIGNORE='.:..:*preinit_as_init*'
+      for a in ${srcPatch}/generic/patches-2.6.34/* ${srcPatch}/xburst/patches-2.6.34/* ; do
+        echo applying patch $a
+        patch -p1 < $a
+      done
+      unset GLOBIGNORE
+      cat ${srcPatch}/generic/config-2.6.34 ${srcPatch}/xburst/config-2.6.34 \
+          ${srcPatch}/xburst/qi_lb60/config-2.6.34 > arch/mips/configs/qi_lb60_defconfig
+    '';
+
+    postInstall = ''
+      set -x
+      gzip -9 -c $out/vmlinux.bin > $out/vmlinux.bin.gz
+      KERNEL_ENTRY="0x`$crossConfig-nm $out/vmlinux 2>/dev/null |
+        grep " kernel_entry" | cut -f1 -d ' '`"
+      mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \
+          -e $KERNEL_ENTRY -n "MIPS Nix Linux-2.6.34" \
+          -d $out/vmlinux.bin.gz $out/uImage
+      set +x
+    '';
+
+    config = configWithPlatform stdenv.platform;
+    configCross = configWithPlatform stdenv.cross.platform;
+
+    features.iwlwifi = true;
+  }
+
+  // removeAttrs args ["extraConfig"]
+)
diff --git a/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.35.nix b/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.35.nix
new file mode 100644
index 00000000000..ac0b000f9cd
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.35.nix
@@ -0,0 +1,241 @@
+args @ { stdenv, fetchurl, fetchsvn, userModeLinux ? false, extraConfig ? ""
+, ... }:
+
+let
+  configWithPlatform = kernelPlatform :
+    ''
+      # Don't include any debug features.
+      DEBUG_KERNEL n
+
+      # Support drivers that need external firmware.
+      STANDALONE n
+
+      # Make /proc/config.gz available.
+      IKCONFIG_PROC y
+
+      # Optimize with -O2, not -Os.
+      CC_OPTIMIZE_FOR_SIZE n
+
+      # Enable the kernel's built-in memory tester.
+      MEMTEST y
+
+      # Include the CFQ I/O scheduler in the kernel, rather than as a
+      # module, so that the initrd gets a good I/O scheduler.
+      IOSCHED_CFQ y
+
+      # Disable some expensive (?) features.
+      FTRACE n
+      KPROBES n
+      NUMA? n
+      PM_TRACE_RTC n
+
+      # Enable various subsystems.
+      ACCESSIBILITY y # Accessibility support
+      AUXDISPLAY y # Auxiliary Display support
+      DONGLE y # Serial dongle support
+      HIPPI y
+      MTD_COMPLEX_MAPPINGS y # needed for many devices
+      NET_POCKET y # enable pocket and portable adapters
+      SCSI_LOWLEVEL y # enable lots of SCSI devices
+      SCSI_LOWLEVEL_PCMCIA y
+      SPI y # needed for many devices
+      SPI_MASTER y
+      WAN y
+
+      # Networking options.
+      IP_PNP n
+      IPV6_PRIVACY y
+      NETFILTER_ADVANCED y
+      IP_VS_PROTO_TCP y
+      IP_VS_PROTO_UDP y
+      IP_VS_PROTO_ESP y
+      IP_VS_PROTO_AH y
+      IP_DCCP_CCID3 n # experimental
+      CLS_U32_PERF y
+      CLS_U32_MARK y
+
+      # Wireless networking.
+      IPW2100_MONITOR y # support promiscuous mode
+      IPW2200_MONITOR y # support promiscuous mode
+      IWL4965 y # Intel Wireless WiFi 4965AGN
+      IWL5000 y # Intel Wireless WiFi 5000AGN
+      HOSTAP_FIRMWARE y # Support downloading firmware images with Host AP driver
+      HOSTAP_FIRMWARE_NVRAM y
+
+      # Some settings to make sure that fbcondecor works - in particular,
+      # disable tileblitting and the drivers that need it.
+
+      # Enable various FB devices.
+      FB y
+      FB_EFI y
+      FB_NVIDIA_I2C y # Enable DDC Support
+      FB_RIVA_I2C y
+      FB_ATY_CT y # Mach64 CT/VT/GT/LT (incl. 3D RAGE) support
+      FB_ATY_GX y # Mach64 GX support
+      FB_SAVAGE_I2C y
+      FB_SAVAGE_ACCEL y
+      FB_SIS_300 y
+      FB_SIS_315 y
+      FB_3DFX_ACCEL y
+      FB_GEODE y
+
+      # Video configuration
+      # The intel drivers already require KMS
+      DRM_I915_KMS y
+
+      # Sound.
+      SND_AC97_POWER_SAVE y # AC97 Power-Saving Mode
+      SND_HDA_INPUT_BEEP y # Support digital beep via input layer
+      SND_USB_CAIAQ_INPUT y
+      PSS_MIXER y # Enable PSS mixer (Beethoven ADSP-16 and other compatible)
+
+      # USB serial devices.
+      USB_SERIAL_GENERIC y # USB Generic Serial Driver
+      USB_SERIAL_KEYSPAN_MPR y # include firmware for various USB serial devices
+      USB_SERIAL_KEYSPAN_USA28 y
+      USB_SERIAL_KEYSPAN_USA28X y
+      USB_SERIAL_KEYSPAN_USA28XA y
+      USB_SERIAL_KEYSPAN_USA28XB y
+      USB_SERIAL_KEYSPAN_USA19 y
+      USB_SERIAL_KEYSPAN_USA18X y
+      USB_SERIAL_KEYSPAN_USA19W y
+      USB_SERIAL_KEYSPAN_USA19QW y
+      USB_SERIAL_KEYSPAN_USA19QI y
+      USB_SERIAL_KEYSPAN_USA49W y
+      USB_SERIAL_KEYSPAN_USA49WLC y
+
+      # Filesystem options - in particular, enable extended attributes and
+      # ACLs for all filesystems that support them.
+      EXT2_FS_XATTR y # Ext2 extended attributes
+      EXT2_FS_POSIX_ACL y # Ext2 POSIX Access Control Lists
+      EXT2_FS_SECURITY y # Ext2 Security Labels
+      EXT2_FS_XIP y # Ext2 execute in place support
+      EXT4_FS_POSIX_ACL y
+      EXT4_FS_SECURITY y
+      REISERFS_FS_XATTR y
+      REISERFS_FS_POSIX_ACL y
+      REISERFS_FS_SECURITY y
+      JFS_POSIX_ACL y
+      JFS_SECURITY y
+      XFS_QUOTA y
+      XFS_POSIX_ACL y
+      XFS_RT y # XFS Realtime subvolume support
+      OCFS2_DEBUG_MASKLOG n
+      BTRFS_FS_POSIX_ACL y
+      UBIFS_FS_XATTR y
+      UBIFS_FS_ADVANCED_COMPR y
+      NFSD_V2_ACL y
+      NFSD_V3 y
+      NFSD_V3_ACL y
+      NFSD_V4 y
+      CIFS_XATTR y
+      CIFS_POSIX y
+
+      # Security related features.
+      STRICT_DEVMEM y # Filter access to /dev/mem
+      SECURITY_SELINUX_BOOTPARAM_VALUE 0 # disable SELinux by default
+
+      # Misc. options.
+      8139TOO_8129 y
+      8139TOO_PIO n # PIO is slower
+      AIC79XX_DEBUG_ENABLE n
+      AIC7XXX_DEBUG_ENABLE n
+      AIC94XX_DEBUG n
+      B43_PCMCIA y
+      BLK_DEV_BSG n
+      BLK_DEV_CMD640_ENHANCED y # CMD640 enhanced support
+      BLK_DEV_IDEACPI y # IDE ACPI support
+      BLK_DEV_INTEGRITY y
+      BSD_PROCESS_ACCT_V3 y
+      BT_HCIUART_BCSP y
+      BT_HCIUART_H4 y # UART (H4) protocol support
+      BT_HCIUART_LL y
+      BT_RFCOMM_TTY y # RFCOMM TTY support
+      CPU_FREQ_DEBUG n
+      CRASH_DUMP n
+      DMAR? n # experimental
+      DVB_DYNAMIC_MINORS y # we use udev
+      FUSION y # Fusion MPT device support
+      IDE_GD_ATAPI y # ATAPI floppy support
+      IRDA_ULTRA y # Ultra (connectionless) protocol
+      JOYSTICK_IFORCE_232 y # I-Force Serial joysticks and wheels
+      JOYSTICK_IFORCE_USB y # I-Force USB joysticks and wheels
+      JOYSTICK_XPAD_FF y # X-Box gamepad rumble support
+      JOYSTICK_XPAD_LEDS y # LED Support for Xbox360 controller 'BigX' LED
+      KALLSYMS_EXTRA_PASS n
+      LDM_PARTITION y # Windows Logical Disk Manager (Dynamic Disk) support
+      LEDS_TRIGGER_IDE_DISK y # LED IDE Disk Trigger
+      LOGIRUMBLEPAD2_FF y # Logitech Rumblepad 2 force feedback
+      LOGO n # not needed
+      MEDIA_ATTACH y
+      MEGARAID_NEWGEN y
+      MICROCODE_AMD y
+      MODVERSIONS y
+      MOUSE_PS2_ELANTECH y # Elantech PS/2 protocol extension
+      MTRR_SANITIZER y
+      NET_FC y # Fibre Channel driver support
+      PPP_MULTILINK y # PPP multilink support
+      REGULATOR y # Voltage and Current Regulator Support
+      SCSI_LOGGING y # SCSI logging facility
+      SERIAL_8250 y # 8250/16550 and compatible serial support
+      SLIP_COMPRESSED y # CSLIP compressed headers
+      SLIP_SMART y
+      THERMAL_HWMON y # Hardware monitoring support
+      USB_DEBUG n
+      USB_EHCI_ROOT_HUB_TT y # Root Hub Transaction Translators
+      X86_CHECK_BIOS_CORRUPTION y
+      X86_MCE y
+
+      ${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
+      ${extraConfig}
+    '';
+in
+
+import ./generic.nix (
+
+  rec {
+    version = "qi_lb60-2.6.35-openwrt-22513";
+  
+    src = fetchurl {
+      url = "mirror://kernel/linux/kernel/v2.6/linux-2.6.35.tar.bz2";
+      sha256 = "1kxz87nwksx4hvq1i45i9w1zq1fb09rvf8i6jin3cbh36v1y5chq";
+    };
+
+    srcPatch = fetchsvn {
+      url = "svn://svn.openwrt.org/openwrt/trunk/target/linux";
+      rev = 22530;
+      sha256 = "1j5ls7dg0pvdxh6isczmq4r0lkwhz1c1s46mvdkcjsm3qq633fpc";
+    };
+
+    preConfigure = ''
+      cp -R ${srcPatch}/generic/files/* .
+      chmod +w -R *
+      GLOBIGNORE='.:..:*preinit_as_init*'
+      for a in ${srcPatch}/generic/patches-2.6.35/* ${srcPatch}/xburst/patches-2.6.35/* ; do
+        echo applying patch $a
+        patch -p1 < $a
+      done
+      unset GLOBIGNORE
+      cat ${srcPatch}/generic/config-2.6.35 ${srcPatch}/xburst/config-2.6.35 \
+          ${srcPatch}/xburst/qi_lb60/config-2.6.35 > arch/mips/configs/qi_lb60_defconfig
+    '';
+
+    postInstall = ''
+      set -x
+      gzip -9 -c $out/vmlinux.bin > $out/vmlinux.bin.gz
+      KERNEL_ENTRY="0x`$crossConfig-nm $out/vmlinux 2>/dev/null |
+        grep " kernel_entry" | cut -f1 -d ' '`"
+      mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \
+          -e $KERNEL_ENTRY -n "MIPS Nix Linux-2.6.35" \
+          -d $out/vmlinux.bin.gz $out/uImage
+      set +x
+    '';
+
+    config = configWithPlatform stdenv.platform;
+    configCross = configWithPlatform stdenv.cross.platform;
+
+    features.iwlwifi = true;
+  }
+
+  // removeAttrs args ["extraConfig"]
+)
diff --git a/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.36.nix b/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.36.nix
new file mode 100644
index 00000000000..ed5eabf025b
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/linux-nanonote-jz-2.6.36.nix
@@ -0,0 +1,241 @@
+args @ { stdenv, fetchurl, fetchsvn, userModeLinux ? false, extraConfig ? ""
+, ... }:
+
+let
+  configWithPlatform = kernelPlatform :
+    ''
+      # Don't include any debug features.
+      DEBUG_KERNEL n
+
+      # Support drivers that need external firmware.
+      STANDALONE n
+
+      # Make /proc/config.gz available.
+      IKCONFIG_PROC y
+
+      # Optimize with -O2, not -Os.
+      CC_OPTIMIZE_FOR_SIZE n
+
+      # Enable the kernel's built-in memory tester.
+      MEMTEST y
+
+      # Include the CFQ I/O scheduler in the kernel, rather than as a
+      # module, so that the initrd gets a good I/O scheduler.
+      IOSCHED_CFQ y
+
+      # Disable some expensive (?) features.
+      FTRACE n
+      KPROBES n
+      NUMA? n
+      PM_TRACE_RTC n
+
+      # Enable various subsystems.
+      ACCESSIBILITY y # Accessibility support
+      AUXDISPLAY y # Auxiliary Display support
+      DONGLE y # Serial dongle support
+      HIPPI y
+      MTD_COMPLEX_MAPPINGS y # needed for many devices
+      NET_POCKET y # enable pocket and portable adapters
+      SCSI_LOWLEVEL y # enable lots of SCSI devices
+      SCSI_LOWLEVEL_PCMCIA y
+      SPI y # needed for many devices
+      SPI_MASTER y
+      WAN y
+
+      # Networking options.
+      IP_PNP n
+      IPV6_PRIVACY y
+      NETFILTER_ADVANCED y
+      IP_VS_PROTO_TCP y
+      IP_VS_PROTO_UDP y
+      IP_VS_PROTO_ESP y
+      IP_VS_PROTO_AH y
+      IP_DCCP_CCID3 n # experimental
+      CLS_U32_PERF y
+      CLS_U32_MARK y
+
+      # Wireless networking.
+      IPW2100_MONITOR y # support promiscuous mode
+      IPW2200_MONITOR y # support promiscuous mode
+      IWL4965 y # Intel Wireless WiFi 4965AGN
+      IWL5000 y # Intel Wireless WiFi 5000AGN
+      HOSTAP_FIRMWARE y # Support downloading firmware images with Host AP driver
+      HOSTAP_FIRMWARE_NVRAM y
+
+      # Some settings to make sure that fbcondecor works - in particular,
+      # disable tileblitting and the drivers that need it.
+
+      # Enable various FB devices.
+      FB y
+      FB_EFI y
+      FB_NVIDIA_I2C y # Enable DDC Support
+      FB_RIVA_I2C y
+      FB_ATY_CT y # Mach64 CT/VT/GT/LT (incl. 3D RAGE) support
+      FB_ATY_GX y # Mach64 GX support
+      FB_SAVAGE_I2C y
+      FB_SAVAGE_ACCEL y
+      FB_SIS_300 y
+      FB_SIS_315 y
+      FB_3DFX_ACCEL y
+      FB_GEODE y
+
+      # Video configuration
+      # The intel drivers already require KMS
+      DRM_I915_KMS y
+
+      # Sound.
+      SND_AC97_POWER_SAVE y # AC97 Power-Saving Mode
+      SND_HDA_INPUT_BEEP y # Support digital beep via input layer
+      SND_USB_CAIAQ_INPUT y
+      PSS_MIXER y # Enable PSS mixer (Beethoven ADSP-16 and other compatible)
+
+      # USB serial devices.
+      USB_SERIAL_GENERIC y # USB Generic Serial Driver
+      USB_SERIAL_KEYSPAN_MPR y # include firmware for various USB serial devices
+      USB_SERIAL_KEYSPAN_USA28 y
+      USB_SERIAL_KEYSPAN_USA28X y
+      USB_SERIAL_KEYSPAN_USA28XA y
+      USB_SERIAL_KEYSPAN_USA28XB y
+      USB_SERIAL_KEYSPAN_USA19 y
+      USB_SERIAL_KEYSPAN_USA18X y
+      USB_SERIAL_KEYSPAN_USA19W y
+      USB_SERIAL_KEYSPAN_USA19QW y
+      USB_SERIAL_KEYSPAN_USA19QI y
+      USB_SERIAL_KEYSPAN_USA49W y
+      USB_SERIAL_KEYSPAN_USA49WLC y
+
+      # Filesystem options - in particular, enable extended attributes and
+      # ACLs for all filesystems that support them.
+      EXT2_FS_XATTR y # Ext2 extended attributes
+      EXT2_FS_POSIX_ACL y # Ext2 POSIX Access Control Lists
+      EXT2_FS_SECURITY y # Ext2 Security Labels
+      EXT2_FS_XIP y # Ext2 execute in place support
+      EXT4_FS_POSIX_ACL y
+      EXT4_FS_SECURITY y
+      REISERFS_FS_XATTR y
+      REISERFS_FS_POSIX_ACL y
+      REISERFS_FS_SECURITY y
+      JFS_POSIX_ACL y
+      JFS_SECURITY y
+      XFS_QUOTA y
+      XFS_POSIX_ACL y
+      XFS_RT y # XFS Realtime subvolume support
+      OCFS2_DEBUG_MASKLOG n
+      BTRFS_FS_POSIX_ACL y
+      UBIFS_FS_XATTR y
+      UBIFS_FS_ADVANCED_COMPR y
+      NFSD_V2_ACL y
+      NFSD_V3 y
+      NFSD_V3_ACL y
+      NFSD_V4 y
+      CIFS_XATTR y
+      CIFS_POSIX y
+
+      # Security related features.
+      STRICT_DEVMEM y # Filter access to /dev/mem
+      SECURITY_SELINUX_BOOTPARAM_VALUE 0 # disable SELinux by default
+
+      # Misc. options.
+      8139TOO_8129 y
+      8139TOO_PIO n # PIO is slower
+      AIC79XX_DEBUG_ENABLE n
+      AIC7XXX_DEBUG_ENABLE n
+      AIC94XX_DEBUG n
+      B43_PCMCIA y
+      BLK_DEV_BSG n
+      BLK_DEV_CMD640_ENHANCED y # CMD640 enhanced support
+      BLK_DEV_IDEACPI y # IDE ACPI support
+      BLK_DEV_INTEGRITY y
+      BSD_PROCESS_ACCT_V3 y
+      BT_HCIUART_BCSP y
+      BT_HCIUART_H4 y # UART (H4) protocol support
+      BT_HCIUART_LL y
+      BT_RFCOMM_TTY y # RFCOMM TTY support
+      CPU_FREQ_DEBUG n
+      CRASH_DUMP n
+      DMAR? n # experimental
+      DVB_DYNAMIC_MINORS y # we use udev
+      FUSION y # Fusion MPT device support
+      IDE_GD_ATAPI y # ATAPI floppy support
+      IRDA_ULTRA y # Ultra (connectionless) protocol
+      JOYSTICK_IFORCE_232 y # I-Force Serial joysticks and wheels
+      JOYSTICK_IFORCE_USB y # I-Force USB joysticks and wheels
+      JOYSTICK_XPAD_FF y # X-Box gamepad rumble support
+      JOYSTICK_XPAD_LEDS y # LED Support for Xbox360 controller 'BigX' LED
+      KALLSYMS_EXTRA_PASS n
+      LDM_PARTITION y # Windows Logical Disk Manager (Dynamic Disk) support
+      LEDS_TRIGGER_IDE_DISK y # LED IDE Disk Trigger
+      LOGIRUMBLEPAD2_FF y # Logitech Rumblepad 2 force feedback
+      LOGO n # not needed
+      MEDIA_ATTACH y
+      MEGARAID_NEWGEN y
+      MICROCODE_AMD y
+      MODVERSIONS y
+      MOUSE_PS2_ELANTECH y # Elantech PS/2 protocol extension
+      MTRR_SANITIZER y
+      NET_FC y # Fibre Channel driver support
+      PPP_MULTILINK y # PPP multilink support
+      REGULATOR y # Voltage and Current Regulator Support
+      SCSI_LOGGING y # SCSI logging facility
+      SERIAL_8250 y # 8250/16550 and compatible serial support
+      SLIP_COMPRESSED y # CSLIP compressed headers
+      SLIP_SMART y
+      THERMAL_HWMON y # Hardware monitoring support
+      USB_DEBUG n
+      USB_EHCI_ROOT_HUB_TT y # Root Hub Transaction Translators
+      X86_CHECK_BIOS_CORRUPTION y
+      X86_MCE y
+
+      ${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
+      ${extraConfig}
+    '';
+in
+
+import ./generic.nix (
+
+  rec {
+    version = "qi_lb60-2.6.35-openwrt-24283";
+  
+    src = fetchurl {
+      url = "mirror://kernel/linux/kernel/v2.6/linux-2.6.36.tar.bz2";
+      sha256 = "15a076d1a435a6bf8e92834eba4b390b4ec094ce06d47f89d071ca9e5788ce04";
+    };
+
+    srcPatch = fetchsvn {
+      url = "svn://svn.openwrt.org/openwrt/trunk/target/linux";
+      rev = 24283;
+      sha256 = "4e30266bbaf004acb10b5c182d0c01c7aba685956d36e76ea7c24dd55ae51c10";
+    };
+
+    preConfigure = ''
+      cp -R ${srcPatch}/generic/files/* .
+      chmod +w -R *
+      GLOBIGNORE='.:..:*preinit_as_init*'
+      for a in ${srcPatch}/generic/patches-2.6.36/* ${srcPatch}/xburst/patches-2.6.36/* ; do
+        echo applying patch $a
+        patch -p1 < $a
+      done
+      unset GLOBIGNORE
+      cat ${srcPatch}/generic/config-2.6.36 ${srcPatch}/xburst/config-2.6.36 \
+          ${srcPatch}/xburst/qi_lb60/config-2.6.36 > arch/mips/configs/qi_lb60_defconfig
+    '';
+
+    postInstall = ''
+      set -x
+      gzip -9 -c $out/vmlinux.bin > $out/vmlinux.bin.gz
+      KERNEL_ENTRY="0x`$crossConfig-nm $out/vmlinux 2>/dev/null |
+        grep " kernel_entry" | cut -f1 -d ' '`"
+      mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \
+          -e $KERNEL_ENTRY -n "MIPS Nix Linux-2.6.36" \
+          -d $out/vmlinux.bin.gz $out/uImage
+      set +x
+    '';
+
+    config = configWithPlatform stdenv.platform;
+    configCross = configWithPlatform stdenv.cross.platform;
+
+    features.iwlwifi = true;
+  }
+
+  // removeAttrs args ["extraConfig"]
+)
diff --git a/pkgs/os-specific/linux/kernel/mips_restart.patch b/pkgs/os-specific/linux/kernel/mips_restart.patch
new file mode 100644
index 00000000000..42a9b4f253c
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/mips_restart.patch
@@ -0,0 +1,12 @@
+diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
+index 9996094..ae167df 100644
+--- a/arch/mips/kernel/process.c
++++ b/arch/mips/kernel/process.c
+@@ -142,7 +142,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
+ 	childregs->regs[7] = 0;	/* Clear error flag */
+ 
+ 	childregs->regs[2] = 0;	/* Child gets zero as return value */
+-	regs->regs[2] = p->pid;
+ 
+ 	if (childregs->cp0_status & ST0_CU0) {
+ 		childregs->regs[28] = (unsigned long) ti;
diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 19c7f06b8f7..3ad48033f7a 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -186,9 +186,9 @@ in
   no_xsave =
     { name = "no-xsave";
       patch = fetchurl {
-        url = "http://cvs.fedoraproject.org/viewvc/devel/kernel/fix_xen_guest_on_old_EC2.patch?revision=1.1&view=co";
+        url = "http://kernel.ubuntu.com/git?p=rtg/ubuntu-maverick.git;a=blobdiff_plain;f=arch/x86/xen/enlighten.c;h=f7ff4c7d22954ab5eda464320241300bd5a32ee5;hp=1ea06f842a921557e958110e22941d53a2822f3c;hb=1a30f99;hpb=8f2ff69dce18ed856a8d1b93176f768b47eeed86";
         name = "no-xsave.patch";
-        sha256 = "02f51f9b636b105c81a3ed62145abdc0ecb043b8114eb10257854577f617f894";
+        sha256 = "18732s3vmav5rpg6zqpiw2i0ll83pcc4gw266h6545pmbh9p7hky";
       };
       features.noXsave = true;
     };
@@ -198,6 +198,16 @@ in
       patch = ./dell-rfkill.patch;
     };
 
+  sheevaplug_modules_2_6_35 =
+    { name = "sheevaplug_modules-2.6.35";
+      patch = ./sheevaplug_modules-2.6.35.patch;
+    };
+
+  mips_restart_2_6_36 =
+    { name = "mips_restart_2_6_36";
+      patch = ./mips_restart.patch;
+    };
+
   guruplug_defconfig =
     { # Default configuration for the GuruPlug.  From
       # <http://www.openplug.org/plugwiki/images/c/c6/Guruplug-patchset-2.6.33.2.tar.bz2>.
diff --git a/pkgs/os-specific/linux/kernel/sheevaplug_modules-2.6.35.patch b/pkgs/os-specific/linux/kernel/sheevaplug_modules-2.6.35.patch
new file mode 100644
index 00000000000..5b62fb90670
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/sheevaplug_modules-2.6.35.patch
@@ -0,0 +1,63 @@
+http://www.mail-archive.com/armedslack@lists.armedslack.org/msg00212.html
+
+From d0679c730395d0bde9a46939e7ba255b4ba7dd7c Mon Sep 17 00:00:00 2001
+From: Andi Kleen <andi@firstfloor.org>
+Date: Tue, 2 Feb 2010 14:40:02 -0800
+Subject: [PATCH] kbuild: move -fno-dwarf2-cfi-asm to powerpc only
+
+Better dwarf2 unwind information is a good thing, it allows better
+debugging with kgdb and crash and helps systemtap.
+
+Commit 003086497f07f7f1e67c0c295e261740f822b377 ("Build with
+-fno-dwarf2-cfi-asm") disabled some CFI information globally to work
+around a module loader bug on powerpc.
+
+But this disables the better unwind tables for all architectures, not just
+powerpc.  Move the workaround to powerpc and also add a suitable comment
+that's it really a workaround.
+
+This improves dwarf2 unwind tables on x86 at least.
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Cc: Kyle McMartin <kyle@mcmartin.ca>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Michal Marek <mmarek@suse.cz>
+---
+ Makefile              |    3 ---
+ arch/powerpc/Makefile |    5 +++++
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 03053c6..2e74a68 100644
+--- a/Makefile
++++ b/Makefile
+@@ -579,6 +579,9 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
+ # disable invalid "can't wrap" optimizations for signed / pointers
+ KBUILD_CFLAGS	+= $(call cc-option,-fno-strict-overflow)
+ 
++# revert to pre-gcc-4.4 behaviour of .eh_frame
++KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
++
+ # conserve stack if available
+ KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
+ 
+diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
+index 1a54a3b..42dcd3f 100644
+--- a/arch/powerpc/Makefile
++++ b/arch/powerpc/Makefile
+@@ -112,11 +112,6 @@ KBUILD_CFLAGS += $(call cc-option,-mspe=no)
+ # kernel considerably.
+ KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
+ 
+-# FIXME: the module load should be taught about the additional relocs
+-# generated by this.
+-# revert to pre-gcc-4.4 behaviour of .eh_frame
+-KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
+-
+ # Never use string load/store instructions as they are
+ # often slow when they are implemented at all
+ KBUILD_CFLAGS		+= -mno-string
+-- 
+1.7.3.1
+
diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix
index c3967f4f1ab..b8cd2b18bc7 100644
--- a/pkgs/os-specific/linux/klibc/default.nix
+++ b/pkgs/os-specific/linux/klibc/default.nix
@@ -1,26 +1,58 @@
-{stdenv, fetchurl, perl, bison, mktemp, linuxHeaders}:
+{stdenv, fetchurl, perl, bison, mktemp, linuxHeaders, linuxHeadersCross}:
 
 assert stdenv.isLinux;
 
-let version = "1.5.15"; in
+let
+  version = "1.5.20";
+  baseMakeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"];
+in
 
 stdenv.mkDerivation {
   name = "klibc-${version}";
 
   src = fetchurl {
-    url = "mirror://kernel/linux/libs/klibc/klibc-${version}.tar.bz2";
-    sha256 = "1x401wmjca6zkyikf9xz45b3wb1hnj0m2s9in1sg6xdhi3pk8lwb";
+    url = "mirror://kernel/linux/libs/klibc/1.5/klibc-${version}.tar.bz2";
+    sha256 = "07683dn18r3k35d6pp0sn88pqcx7dldqx3m6f2gz45i1j094qp7m";
   };
+
+  patches = [ ./make382.patch ];
+
+  # Trick to make this build on nix. It expects to have the kernel sources
+  # instead of only the linux kernel headers.
+  # So it cannot run the 'make headers_install' it wants to run.
+  # We don't install the headers, so klibc will not be useful as libc, but
+  # usually in nixpkgs we only use the userspace tools comming with klibc.
+  prePatch = ''
+    sed -i -e /headers_install/d scripts/Kbuild.install
+  '';
   
-  makeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"];
+  makeFlags = baseMakeFlags;
+
+  inherit linuxHeaders;
+
+  crossAttrs = {
+    makeFlags = baseMakeFlags ++ [ "CROSS_COMPILE=${stdenv.cross.config}-"
+        "KLIBCARCH=${stdenv.cross.arch}" ];
+
+    patchPhase = ''
+      sed -i 's/-fno-pic -mno-abicalls/& -mabi=32/' usr/klibc/arch/mips/MCONFIG
+      sed -i /KLIBCKERNELSRC/d scripts/Kbuild.install
+      # Wrong check for __mips64 in klibc
+      sed -i s/__mips64__/__mips64/ usr/include/fcntl.h
+    '';
+
+    linuxHeaders = linuxHeadersCross;
+  };
   
+  # The AEABI option concerns only arm systems, and does not affect the build for
+  # other systems.
   preBuild = ''
     sed -i /CONFIG_AEABI/d defconfig
     echo "CONFIG_AEABI=y" >> defconfig
     makeFlags=$(eval "echo $makeFlags")
 
     mkdir linux
-    cp -prsd ${linuxHeaders}/include linux/
+    cp -prsd $linuxHeaders/include linux/
     chmod -R u+w linux/include/
   ''; # */
   
@@ -32,5 +64,5 @@ stdenv.mkDerivation {
     cp usr/dash/sh $dir/
   '';
   
-  buildInputs = [perl bison mktemp];
+  buildNativeInputs = [ perl bison mktemp ];
 }
diff --git a/pkgs/os-specific/linux/klibc/make382.patch b/pkgs/os-specific/linux/klibc/make382.patch
new file mode 100644
index 00000000000..e9e9aba4e79
--- /dev/null
+++ b/pkgs/os-specific/linux/klibc/make382.patch
@@ -0,0 +1,35 @@
+To avoid an endless loop with gnumake 3.82
+http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg228690.html
+
+Index: packages/klibc/klibc-make.patch
+--- klibc-1.5.19/scripts/Kbuild.include.orig   2010-08-19 09:39:45.986816591 
+0200
++++ klibc-1.5.19/scripts/Kbuild.include        2010-08-19 09:49:15.010816591 
+0200
+@@ -127,7 +127,7 @@
+ # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
+ # note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
+ #
+-if_changed = $(if $(strip $(filter-out $(PHONY),$?)          \
++if_changed = $(if $(strip $(filter-out $(PHONY) FORCE,$?)          \
+ 		$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
+ 	@set -e; \
+ 	$(echo-cmd) $(cmd_$(1)); \
+@@ -135,7 +135,7 @@
+ 
+ # execute the command and also postprocess generated .d dependencies
+ # file
+-if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?)  \
++if_changed_dep = $(if $(strip $(filter-out $(PHONY) FORCE,$?)  \
+ 		$(filter-out FORCE $(wildcard $^),$^)    \
+ 	$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),     \
+ 	@set -e; \
+@@ -147,7 +147,7 @@
+ # Usage: $(call if_changed_rule,foo)
+ # will check if $(cmd_foo) changed, or any of the prequisites changed,
+ # and if so will execute $(rule_foo)
+-if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?)            \
++if_changed_rule = $(if $(strip $(filter-out $(PHONY) FORCE,$?)            \
+ 			$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
+ 			@set -e; \
+ 			$(rule_$(1)))
diff --git a/pkgs/os-specific/linux/libcap/default.nix b/pkgs/os-specific/linux/libcap/default.nix
index 46f40167a7e..d8cb393ac38 100644
--- a/pkgs/os-specific/linux/libcap/default.nix
+++ b/pkgs/os-specific/linux/libcap/default.nix
@@ -1,18 +1,29 @@
-{stdenv, fetchurl, attr}:
+{stdenv, fetchurl, attr, perl}:
 
 assert stdenv.isLinux;
 
-stdenv.mkDerivation {
-  name = "libcap-2.09";
+stdenv.mkDerivation rec {
+  name = "libcap-${version}";
+  version = "2.19";
   
   src = fetchurl {
-    url = mirror://kernel/linux/libs/security/linux-privs/kernel-2.6/libcap-2.09.tar.bz2;
-    sha256 = "0sq15y8yfm7knf6jhqcycb9wz52n3r1sriii66xk0djvd4hw69jr";
+    url = "mirror://kernel/linux/libs/security/linux-privs/kernel-2.6/${name}.tar.gz";
+    sha256 = "0fdsz9j741npvh222f8p1y6l516z9liibiwdpdr3a4zg53m0pw45";
   };
   
-  buildInputs = [attr];
+  buildNativeInputs = [perl];
+  propagatedBuildInputs = [attr];
 
-  preBuild = ''
-    makeFlagsArray=(LIBDIR=$out/lib INCDIR=$out/include SBINDIR=$out/sbin MANDIR=$out/man PAM_CAP=no)
-  '';
+  preConfigure = "cd libcap";
+
+  makeFlags = "lib=lib prefix=$(out)";
+
+  passthru = {
+    postinst = n : ''
+      ensureDir $out/share/doc/${n}
+      cp ../License $out/share/doc/${n}/License
+    '';
+  };
+
+  postInstall = passthru.postinst name;
 }
diff --git a/pkgs/os-specific/linux/libcap/man.nix b/pkgs/os-specific/linux/libcap/man.nix
new file mode 100644
index 00000000000..9aac3c4e1f5
--- /dev/null
+++ b/pkgs/os-specific/linux/libcap/man.nix
@@ -0,0 +1,15 @@
+{stdenv, libcap}:
+
+assert stdenv.isLinux;
+
+stdenv.mkDerivation rec {
+  name = "libcap-docs-${libcap.version}";
+
+  inherit (libcap) src;
+
+  makeFlags = "MANDIR=$(out)/share/man";
+
+  preConfigure = "cd doc";
+
+  postInstall = libcap.postinst name;
+}
diff --git a/pkgs/os-specific/linux/libcap/pam.nix b/pkgs/os-specific/linux/libcap/pam.nix
new file mode 100644
index 00000000000..4cefa825c8a
--- /dev/null
+++ b/pkgs/os-specific/linux/libcap/pam.nix
@@ -0,0 +1,17 @@
+{stdenv, pam, libcap}:
+
+assert stdenv.isLinux;
+
+stdenv.mkDerivation rec {
+  name = "cap_pam.so-${libcap.version}";
+
+  inherit (libcap) src;
+
+  buildInputs = [ libcap pam ];
+
+  preConfigure = "cd pam_cap";
+
+  makeFlags = "${libcap.makeFlags} PAM_CAP=yes";
+
+  postInstall = libcap.postinst name;
+}
diff --git a/pkgs/os-specific/linux/libcap/progs.nix b/pkgs/os-specific/linux/libcap/progs.nix
new file mode 100644
index 00000000000..1b38848e77e
--- /dev/null
+++ b/pkgs/os-specific/linux/libcap/progs.nix
@@ -0,0 +1,15 @@
+{stdenv, libcap}:
+
+assert stdenv.isLinux;
+
+stdenv.mkDerivation rec {
+  name = "libcap-progs-${libcap.version}";
+
+  inherit (libcap) src makeFlags;
+
+  buildInputs = [ libcap ];
+
+  preConfigure = "cd progs";
+
+  postInstall = libcap.postinst name;
+}
diff --git a/pkgs/os-specific/linux/lvm2/default.nix b/pkgs/os-specific/linux/lvm2/default.nix
index cffb7e8353d..9a2dc2d28ac 100644
--- a/pkgs/os-specific/linux/lvm2/default.nix
+++ b/pkgs/os-specific/linux/lvm2/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
   
   src = fetchurl {
     url = "ftp://sources.redhat.com/pub/lvm2/old/LVM2.${v}.tgz";
-    sha256 =  "2a4157b91b7ad5ea84359e8548b64947611beea01862e010be71f54b649e7ad1";
+    sha256 = "1lbskrj4pxbipq8f0qhql3p1nqa796v4i1cy6n2fmmbs3fwmfh9a";
   };
   
   configureFlags = "--disable-readline --enable-udev_rules --enable-udev_sync";
diff --git a/pkgs/os-specific/linux/mingetty/default.nix b/pkgs/os-specific/linux/mingetty/default.nix
index fc3c50e1986..b27baa5480b 100644
--- a/pkgs/os-specific/linux/mingetty/default.nix
+++ b/pkgs/os-specific/linux/mingetty/default.nix
@@ -8,6 +8,10 @@ stdenv.mkDerivation {
     sha256 = "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g";
   };
 
+  crossAttrs = {
+    makeFlags = "CC=${stdenv.cross.config}-gcc";
+  };
+
   preInstall = ''
     ensureDir $out/sbin $out/share/man/man8
     makeFlagsArray=(SBINDIR=$out/sbin MANDIR=$out/share/man/man8)
diff --git a/pkgs/os-specific/linux/mountall/default.nix b/pkgs/os-specific/linux/mountall/default.nix
index 360a7d80c12..134f7577c96 100644
--- a/pkgs/os-specific/linux/mountall/default.nix
+++ b/pkgs/os-specific/linux/mountall/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, libnih, dbus, udev, autoconf, automake, libtool }:
+{ stdenv, fetchurl, pkgconfig, libnih, dbus, udev, autoconf, automake, libtool, gettext }:
    
 stdenv.mkDerivation {
   name = "mountall-2.15";
@@ -10,9 +10,9 @@ stdenv.mkDerivation {
 
   patches = [ ./no-plymouth.patch ];
 
-  preConfigure = "autoreconf";
+  preConfigure = "rm -R aclocal.m4; gettextize -f; autoreconf -vfi";
 
-  buildInputs = [ pkgconfig libnih dbus.libs udev autoconf automake libtool ];
+  buildInputs = [ pkgconfig libnih dbus.libs udev autoconf automake libtool gettext ];
 
   meta = {
     homepage = https://launchpad.net/ubuntu/+source/mountall;
diff --git a/pkgs/os-specific/linux/nfs-utils/default.nix b/pkgs/os-specific/linux/nfs-utils/default.nix
index 996965b9580..cf05d0fbaed 100644
--- a/pkgs/os-specific/linux/nfs-utils/default.nix
+++ b/pkgs/os-specific/linux/nfs-utils/default.nix
@@ -15,7 +15,8 @@ stdenv.mkDerivation rec {
   configureFlags =
     [ "--disable-gss" "--disable-nfsv4" "--disable-nfsv41" "--disable-tirpc"
       "--with-statedir=/var/lib/nfs"
-    ];
+    ]
+    ++ stdenv.lib.optional (stdenv ? glibc) "--with-rpcgen=${stdenv.glibc}/bin/rpcgen";
 
   patchPhase =
     ''
@@ -33,7 +34,8 @@ stdenv.mkDerivation rec {
       installFlags="statedir=$TMPDIR" # hack to make `make install' work
     '';
 
-  doCheck = true;
+  # One test fails on mips.
+  doCheck = if stdenv.isMips then false else true;
 
   meta = {
     description = "Linux user-space NFS utilities";
diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix
index f27c6af31bb..692643505e1 100644
--- a/pkgs/os-specific/linux/pam/default.nix
+++ b/pkgs/os-specific/linux/pam/default.nix
@@ -9,7 +9,9 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ flex cracklib ]
-    ++ stdenv.lib.optional (stdenv.system != "armv5tel-linux") libxcrypt;
+    ++ stdenv.lib.optional
+      (stdenv.system != "armv5tel-linux" && stdenv.system != "mips64-linux")
+      libxcrypt;
 
   postInstall = ''
     mv -v $out/sbin/unix_chkpwd{,.orig}
diff --git a/pkgs/os-specific/linux/procps/default.nix b/pkgs/os-specific/linux/procps/default.nix
index 4a74218aa36..9270e4c6c0e 100644
--- a/pkgs/os-specific/linux/procps/default.nix
+++ b/pkgs/os-specific/linux/procps/default.nix
@@ -7,6 +7,6 @@ stdenv.mkDerivation {
     url = http://procps.sourceforge.net/procps-3.2.8.tar.gz;
     sha256 = "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i";
   };
-  patches = [./makefile.patch ./procps-build.patch];
+  patches = [./makefile.patch ./procps-build.patch ./gnumake3.82.patch];
   buildInputs = [ncurses];
 }
diff --git a/pkgs/os-specific/linux/procps/gnumake3.82.patch b/pkgs/os-specific/linux/procps/gnumake3.82.patch
new file mode 100644
index 00000000000..2b1f28d4bce
--- /dev/null
+++ b/pkgs/os-specific/linux/procps/gnumake3.82.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 09fb3ed..59eba16 100644
+--- a/Makefile
++++ b/Makefile
+@@ -174,7 +174,7 @@ INSTALL := $(BINFILES) $(MANFILES)
+ # want this rule first, use := on ALL, and ALL not filled in yet
+ all: do_all
+ 
+--include */module.mk
++-include proc/module.mk ps/module.mk
+ 
+ do_all:    $(ALL)
+ 
diff --git a/pkgs/os-specific/linux/sysvinit/default.nix b/pkgs/os-specific/linux/sysvinit/default.nix
index 8315ee4835d..c088d3c5b1b 100644
--- a/pkgs/os-specific/linux/sysvinit/default.nix
+++ b/pkgs/os-specific/linux/sysvinit/default.nix
@@ -6,14 +6,21 @@ stdenv.mkDerivation {
   name = (if withoutInitTools then "sysvtools" else "sysvinit") + "-" + version;
   
   src = fetchurl {
-    url = "http://www.very-clever.com/download/nongnu/sysvinit/sysvinit-${version}.tar.bz2";
+    url = "mirror://savannah/sysvinit/sysvinit-${version}.tar.bz2";
     sha256 = "068mvzaz808a673zigyaqb63xc8bndh2klk16zi5c83rw70wifv0";
   };
   
-  patches = [ ./sysvinit-2.85-exec.patch ];
+  prePatch = ''
+    # Patch some minimal hard references, so halt/shutdown work
+    sed -i -e "s,/sbin/,$out/sbin/," src/halt.c src/init.c src/paths.h
+  '';
 
   makeFlags = "SULOGINLIBS=-lcrypt ROOT=$(out) MANDIR=/share/man";
 
+  crossAttrs = {
+    makeFlags = "SULOGINLIBS=-lcrypt ROOT=$(out) MANDIR=/share/man CC=${stdenv.cross.config}-gcc";
+  };
+
   preInstall =
     ''
       substituteInPlace src/Makefile --replace /usr /
diff --git a/pkgs/os-specific/linux/sysvinit/sysvinit-2.85-exec.patch b/pkgs/os-specific/linux/sysvinit/sysvinit-2.85-exec.patch
deleted file mode 100644
index ef3d0f66b2f..00000000000
--- a/pkgs/os-specific/linux/sysvinit/sysvinit-2.85-exec.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff -ruN sysvinit-2.85/src/halt.c sysvinit-2.85.new/src/halt.c
---- sysvinit-2.85/src/halt.c	2001-11-27 13:12:03.000000000 +0100
-+++ sysvinit-2.85.new/src/halt.c	2005-10-18 20:09:47.000000000 +0200
-@@ -53,6 +53,10 @@
- #define KERNEL_MONITOR	1 /* If halt() puts you into the kernel monitor. */
- #define RUNLVL_PICKY	0 /* Be picky about the runlevel */
- 
-+#ifndef EXEC_PATH
-+  #define EXEC_PATH "/sbin/shutdown"
-+#endif
-+
- extern int ifdown(void);
- extern int hddown(void);
- extern void write_wtmp(char *user, char *id, int pid, int type, char *line);
-@@ -139,7 +143,7 @@
- 	args[i++] = "now";
- 	args[i++] = NULL;
- 
--	execv("/sbin/shutdown", args);
-+	execv(EXEC_PATH, args);
- 	execv("/etc/shutdown", args);
- 	execv("/bin/shutdown", args);
diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix
index 83de2ae38ef..ce95dbaba92 100644
--- a/pkgs/os-specific/linux/uclibc/default.nix
+++ b/pkgs/os-specific/linux/uclibc/default.nix
@@ -1,48 +1,72 @@
-{stdenv, fetchurl, linuxHeaders, cross ? null, gccCross ? null}:
+{stdenv, fetchurl, linuxHeaders, libiconv, cross ? null, gccCross ? null,
+extraConfig ? ""}:
 
 assert stdenv.isLinux;
 assert cross != null -> gccCross != null;
 
 let
-    enableArmEABI = (cross == null && stdenv.platform.kernelArch == "arm")
-      || (cross != null && cross.arch == "arm");
-
-    configArmEABI = if enableArmEABI then
-        ''-e 's/.*CONFIG_ARM_OABI.*//' \
-        -e 's/.*CONFIG_ARM_EABI.*/CONFIG_ARM_EABI=y/' '' else "";
-
-    enableBigEndian = (cross != null && cross.bigEndian);
-    
-    configBigEndian = if enableBigEndian then ""
-      else
-        ''-e 's/.*ARCH_BIG_ENDIAN.*/#ARCH_BIG_ENDIAN=y/' \
-        -e 's/.*ARCH_WANTS_BIG_ENDIAN.*/#ARCH_WANTS_BIG_ENDIAN=y/' \
-        -e 's/.*ARCH_WANTS_LITTLE_ENDIAN.*/ARCH_WANTS_LITTLE_ENDIAN=y/' '';
-
-    archMakeFlag = if (cross != null) then "ARCH=${cross.arch}" else "";
-    crossMakeFlag = if (cross != null) then "CROSS=${cross.config}-" else "";
+  configParser = ''
+    function parseconfig {
+        set -x
+        while read LINE; do
+            NAME=`echo "$LINE" | cut -d \  -f 1`
+            OPTION=`echo "$LINE" | cut -d \  -f 2`
+
+            if test -z "$NAME"; then
+                continue
+            fi
+
+            if test "$NAME" == "CLEAR"; then
+                echo "parseconfig: CLEAR"
+                echo > .config
+            fi
+
+            echo "parseconfig: removing $NAME"
+            sed -i /^$NAME=/d .config
+
+            if test "$OPTION" != n; then
+                echo "parseconfig: setting $NAME=$OPTION"
+                echo "$NAME=$OPTION" >> .config
+            fi
+        done
+        set +x
+    }
+  '';
+
+  archMakeFlag = if (cross != null) then "ARCH=${cross.arch}" else "";
+  crossMakeFlag = if (cross != null) then "CROSS=${cross.config}-" else "";
+
+  nixConfig = ''
+    RUNTIME_PREFIX "/"
+    DEVEL_PREFIX "/"
+    UCLIBC_HAS_WCHAR y
+    UCLIBC_HAS_FTW y
+    UCLIBC_HAS_RPC y
+    DO_C99_MATH y
+    UCLIBC_HAS_PROGRAM_INVOCATION_NAME y
+    KERNEL_HEADERS "${linuxHeaders}/include"
+  '';
+
 in
 stdenv.mkDerivation {
-  name = "uclibc-0.9.30.3" + stdenv.lib.optionalString (cross != null)
+  name = "uclibc-0.9.31" + stdenv.lib.optionalString (cross != null)
     ("-" + cross.config);
 
   src = fetchurl {
-    url = http://www.uclibc.org/downloads/uClibc-0.9.30.3.tar.bz2;
-    sha256 = "0f1fpdwampbw7pf79i64ipj0azk4kbc9wl81ynlp19p92k4klz0h";
+    url = http://www.uclibc.org/downloads/uClibc-0.9.31.tar.bz2;
+    sha256 = "1yk328fnz0abgh2vm2r68y65ckfkx97rdp8hbg4xvmx5s94kblw0";
   };
 
+  # 'ftw' needed to build acl, a coreutils dependency
   configurePhase = ''
     make defconfig ${archMakeFlag}
-    sed -e s@/usr/include@${linuxHeaders}/include@ \
-      -e 's@^RUNTIME_PREFIX.*@RUNTIME_PREFIX="/"@' \
-      -e 's@^DEVEL_PREFIX.*@DEVEL_PREFIX="/"@' \
-      -e 's@.*UCLIBC_HAS_WCHAR.*@UCLIBC_HAS_WCHAR=y@' \
-      -e 's@.*UCLIBC_HAS_RPC.*@UCLIBC_HAS_RPC=y@' \
-      -e 's@.*DO_C99_MATH.*@DO_C99_MATH=y@' \
-      -e 's@.*UCLIBC_HAS_PROGRAM_INVOCATION_NAME.*@UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y@' \
-      ${configArmEABI} \
-      ${configBigEndian} \
-      -i .config
+    ${configParser}
+    cat << EOF | parseconfig
+    ${nixConfig}
+    ${extraConfig}
+    ${if cross != null then stdenv.lib.attrByPath [ "uclibc" "extraConfig" ] "" cross else ""}
+    $extraCrossConfig
+    EOF
     make oldconfig
   '';
 
@@ -59,6 +83,11 @@ stdenv.mkDerivation {
     (cd $out/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .)
     sed -i s@/lib/@$out/lib/@g $out/lib/libc.so
   '';
+
+  passthru = {
+    # Derivations may check for the existance of this attribute, to know what to link to.
+    inherit libiconv;
+  };
   
   meta = {
     homepage = http://www.uclibc.org/;
diff --git a/pkgs/os-specific/linux/util-linux-ng/default.nix b/pkgs/os-specific/linux/util-linux-ng/default.nix
index ca21deb6489..2ae172c6c19 100644
--- a/pkgs/os-specific/linux/util-linux-ng/default.nix
+++ b/pkgs/os-specific/linux/util-linux-ng/default.nix
@@ -1,28 +1,23 @@
 { stdenv, fetchurl, ncurses ? null }:
 
 stdenv.mkDerivation rec {
-  name = "util-linux-ng-2.17.2";
+  name = "util-linux-ng-2.18";
 
   src = fetchurl {
-    url = "mirror://kernel/linux/utils/util-linux-ng/v2.17/${name}.tar.bz2";
-    sha256 = "13qifk3i1x59q45fpdz8qnnm7vrhd2zshy5295vhpcjsd8dq1bn9";
+    url = "mirror://kernel/linux/utils/util-linux-ng/v2.18/${name}.tar.bz2";
+    sha256 = "1k1in1ba9kvh0kplri9765wh0yk68qrkk1a55dqsm21qfryc1idq";
   };
 
+  # !!! It would be better to obtain the path to the mount helpers
+  # (/sbin/mount.*) through an environment variable, but that's
+  # somewhat risky because we have to consider that mount can setuid
+  # root...
   configureFlags = ''
     --disable-use-tty-group
     --enable-write
+    --enable-fs-paths-default=/var/run/current-system/sw/sbin:/sbin
     ${if ncurses == null then "--without-ncurses" else ""}
   '';
 
   buildInputs = stdenv.lib.optional (ncurses != null) ncurses;
-
-  # !!! It would be better to obtain the path to the mount helpers
-  # (/sbin/mount.*) through an environment variable, but that's
-  # somewhat risky because we have to consider that mount can setuid
-  # root...
-  preConfigure = ''
-    substituteInPlace mount/mount.c --replace /sbin/mount. /var/run/current-system/sw/sbin/mount.
-    substituteInPlace mount/umount.c --replace /sbin/umount. /var/run/current-system/sw/sbin/umount.
-  '';
-
 }