2008-03-17 11:40:47 +01:00
|
|
|
# Create an initial ramdisk containing the closure of the specified
|
|
|
|
# file system objects. An initial ramdisk is used during the initial
|
|
|
|
# stages of booting a Linux system. It is loaded by the boot loader
|
|
|
|
# along with the kernel image. It's supposed to contain everything
|
|
|
|
# (such as kernel modules) necessary to allow us to mount the root
|
|
|
|
# file system. Once the root file system is mounted, the `real' boot
|
|
|
|
# script can be called.
|
|
|
|
#
|
|
|
|
# An initrd is really just a gzipped cpio archive.
|
|
|
|
#
|
|
|
|
# Symlinks are created for each top-level file system object. E.g.,
|
|
|
|
# `contents = {object = ...; symlink = /init;}' is a typical
|
|
|
|
# argument.
|
|
|
|
|
2015-03-25 20:03:03 +01:00
|
|
|
{ stdenv, perl, perlArchiveCpio, cpio, contents, ubootChooser, compressor, prepend }:
|
2008-03-17 11:40:47 +01:00
|
|
|
|
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
2010-02-27 18:35:47 +01:00
|
|
|
let
|
2013-08-16 02:42:11 +02:00
|
|
|
inputsFun = ubootName : [perl cpio perlArchiveCpio ]
|
2010-02-27 19:51:06 +01:00
|
|
|
++ stdenv.lib.optional (ubootName != null) [ (ubootChooser ubootName) ];
|
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
2010-02-27 18:35:47 +01:00
|
|
|
makeUInitrdFun = ubootName : (ubootName != null);
|
|
|
|
in
|
2008-03-17 11:40:47 +01:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "initrd";
|
|
|
|
builder = ./make-initrd.sh;
|
2012-12-28 19:20:09 +01:00
|
|
|
nativeBuildInputs = inputsFun stdenv.platform.uboot;
|
2009-11-08 01:32:12 +01:00
|
|
|
|
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
2010-02-27 18:35:47 +01:00
|
|
|
makeUInitrd = makeUInitrdFun stdenv.platform.uboot;
|
2008-03-17 11:40:47 +01:00
|
|
|
|
|
|
|
# !!! should use XML.
|
|
|
|
objects = map (x: x.object) contents;
|
|
|
|
symlinks = map (x: x.symlink) contents;
|
|
|
|
suffices = map (x: if x ? suffix then x.suffix else "none") contents;
|
|
|
|
|
|
|
|
# For obtaining the closure of `contents'.
|
|
|
|
exportReferencesGraph =
|
|
|
|
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
|
|
|
pathsFromGraph = ./paths-from-graph.pl;
|
2013-08-16 02:42:11 +02:00
|
|
|
cpioClean = ./cpio-clean.pl;
|
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
2010-02-27 18:35:47 +01:00
|
|
|
|
|
|
|
crossAttrs = {
|
2012-12-28 19:20:09 +01:00
|
|
|
nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
|
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
2010-02-27 18:35:47 +01:00
|
|
|
makeUInitrd = makeUInitrdFun stdenv.cross.platform.uboot;
|
|
|
|
};
|
2015-03-25 20:03:03 +01:00
|
|
|
inherit compressor prepend;
|
2008-03-17 11:40:47 +01:00
|
|
|
}
|