Simplified much more the expressions for cross building and multiplatform.
I introduce the new nixpkgs parameter "platform", defaulting to "pc", which was before defined as an attribute of nixpkgs. I made the crossSystem nixpkgs attribute set parameter contain its own 'platform'. This allows cross-building a kernel for a given crossSystem.platform in a non-PC platform. The actual native platform can be taken from stdenv.platform, and this way we also avoid the constant passing of 'platform' to packages for platform-dependant builds (kernel, initrd, ...). I will update nixos accordingly to these changes, for non-PC platforms to work. I think we are gaining on flexibility and clearness. I could cross build succesfully an ultrasparc kernel and a mipsel kernel on PC. But since this change, I should be able to do this also in non-PC. Before this change, there was no possibility of distinguishing the "target platform" or the "native build platform" when cross building, being the single "platform" attribute always interpreted as target platform. The platform is a quite relevant attribute set, as it determines the linuxHeaders used (in the case, by now the only one supported, of linux targets). The platform attributes are quite linux centric still. Let's hope for more generality to come. svn path=/nixpkgs/trunk/; revision=20273
This commit is contained in:
parent
fca769846a
commit
11aa65c28a
@ -12,15 +12,19 @@
|
|||||||
# `contents = {object = ...; symlink = /init;}' is a typical
|
# `contents = {object = ...; symlink = /init;}' is a typical
|
||||||
# argument.
|
# argument.
|
||||||
|
|
||||||
{stdenv, perl, cpio, contents, platform}:
|
{stdenv, perl, cpio, contents, ubootChooser}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inputsFun = ubootName : [perl cpio]
|
||||||
|
++ stdenv.lib.optional (ubootName != null) [ ubootChooser ubootName ];
|
||||||
|
makeUInitrdFun = ubootName : (ubootName != null);
|
||||||
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "initrd";
|
name = "initrd";
|
||||||
builder = ./make-initrd.sh;
|
builder = ./make-initrd.sh;
|
||||||
buildInputs = [perl cpio]
|
buildNativeInputs = inputsFun stdenv.platform.uboot;
|
||||||
++ stdenv.lib.optional (platform.uboot != null) [ platform.uboot ];
|
|
||||||
|
|
||||||
makeUInitrd = if (platform.uboot != null) then true else false;
|
makeUInitrd = makeUInitrdFun stdenv.platform.uboot;
|
||||||
|
|
||||||
# !!! should use XML.
|
# !!! should use XML.
|
||||||
objects = map (x: x.object) contents;
|
objects = map (x: x.object) contents;
|
||||||
@ -31,4 +35,9 @@ stdenv.mkDerivation {
|
|||||||
exportReferencesGraph =
|
exportReferencesGraph =
|
||||||
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
||||||
pathsFromGraph = ./paths-from-graph.pl;
|
pathsFromGraph = ./paths-from-graph.pl;
|
||||||
|
|
||||||
|
crossAttrs = {
|
||||||
|
buildNativeInputs = inputsFun stdenv.cross.platform.uboot;
|
||||||
|
makeUInitrd = makeUInitrdFun stdenv.cross.platform.uboot;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
args @ { stdenv, fetchurl, platform, userModeLinux ? false, extraConfig ? ""
|
args @ { stdenv, fetchurl, userModeLinux ? false, extraConfig ? ""
|
||||||
, ... }:
|
, ... }:
|
||||||
|
|
||||||
import ./generic.nix (
|
let
|
||||||
|
configWithPlatform = kernelPlatform :
|
||||||
rec {
|
|
||||||
version = "2.6.32.9";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
|
|
||||||
sha256 = "1g6hs7j5kmifb3phbnckdmrnxd0cpqrijnnbry86z26npsh9my7l";
|
|
||||||
};
|
|
||||||
|
|
||||||
features.iwlwifi = true;
|
|
||||||
|
|
||||||
config =
|
|
||||||
''
|
''
|
||||||
# Don't include any debug features.
|
# Don't include any debug features.
|
||||||
DEBUG_KERNEL n
|
DEBUG_KERNEL n
|
||||||
@ -202,9 +191,31 @@ import ./generic.nix (
|
|||||||
X86_CHECK_BIOS_CORRUPTION y
|
X86_CHECK_BIOS_CORRUPTION y
|
||||||
X86_MCE y
|
X86_MCE y
|
||||||
|
|
||||||
${if platform ? kernelExtraConfig then platform.kernelExtraConfig else ""}
|
${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
|
||||||
${extraConfig}
|
${extraConfig}
|
||||||
'';
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
|
import ./generic.nix (
|
||||||
|
|
||||||
|
rec {
|
||||||
|
version = "2.6.32.9";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
|
||||||
|
sha256 = "1g6hs7j5kmifb3phbnckdmrnxd0cpqrijnnbry86z26npsh9my7l";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = configWithPlatform stdenv.platform;
|
||||||
|
|
||||||
|
platform = stdenv.platform;
|
||||||
|
|
||||||
|
crossAttrs = {
|
||||||
|
config = configWithPlatform stdenv.cross.platform;
|
||||||
|
platform = stdenv.cross.platform;
|
||||||
|
};
|
||||||
|
|
||||||
|
features.iwlwifi = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeAttrs args ["extraConfig"]
|
// removeAttrs args ["extraConfig"]
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
args @ { stdenv, fetchurl, platform, userModeLinux ? false, extraConfig ? ""
|
args @ { stdenv, fetchurl, userModeLinux ? false, extraConfig ? ""
|
||||||
, ... }:
|
, ... }:
|
||||||
|
|
||||||
import ./generic.nix (
|
let
|
||||||
|
configWithPlatform = kernelPlatform :
|
||||||
rec {
|
|
||||||
version = "2.6.33";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
|
|
||||||
sha256 = "1inmam21w13nyf5imgdb5palhiap41zcxf9k32i4ck1w7gg3gqk3";
|
|
||||||
};
|
|
||||||
|
|
||||||
features.iwlwifi = true;
|
|
||||||
|
|
||||||
config =
|
|
||||||
''
|
''
|
||||||
# Don't include any debug features.
|
# Don't include any debug features.
|
||||||
DEBUG_KERNEL n
|
DEBUG_KERNEL n
|
||||||
@ -200,9 +189,31 @@ import ./generic.nix (
|
|||||||
X86_CHECK_BIOS_CORRUPTION y
|
X86_CHECK_BIOS_CORRUPTION y
|
||||||
X86_MCE y
|
X86_MCE y
|
||||||
|
|
||||||
${if platform ? kernelExtraConfig then platform.kernelExtraConfig else ""}
|
${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
|
||||||
${extraConfig}
|
${extraConfig}
|
||||||
'';
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
|
import ./generic.nix (
|
||||||
|
|
||||||
|
rec {
|
||||||
|
version = "2.6.33";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
|
||||||
|
sha256 = "1inmam21w13nyf5imgdb5palhiap41zcxf9k32i4ck1w7gg3gqk3";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = configWithPlatform stdenv.platform;
|
||||||
|
|
||||||
|
platform = stdenv.platform;
|
||||||
|
|
||||||
|
crossAttrs = {
|
||||||
|
config = configWithPlatform stdenv.cross.platform;
|
||||||
|
platform = stdenv.cross.platform;
|
||||||
|
};
|
||||||
|
|
||||||
|
features.iwlwifi = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeAttrs args ["extraConfig"]
|
// removeAttrs args ["extraConfig"]
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
config ? null
|
config ? null
|
||||||
|
|
||||||
, crossSystem ? null
|
, crossSystem ? null
|
||||||
|
, platform ? (import ./platforms.nix).pc
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +181,7 @@ let
|
|||||||
allPackages = args: import ./all-packages.nix ({ inherit config; } // args);
|
allPackages = args: import ./all-packages.nix ({ inherit config; } // args);
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultStdenv = allStdenvs.stdenv;
|
defaultStdenv = allStdenvs.stdenv // { inherit platform; };
|
||||||
|
|
||||||
stdenvCross = makeStdenvCross defaultStdenv crossSystem (binutilsCross crossSystem)
|
stdenvCross = makeStdenvCross defaultStdenv crossSystem (binutilsCross crossSystem)
|
||||||
(gccCrossStageFinal crossSystem);
|
(gccCrossStageFinal crossSystem);
|
||||||
@ -291,7 +292,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
makeInitrd = {contents}: import ../build-support/kernel/make-initrd.nix {
|
makeInitrd = {contents}: import ../build-support/kernel/make-initrd.nix {
|
||||||
inherit stdenv perl cpio contents platform;
|
inherit stdenv perl cpio contents ubootChooser;
|
||||||
};
|
};
|
||||||
|
|
||||||
makeWrapper = makeSetupHook ../build-support/make-wrapper/make-wrapper.sh;
|
makeWrapper = makeSetupHook ../build-support/make-wrapper/make-wrapper.sh;
|
||||||
@ -326,11 +327,7 @@ let
|
|||||||
inherit pkgs lib;
|
inherit pkgs lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
platforms = import ./platforms.nix {
|
platforms = import ./platforms.nix;
|
||||||
inherit system pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
platform = platforms.pc;
|
|
||||||
|
|
||||||
### TOOLS
|
### TOOLS
|
||||||
|
|
||||||
@ -5845,7 +5842,8 @@ let
|
|||||||
linuxHeaders = linuxHeaders_2_6_28;
|
linuxHeaders = linuxHeaders_2_6_28;
|
||||||
|
|
||||||
linuxHeadersCross = cross : forceBuildDrv (import ../os-specific/linux/kernel-headers/2.6.32.nix {
|
linuxHeadersCross = cross : forceBuildDrv (import ../os-specific/linux/kernel-headers/2.6.32.nix {
|
||||||
inherit stdenv fetchurl cross perl platform;
|
inherit stdenv fetchurl cross perl;
|
||||||
|
platform = cross.platform;
|
||||||
});
|
});
|
||||||
|
|
||||||
linuxHeaders_2_6_18 = import ../os-specific/linux/kernel-headers/2.6.18.5.nix {
|
linuxHeaders_2_6_18 = import ../os-specific/linux/kernel-headers/2.6.18.5.nix {
|
||||||
@ -5903,12 +5901,11 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
linux_2_6_32 = makeOverridable (import ../os-specific/linux/kernel/linux-2.6.32.nix) {
|
linux_2_6_32 = makeOverridable (import ../os-specific/linux/kernel/linux-2.6.32.nix) {
|
||||||
inherit fetchurl stdenv perl mktemp module_init_tools;
|
inherit fetchurl stdenv perl mktemp module_init_tools ubootChooser;
|
||||||
kernelPatches =
|
kernelPatches =
|
||||||
[ kernelPatches.fbcondecor_2_6_31
|
[ kernelPatches.fbcondecor_2_6_31
|
||||||
kernelPatches.sec_perm_2_6_24
|
kernelPatches.sec_perm_2_6_24
|
||||||
];
|
];
|
||||||
inherit platform;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
linux_2_6_32_zen4 = makeOverridable (import ../os-specific/linux/zen-kernel/2.6.32-zen4.nix) {
|
linux_2_6_32_zen4 = makeOverridable (import ../os-specific/linux/zen-kernel/2.6.32-zen4.nix) {
|
||||||
@ -5928,12 +5925,11 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
linux_2_6_33 = makeOverridable (import ../os-specific/linux/kernel/linux-2.6.33.nix) {
|
linux_2_6_33 = makeOverridable (import ../os-specific/linux/kernel/linux-2.6.33.nix) {
|
||||||
inherit fetchurl stdenv perl mktemp module_init_tools;
|
inherit fetchurl stdenv perl mktemp module_init_tools ubootChooser;
|
||||||
kernelPatches =
|
kernelPatches =
|
||||||
[ kernelPatches.fbcondecor_2_6_33
|
[ kernelPatches.fbcondecor_2_6_33
|
||||||
kernelPatches.sec_perm_2_6_24
|
kernelPatches.sec_perm_2_6_24
|
||||||
];
|
];
|
||||||
inherit platform;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Linux kernel modules are inherently tied to a specific kernel. So
|
/* Linux kernel modules are inherently tied to a specific kernel. So
|
||||||
@ -6347,7 +6343,11 @@ let
|
|||||||
inherit (xlibs) libX11 xproto;
|
inherit (xlibs) libX11 xproto;
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
uboot = makeOverridable (import ../misc/uboot) {
|
ubootChooser = name : if (name == "upstream") then ubootUpstream
|
||||||
|
else if (name == "sheevaplug") then ubootSheevaplug
|
||||||
|
else throw "Unknown uboot";
|
||||||
|
|
||||||
|
ubootUpstream = makeOverridable (import ../misc/uboot) {
|
||||||
inherit fetchurl stdenv unzip platform;
|
inherit fetchurl stdenv unzip platform;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
{ system, pkgs}:
|
|
||||||
with pkgs;
|
|
||||||
rec {
|
rec {
|
||||||
pc = assert system == "i686-linux" || system == "x86_64-linux"; {
|
pc = {
|
||||||
name = "pc";
|
name = "pc";
|
||||||
uboot = null;
|
uboot = null;
|
||||||
kernelBaseConfig = "defconfig";
|
kernelBaseConfig = "defconfig";
|
||||||
@ -60,7 +58,7 @@ rec {
|
|||||||
IP_PNP y
|
IP_PNP y
|
||||||
'';
|
'';
|
||||||
kernelTarget = "uImage";
|
kernelTarget = "uImage";
|
||||||
uboot = ubootSheevaplug;
|
uboot = "sheevaplug";
|
||||||
# Only for uboot = uboot :
|
# Only for uboot = uboot :
|
||||||
ubootConfig = "sheevaplug_config";
|
ubootConfig = "sheevaplug_config";
|
||||||
};
|
};
|
||||||
@ -133,7 +131,7 @@ rec {
|
|||||||
integratorCPuboot = integratorCP // {
|
integratorCPuboot = integratorCP // {
|
||||||
name = "integratorCPuboot";
|
name = "integratorCPuboot";
|
||||||
kernelTarget = "uImage";
|
kernelTarget = "uImage";
|
||||||
uboot = uboot;
|
uboot = "upstream";
|
||||||
ubootConfig = "integratorcp_config";
|
ubootConfig = "integratorcp_config";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user