summary refs log tree commit diff
path: root/pkgs/build-support/kernel
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-02-27 17:35:47 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-02-27 17:35:47 +0000
commit11aa65c28a819db3a2142884f86fa6a8efdea640 (patch)
tree606604f9626decacbf5639d1642a2643ed6b9b66 /pkgs/build-support/kernel
parentfca769846a4ba4f517f7c60bb1e4cec31c7e38dc (diff)
downloadnixpkgs-11aa65c28a819db3a2142884f86fa6a8efdea640.tar
nixpkgs-11aa65c28a819db3a2142884f86fa6a8efdea640.tar.gz
nixpkgs-11aa65c28a819db3a2142884f86fa6a8efdea640.tar.bz2
nixpkgs-11aa65c28a819db3a2142884f86fa6a8efdea640.tar.lz
nixpkgs-11aa65c28a819db3a2142884f86fa6a8efdea640.tar.xz
nixpkgs-11aa65c28a819db3a2142884f86fa6a8efdea640.tar.zst
nixpkgs-11aa65c28a819db3a2142884f86fa6a8efdea640.zip
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
Diffstat (limited to 'pkgs/build-support/kernel')
-rw-r--r--pkgs/build-support/kernel/make-initrd.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix
index 96268577696..f2cf894b863 100644
--- a/pkgs/build-support/kernel/make-initrd.nix
+++ b/pkgs/build-support/kernel/make-initrd.nix
@@ -12,15 +12,19 @@
 # `contents = {object = ...; symlink = /init;}' is a typical
 # 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 {
   name = "initrd";
   builder = ./make-initrd.sh;
-  buildInputs = [perl cpio]
-    ++ stdenv.lib.optional (platform.uboot != null) [ platform.uboot ];
+  buildNativeInputs = inputsFun stdenv.platform.uboot;
 
-  makeUInitrd = if (platform.uboot != null) then true else false;
+  makeUInitrd = makeUInitrdFun stdenv.platform.uboot;
 
   # !!! should use XML.
   objects = map (x: x.object) contents;
@@ -31,4 +35,9 @@ stdenv.mkDerivation {
   exportReferencesGraph =
     map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
   pathsFromGraph = ./paths-from-graph.pl;
+
+  crossAttrs = {
+    buildNativeInputs = inputsFun stdenv.cross.platform.uboot;
+    makeUInitrd = makeUInitrdFun stdenv.cross.platform.uboot;
+  };
 }