about summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-02-17 22:20:56 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-02-17 22:20:56 +0000
commit70cb7050f5c0826359416eb3e18682796934c920 (patch)
treebc9c5f1dbcdc850942ea22561e1fa7e8c2e67bcc /pkgs/os-specific
parent7b4529cfc7b1012fc76280647f64bb8d25c37a03 (diff)
Trying to make the linux kernels also cross-build.
svn path=/nixpkgs/trunk/; revision=20080
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/kernel/builder.sh25
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix8
2 files changed, 13 insertions, 20 deletions
diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh
index 9c7f0ea4086b2..1ae0bc36f9ed5 100644
--- a/pkgs/os-specific/linux/kernel/builder.sh
+++ b/pkgs/os-specific/linux/kernel/builder.sh
@@ -2,7 +2,9 @@ source $stdenv/setup
 
 
 makeFlags="ARCH=$arch SHELL=/bin/sh"
-
+if [ -n "$crossConfig" ]; then
+  makeFlags="$makeFlags CROSS_COMPILE=$crossConfig-"
+fi
 
 configurePhase() {
     if test -n "$preConfigure"; then 
@@ -36,12 +38,11 @@ configurePhase() {
 
 
 postBuild() {
-   if [ "$platformName" == "sheevaplug" ]; then
-       make uImage
-   fi
+    # After the builder did a 'make all' (kernel + modules)
+    # we force building the target asked: bzImage/zImage/uImage/...
+    make $kernelTarget
 }
 
-
 installPhase() {
 
     ensureDir $out
@@ -59,17 +60,7 @@ installPhase() {
         ensureDir $out/bin
         cp linux $out/bin
     else
-       case $platformName in
-         sheevaplug)
-           cp arch/$archDir/boot/uImage $out
-           ;;
-         versatileARM)
-           cp arch/$archDir/boot/zImage $out
-           ;;
-         *)
-           cp arch/$archDir/boot/bzImage $out/vmlinuz
-           ;;
-       esac
+        cp arch/$archDir/boot/$kernelTarget $out
     fi
 
     cp vmlinux $out
@@ -87,7 +78,7 @@ installPhase() {
 
     # Strip the kernel modules.
     echo "Stripping kernel modules..."
-    find $out -name "*.ko" -print0 | xargs -0 strip -S
+    find $out -name "*.ko" -print0 | xargs -0 $crossConfig-strip -S
 
     # move this to install later on
     # largely copied from early FC3 kernel spec files
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index 42e12314a2178..9a459136dc6aa 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -38,6 +38,7 @@
     uboot = null;
     kernelBaseConfig = "defconfig";
     kernelAutoModules = true;
+    kernelTarget = "bzImage";
   }
 , ...
 }:
@@ -80,13 +81,14 @@ stdenv.mkDerivation {
     in lib.concatStringsSep "\n" ([config] ++ configFromPatches);
 
   # For UML and non-PC, just ignore all options that don't apply (We are lazy).
-  ignoreConfigErrors = (userModeLinux || stdenv.system == "armv5tel-linux");
+  ignoreConfigErrors = (userModeLinux || platform.name != "pc");
 
-  buildInputs = [ perl mktemp ]
-    ++ lib.optional (platform.uboot != null) [platform.uboot];
+  buildNativeInputs = [ perl mktemp ];
+  buildInputs = lib.optional (platform.uboot != null) platform.uboot;
 
   platformName = platform.name;
   kernelBaseConfig = platform.kernelBaseConfig;
+  kernelTarget = platform.kernelTarget;
   
   arch =
     if xen then "xen" else