1source $stdenv/setup
2
3set -o pipefail
4
5objects=($objects)
6symlinks=($symlinks)
7suffices=($suffices)
8
9mkdir root
10
11# Needed for splash_helper, which gets run before init.
12mkdir root/dev
13mkdir root/sys
14mkdir root/proc
15
16
17for ((n = 0; n < ${#objects[*]}; n++)); do
18 object=${objects[$n]}
19 symlink=${symlinks[$n]}
20 suffix=${suffices[$n]}
21 if test "$suffix" = none; then suffix=; fi
22
23 mkdir -p $(dirname root/$symlink)
24 ln -s $object$suffix root/$symlink
25done
26
27
28# Get the paths in the closure of `object'.
29storePaths=$(perl $pathsFromGraph closure-*)
30
31
32# Paths in cpio archives *must* be relative, otherwise the kernel
33# won't unpack 'em.
34(cd root && cp -prd --parents $storePaths .)
35
36
37# Put the closure in a gzipped cpio archive.
38mkdir -p $out
39for PREP in $prepend; do
40 cat $PREP >> $out/initrd
41done
42(cd root && find * -print0 | cpio -o -H newc --null | perl $cpioClean | $compressor >> $out/initrd)
43
44if [ -n "$makeUInitrd" ]; then
45 mv $out/initrd $out/initrd.gz
46 mkimage -A arm -O linux -T ramdisk -C gzip -d $out/initrd.gz $out/initrd
47fi