Fixing the kernel expressions to allow normal and cross-building, depending
on the native and cross platforms. I thought I already did that today in a previous commit, but I did all wrong. svn path=/nixpkgs/trunk/; revision=20280
This commit is contained in:
parent
305a7a2ddf
commit
289d728337
|
@ -9,6 +9,9 @@
|
||||||
, # The kernel configuration.
|
, # The kernel configuration.
|
||||||
config
|
config
|
||||||
|
|
||||||
|
, # The kernel configuration when cross building.
|
||||||
|
configCross ? {}
|
||||||
|
|
||||||
, # An attribute set whose attributes express the availability of
|
, # An attribute set whose attributes express the availability of
|
||||||
# certain features in this kernel. E.g. `{iwlwifi = true;}'
|
# certain features in this kernel. E.g. `{iwlwifi = true;}'
|
||||||
# indicates a kernel that provides Intel wireless support. Used in
|
# indicates a kernel that provides Intel wireless support. Used in
|
||||||
|
@ -33,13 +36,6 @@
|
||||||
|
|
||||||
, preConfigure ? ""
|
, preConfigure ? ""
|
||||||
, extraMeta ? {}
|
, extraMeta ? {}
|
||||||
, platform ? {
|
|
||||||
name = "pc";
|
|
||||||
uboot = null;
|
|
||||||
kernelBaseConfig = "defconfig";
|
|
||||||
kernelAutoModules = true;
|
|
||||||
kernelTarget = "bzImage";
|
|
||||||
}
|
|
||||||
, ubootChooser ? null
|
, ubootChooser ? null
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
|
@ -47,12 +43,18 @@
|
||||||
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"
|
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"
|
||||||
|| stdenv.system == "armv5tel-linux";
|
|| stdenv.system == "armv5tel-linux";
|
||||||
|
|
||||||
assert platform.name == "sheevaplug" -> platform.uboot != null;
|
assert stdenv.platform.name == "sheevaplug" -> stdenv.platform.uboot != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
lib = stdenv.lib;
|
lib = stdenv.lib;
|
||||||
|
|
||||||
|
kernelConfigFun = baseConfig:
|
||||||
|
let
|
||||||
|
configFromPatches =
|
||||||
|
map ({extraConfig ? "", ...}: extraConfig) kernelPatches;
|
||||||
|
in lib.concatStringsSep "\n" ([baseConfig] ++ configFromPatches);
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
|
@ -69,34 +71,49 @@ stdenv.mkDerivation {
|
||||||
generateConfig = ./generate-config.pl;
|
generateConfig = ./generate-config.pl;
|
||||||
|
|
||||||
inherit preConfigure src module_init_tools localVersion;
|
inherit preConfigure src module_init_tools localVersion;
|
||||||
autoModules = platform.kernelAutoModules;
|
|
||||||
|
|
||||||
patches = map (p: p.patch) kernelPatches;
|
patches = map (p: p.patch) kernelPatches;
|
||||||
|
|
||||||
kernelConfig =
|
kernelConfig = kernelConfigFun config;
|
||||||
let
|
|
||||||
configFromPatches =
|
|
||||||
map ({extraConfig ? "", ...}: extraConfig) kernelPatches;
|
|
||||||
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 || platform.name != "pc");
|
ignoreConfigErrors = (userModeLinux || stdenv.platform.name != "pc");
|
||||||
|
|
||||||
buildNativeInputs = [ perl mktemp ];
|
buildNativeInputs = [ perl mktemp ];
|
||||||
buildInputs = lib.optional (platform.uboot != null) (ubootChooser platform.uboot);
|
buildInputs = lib.optional (stdenv.platform.uboot != null)
|
||||||
|
(ubootChooser stdenv.platform.uboot);
|
||||||
|
|
||||||
platformName = platform.name;
|
platformName = stdenv.platform.name;
|
||||||
kernelBaseConfig = platform.kernelBaseConfig;
|
kernelBaseConfig = stdenv.platform.kernelBaseConfig;
|
||||||
kernelTarget = platform.kernelTarget;
|
kernelTarget = stdenv.platform.kernelTarget;
|
||||||
|
autoModules = stdenv.platform.kernelAutoModules;
|
||||||
|
|
||||||
arch =
|
arch =
|
||||||
if xen then "xen" else
|
if xen then "xen" else
|
||||||
if userModeLinux then "um" else
|
if userModeLinux then "um" else
|
||||||
if platform ? kernelArch then platform.kernelArch else
|
|
||||||
if stdenv.system == "i686-linux" then "i386" else
|
if stdenv.system == "i686-linux" then "i386" else
|
||||||
if stdenv.system == "x86_64-linux" then "x86_64" else
|
if stdenv.system == "x86_64-linux" then "x86_64" else
|
||||||
abort "Platform ${stdenv.system} is not supported.";
|
abort "Platform ${stdenv.system} is not supported.";
|
||||||
|
|
||||||
|
crossAttrs = let
|
||||||
|
cp = stdenv.cross.platform;
|
||||||
|
in
|
||||||
|
assert cp.name == "sheevaplug" -> cp.uboot != null;
|
||||||
|
{
|
||||||
|
arch = cp.kernelArch;
|
||||||
|
platformName = cp.name;
|
||||||
|
kernelBaseConfig = cp.kernelBaseConfig;
|
||||||
|
kernelTarget = cp.kernelTarget;
|
||||||
|
autoModules = cp.kernelAutoModules;
|
||||||
|
|
||||||
|
# Just ignore all options that don't apply (We are lazy).
|
||||||
|
ignoreConfigErrors = true;
|
||||||
|
|
||||||
|
kernelConfig = kernelConfigFun configCross;
|
||||||
|
|
||||||
|
buildInputs = lib.optional (cp.uboot != null) (ubootChooser cp.uboot);
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description =
|
description =
|
||||||
(if userModeLinux then
|
(if userModeLinux then
|
||||||
|
|
|
@ -207,13 +207,7 @@ import ./generic.nix (
|
||||||
};
|
};
|
||||||
|
|
||||||
config = configWithPlatform stdenv.platform;
|
config = configWithPlatform stdenv.platform;
|
||||||
|
configCross = configWithPlatform stdenv.cross.platform;
|
||||||
platform = stdenv.platform;
|
|
||||||
|
|
||||||
crossAttrs = {
|
|
||||||
config = configWithPlatform stdenv.cross.platform;
|
|
||||||
platform = stdenv.cross.platform;
|
|
||||||
};
|
|
||||||
|
|
||||||
features.iwlwifi = true;
|
features.iwlwifi = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,13 +205,7 @@ import ./generic.nix (
|
||||||
};
|
};
|
||||||
|
|
||||||
config = configWithPlatform stdenv.platform;
|
config = configWithPlatform stdenv.platform;
|
||||||
|
configCross = configWithPlatform stdenv.cross.platform;
|
||||||
platform = stdenv.platform;
|
|
||||||
|
|
||||||
crossAttrs = {
|
|
||||||
config = configWithPlatform stdenv.cross.platform;
|
|
||||||
platform = stdenv.cross.platform;
|
|
||||||
};
|
|
||||||
|
|
||||||
features.iwlwifi = true;
|
features.iwlwifi = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue