about summary refs log tree commit diff
path: root/pkgs
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
parent7b4529cfc7b1012fc76280647f64bb8d25c37a03 (diff)
downloadnixlib-70cb7050f5c0826359416eb3e18682796934c920.tar
nixlib-70cb7050f5c0826359416eb3e18682796934c920.tar.gz
nixlib-70cb7050f5c0826359416eb3e18682796934c920.tar.bz2
nixlib-70cb7050f5c0826359416eb3e18682796934c920.tar.lz
nixlib-70cb7050f5c0826359416eb3e18682796934c920.tar.xz
nixlib-70cb7050f5c0826359416eb3e18682796934c920.tar.zst
nixlib-70cb7050f5c0826359416eb3e18682796934c920.zip
Trying to make the linux kernels also cross-build.
svn path=/nixpkgs/trunk/; revision=20080
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/os-specific/linux/kernel/builder.sh25
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix8
-rw-r--r--pkgs/top-level/platforms.nix10
3 files changed, 20 insertions, 23 deletions
diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh
index 9c7f0ea4086b..1ae0bc36f9ed 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 42e12314a217..9a459136dc6a 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
diff --git a/pkgs/top-level/platforms.nix b/pkgs/top-level/platforms.nix
index 1d0d526829c6..8bbb3ae56a8d 100644
--- a/pkgs/top-level/platforms.nix
+++ b/pkgs/top-level/platforms.nix
@@ -7,6 +7,7 @@ with pkgs;
     kernelBaseConfig = "defconfig";
     # Build whatever possible as a module, if not stated in the extra config.
     kernelAutoModules = true;
+    kernelTarget = "bzImage";
     kernelExtraConfig =
       ''
         # Virtualisation (KVM, Xen...).
@@ -21,7 +22,7 @@ with pkgs;
       '';
   };
 
-  sheevaplug = assert system == "armv5tel-linux"; {
+  sheevaplug = {
     name = "sheevaplug";
     kernelBaseConfig = "kirkwood_defconfig";
     kernelArch = "arm";
@@ -47,16 +48,18 @@ with pkgs;
         SCSI_ACARD n
         BLK_DEV_CMD640_ENHANCED n
       '';
+    kernelTarget = "uImage";
     uboot = ubootSheevaplug;
     # Only for uboot = uboot :
     ubootConfig = "sheevaplug_config";
   };
 
-  versatileARM = assert system == "armv5tel-linux"; {
+  versatileARM = {
     name = "versatileARM";
     kernelBaseConfig = "versatile_defconfig";
     kernelArch = "arm";
     kernelAutoModules = false;
+    kernelTarget = "zImage";
     uboot = null;
   };
 
@@ -65,7 +68,8 @@ with pkgs;
     kernelBaseConfig = "integrator_defconfig";
     kernelArch = "arm";
     kernelAutoModules = false;
-    uboot = null;
+    kernelTarget = "uImage";
+    uboot = uboot;
     ubootConfig = "integratorcp_config";
   };
 }