at master 1.2 kB view raw
1set -o pipefail 2 3objects=($objects) 4symlinks=($symlinks) 5suffices=($suffices) 6 7mkdir root 8 9# Needed for splash_helper, which gets run before init. 10mkdir root/dev 11mkdir root/sys 12mkdir root/proc 13 14 15for ((n = 0; n < ${#objects[*]}; n++)); do 16 object=${objects[$n]} 17 symlink=${symlinks[$n]} 18 suffix=${suffices[$n]} 19 if test "$suffix" = none; then suffix=; fi 20 21 mkdir -p $(dirname root/$symlink) 22 ln -s $object$suffix root/$symlink 23done 24 25 26# Get the paths in the closure of `object'. 27storePaths="$(cat $closureInfo/store-paths)" 28 29 30# Paths in cpio archives *must* be relative, otherwise the kernel 31# won't unpack 'em. 32(cd root && cp -prP --parents $storePaths .) 33 34 35# Put the closure in a gzipped cpio archive. 36mkdir -p $out 37for PREP in $prepend; do 38 cat $PREP >> $out/initrd 39done 40(cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +) 41(cd root && find * .[^.*] -print0 | sort -z | cpio --quiet -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd") 42 43if [ -n "$makeUInitrd" ]; then 44 mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img 45 # Compatibility symlink 46 ln -sf "initrd.img" "$out/initrd" 47else 48 ln -s "initrd" "$out/initrd$extension" 49fi