Trying to make the linux kernels also cross-build.

svn path=/nixpkgs/trunk/; revision=20080
This commit is contained in:
Lluís Batlle i Rossell
2010-02-17 22:20:56 +00:00
parent 7b4529cfc7
commit 70cb7050f5
3 changed files with 20 additions and 23 deletions
+8 -17
View File
@@ -2,7 +2,9 @@ source $stdenv/setup
makeFlags="ARCH=$arch SHELL=/bin/sh" makeFlags="ARCH=$arch SHELL=/bin/sh"
if [ -n "$crossConfig" ]; then
makeFlags="$makeFlags CROSS_COMPILE=$crossConfig-"
fi
configurePhase() { configurePhase() {
if test -n "$preConfigure"; then if test -n "$preConfigure"; then
@@ -36,12 +38,11 @@ configurePhase() {
postBuild() { postBuild() {
if [ "$platformName" == "sheevaplug" ]; then # After the builder did a 'make all' (kernel + modules)
make uImage # we force building the target asked: bzImage/zImage/uImage/...
fi make $kernelTarget
} }
installPhase() { installPhase() {
ensureDir $out ensureDir $out
@@ -59,17 +60,7 @@ installPhase() {
ensureDir $out/bin ensureDir $out/bin
cp linux $out/bin cp linux $out/bin
else else
case $platformName in cp arch/$archDir/boot/$kernelTarget $out
sheevaplug)
cp arch/$archDir/boot/uImage $out
;;
versatileARM)
cp arch/$archDir/boot/zImage $out
;;
*)
cp arch/$archDir/boot/bzImage $out/vmlinuz
;;
esac
fi fi
cp vmlinux $out cp vmlinux $out
@@ -87,7 +78,7 @@ installPhase() {
# Strip the kernel modules. # Strip the kernel modules.
echo "Stripping 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 # move this to install later on
# largely copied from early FC3 kernel spec files # largely copied from early FC3 kernel spec files
+5 -3
View File
@@ -38,6 +38,7 @@
uboot = null; uboot = null;
kernelBaseConfig = "defconfig"; kernelBaseConfig = "defconfig";
kernelAutoModules = true; kernelAutoModules = true;
kernelTarget = "bzImage";
} }
, ... , ...
}: }:
@@ -80,13 +81,14 @@ stdenv.mkDerivation {
in lib.concatStringsSep "\n" ([config] ++ configFromPatches); in lib.concatStringsSep "\n" ([config] ++ configFromPatches);
# For UML and non-PC, just ignore all options that don't apply (We are lazy). # 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 ] buildNativeInputs = [ perl mktemp ];
++ lib.optional (platform.uboot != null) [platform.uboot]; buildInputs = lib.optional (platform.uboot != null) platform.uboot;
platformName = platform.name; platformName = platform.name;
kernelBaseConfig = platform.kernelBaseConfig; kernelBaseConfig = platform.kernelBaseConfig;
kernelTarget = platform.kernelTarget;
arch = arch =
if xen then "xen" else if xen then "xen" else
+7 -3
View File
@@ -7,6 +7,7 @@ with pkgs;
kernelBaseConfig = "defconfig"; kernelBaseConfig = "defconfig";
# Build whatever possible as a module, if not stated in the extra config. # Build whatever possible as a module, if not stated in the extra config.
kernelAutoModules = true; kernelAutoModules = true;
kernelTarget = "bzImage";
kernelExtraConfig = kernelExtraConfig =
'' ''
# Virtualisation (KVM, Xen...). # Virtualisation (KVM, Xen...).
@@ -21,7 +22,7 @@ with pkgs;
''; '';
}; };
sheevaplug = assert system == "armv5tel-linux"; { sheevaplug = {
name = "sheevaplug"; name = "sheevaplug";
kernelBaseConfig = "kirkwood_defconfig"; kernelBaseConfig = "kirkwood_defconfig";
kernelArch = "arm"; kernelArch = "arm";
@@ -47,16 +48,18 @@ with pkgs;
SCSI_ACARD n SCSI_ACARD n
BLK_DEV_CMD640_ENHANCED n BLK_DEV_CMD640_ENHANCED n
''; '';
kernelTarget = "uImage";
uboot = ubootSheevaplug; uboot = ubootSheevaplug;
# Only for uboot = uboot : # Only for uboot = uboot :
ubootConfig = "sheevaplug_config"; ubootConfig = "sheevaplug_config";
}; };
versatileARM = assert system == "armv5tel-linux"; { versatileARM = {
name = "versatileARM"; name = "versatileARM";
kernelBaseConfig = "versatile_defconfig"; kernelBaseConfig = "versatile_defconfig";
kernelArch = "arm"; kernelArch = "arm";
kernelAutoModules = false; kernelAutoModules = false;
kernelTarget = "zImage";
uboot = null; uboot = null;
}; };
@@ -65,7 +68,8 @@ with pkgs;
kernelBaseConfig = "integrator_defconfig"; kernelBaseConfig = "integrator_defconfig";
kernelArch = "arm"; kernelArch = "arm";
kernelAutoModules = false; kernelAutoModules = false;
uboot = null; kernelTarget = "uImage";
uboot = uboot;
ubootConfig = "integratorcp_config"; ubootConfig = "integratorcp_config";
}; };
} }