summary refs log tree commit diff
path: root/pkgs/os-specific/linux/klibc
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2011-10-25 08:59:39 +0000
committerShea Levy <shea@shealevy.com>2011-10-25 08:59:39 +0000
commitdd9e83b77faa321fe9cb8e11e79070c792d07d50 (patch)
treede003a27b817e28dab30940c58b155894f111052 /pkgs/os-specific/linux/klibc
parente0e4770ec96d35c1f8bab4bda4a629dd747c704a (diff)
downloadnixlib-dd9e83b77faa321fe9cb8e11e79070c792d07d50.tar
nixlib-dd9e83b77faa321fe9cb8e11e79070c792d07d50.tar.gz
nixlib-dd9e83b77faa321fe9cb8e11e79070c792d07d50.tar.bz2
nixlib-dd9e83b77faa321fe9cb8e11e79070c792d07d50.tar.lz
nixlib-dd9e83b77faa321fe9cb8e11e79070c792d07d50.tar.xz
nixlib-dd9e83b77faa321fe9cb8e11e79070c792d07d50.tar.zst
nixlib-dd9e83b77faa321fe9cb8e11e79070c792d07d50.zip
Enable building full klibc as a kernelPackage
svn path=/nixpkgs/trunk/; revision=30009
Diffstat (limited to 'pkgs/os-specific/linux/klibc')
-rw-r--r--pkgs/os-specific/linux/klibc/default.nix23
1 files changed, 20 insertions, 3 deletions
diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix
index d71b97b9c7d3..e1b8c0d28364 100644
--- a/pkgs/os-specific/linux/klibc/default.nix
+++ b/pkgs/os-specific/linux/klibc/default.nix
@@ -1,4 +1,13 @@
-{stdenv, fetchurl, perl, bison, mktemp, linuxHeaders, linuxHeadersCross}:
+{
+  stdenv,
+  fetchurl,
+  perl,
+  bison,
+  mktemp,
+  linuxHeaders,
+  linuxHeadersCross,
+  kernel ? null
+}:
 
 assert stdenv.isLinux;
 
@@ -20,7 +29,7 @@ stdenv.mkDerivation {
   # 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 = ''
+  prePatch = stdenv.lib.optionalString (kernel == null) ''
     sed -i -e /headers_install/d scripts/Kbuild.install
   '';
   
@@ -49,10 +58,18 @@ stdenv.mkDerivation {
     echo "CONFIG_AEABI=y" >> defconfig
     makeFlags=$(eval "echo $makeFlags")
 
+  '' + (if kernel == null then ''
     mkdir linux
     cp -prsd $linuxHeaders/include linux/
     chmod -R u+w linux/include/
-  ''; # */
+  '' else ''
+    tar xvf ${kernel.src}
+    mv linux* linux
+    cd linux
+    ln -sv ${kernel}/config .config
+    make prepare
+    cd ..
+  '');
   
   # Install static binaries as well.
   postInstall = ''