Files
nixpkgs/pkgs/build-support/kernel/make-initrd.sh
Emily 38dec9fcff makeInitrd{,NG}: drop legacy U‐Boot image support
Now that ARMv5 no longer uses `uImage`, there’s no point in keeping
around support for this deprecated format that the rest of the NixOS
infrastructure doesn’t handle. Modern U‐Boot setups should not
be affected in any way by this.
2026-06-01 11:12:44 +10:00

40 lines
955 B
Bash

set -o pipefail
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
# Get the paths in the closure of `object'.
storePaths="$(cat $closureInfo/store-paths)"
# Paths in cpio archives *must* be relative, otherwise the kernel
# won't unpack 'em.
(cd root && cp -prP --parents $storePaths .)
# Put the closure in a gzipped cpio archive.
mkdir -p $out
for PREP in ${prepend[@]}; do
cat $PREP >> $out/initrd
done
(cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +)
(cd root && find * .[^.*] -print0 | sort -z | cpio --quiet -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd")
ln -s "initrd" "$out/initrd$extension"