at 18.09-beta 40 lines 1.4 kB view raw
1# Create an initial ramdisk containing the closure of the specified 2# file system objects. An initial ramdisk is used during the initial 3# stages of booting a Linux system. It is loaded by the boot loader 4# along with the kernel image. It's supposed to contain everything 5# (such as kernel modules) necessary to allow us to mount the root 6# file system. Once the root file system is mounted, the `real' boot 7# script can be called. 8# 9# An initrd is really just a gzipped cpio archive. 10# 11# Symlinks are created for each top-level file system object. E.g., 12# `contents = {object = ...; symlink = /init;}' is a typical 13# argument. 14 15{ stdenv, perl, cpio, contents, compressor, prepend, ubootTools 16}: 17 18stdenv.mkDerivation rec { 19 name = "initrd"; 20 builder = ./make-initrd.sh; 21 22 makeUInitrd = stdenv.hostPlatform.platform.kernelTarget == "uImage"; 23 24 nativeBuildInputs = [ perl cpio ] 25 ++ stdenv.lib.optional makeUInitrd ubootTools; 26 27 # !!! should use XML. 28 objects = map (x: x.object) contents; 29 symlinks = map (x: x.symlink) contents; 30 suffices = map (x: if x ? suffix then x.suffix else "none") contents; 31 32 # For obtaining the closure of `contents'. 33 # Note: we don't use closureInfo yet, as that won't build with nix-1.x. 34 # See #36268. 35 exportReferencesGraph = 36 map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents; 37 pathsFromGraph = ./paths-from-graph.pl; 38 39 inherit compressor prepend; 40}