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

View file

@ -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

View file

@ -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

View file

@ -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";
};
}