diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2008-03-17 10:40:47 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2008-03-17 10:40:47 +0000 |
commit | 3ee0b9bb74b0331e0aae0bb452074ef14967393f (patch) | |
tree | 50aecf67fea2027949db6fd2535c5314e54af191 /pkgs/build-support/kernel/make-initrd.nix | |
parent | ed9107e33c7fe0b746dfe767da13142fe57b7414 (diff) |
* makeInitrd, makeModulesClosure: moved from NixOS.
* Use sh from klibc in the initrd. svn path=/nixpkgs/trunk/; revision=11154
Diffstat (limited to 'pkgs/build-support/kernel/make-initrd.nix')
-rw-r--r-- | pkgs/build-support/kernel/make-initrd.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix new file mode 100644 index 0000000000000..b62ed98404565 --- /dev/null +++ b/pkgs/build-support/kernel/make-initrd.nix @@ -0,0 +1,31 @@ +# 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. + +{stdenv, perl, cpio, contents}: + +stdenv.mkDerivation { + name = "initrd"; + builder = ./make-initrd.sh; + buildInputs = [perl cpio]; + + # !!! 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; +} |