2006-11-17 14:13:21 +00:00
|
|
|
# Create an initial ramdisk containing the closure of the specified
|
2006-11-27 01:35:34 +00:00
|
|
|
# file system objects. An initial ramdisk is used during the initial
|
2006-11-17 14:13:21 +00:00
|
|
|
# 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.
|
2006-11-02 17:56:50 +00:00
|
|
|
#
|
|
|
|
# An initrd is really just a gzipped cpio archive.
|
|
|
|
#
|
2006-11-27 01:35:34 +00:00
|
|
|
# Symlinks are created for each top-level file system object. E.g.,
|
|
|
|
# `contents = {object = ...; symlink = /init;}' is a typical
|
2006-11-02 17:56:50 +00:00
|
|
|
# argument.
|
|
|
|
|
2007-01-23 14:37:42 +00:00
|
|
|
{stdenv, perl, cpio, contents}:
|
2006-11-02 17:56:50 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "initrd";
|
|
|
|
builder = ./make-initrd.sh;
|
2007-01-23 14:37:42 +00:00
|
|
|
buildInputs = [perl cpio];
|
2006-11-27 01:35:34 +00: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;
|
2006-11-17 14:13:21 +00:00
|
|
|
|
2006-11-27 01:35:34 +00:00
|
|
|
# For obtaining the closure of `contents'.
|
|
|
|
exportReferencesGraph =
|
|
|
|
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
2007-01-23 14:37:42 +00:00
|
|
|
pathsFromGraph = ../helpers/paths-from-graph.pl;
|
2006-11-02 17:56:50 +00:00
|
|
|
}
|