2008-03-17 10:40:47 +00:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
objects=($objects)
|
|
|
|
symlinks=($symlinks)
|
|
|
|
suffices=($suffices)
|
|
|
|
|
|
|
|
mkdir root
|
|
|
|
|
|
|
|
# Needed for splash_helper, which gets run before init.
|
|
|
|
mkdir root/dev
|
|
|
|
mkdir root/sys
|
|
|
|
mkdir root/proc
|
|
|
|
|
|
|
|
|
|
|
|
for ((n = 0; n < ${#objects[*]}; n++)); do
|
|
|
|
object=${objects[$n]}
|
|
|
|
symlink=${symlinks[$n]}
|
|
|
|
suffix=${suffices[$n]}
|
|
|
|
if test "$suffix" = none; then suffix=; fi
|
|
|
|
|
|
|
|
mkdir -p $(dirname root/$symlink)
|
|
|
|
ln -s $object$suffix root/$symlink
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Paths in cpio archives *must* be relative, otherwise the kernel
|
|
|
|
# won't unpack 'em.
|
2018-02-08 12:56:54 +00:00
|
|
|
(cd root && cp -prd --parents $(cat $closure/store-paths) .)
|
2008-03-17 10:40:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Put the closure in a gzipped cpio archive.
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out
|
2015-03-25 19:03:03 +00:00
|
|
|
for PREP in $prepend; do
|
|
|
|
cat $PREP >> $out/initrd
|
|
|
|
done
|
2016-12-20 09:27:13 +00:00
|
|
|
(cd root && find * -print0 | xargs -0r touch -h -d '@1')
|
|
|
|
(cd root && find * -print0 | sort -z | cpio -o -H newc -R +0:+0 --reproducible --null | $compressor >> $out/initrd)
|
2009-11-08 00:32:12 +00:00
|
|
|
|
|
|
|
if [ -n "$makeUInitrd" ]; then
|
|
|
|
mv $out/initrd $out/initrd.gz
|
|
|
|
mkimage -A arm -O linux -T ramdisk -C gzip -d $out/initrd.gz $out/initrd
|
|
|
|
fi
|