diff options
Diffstat (limited to 'gen_initramfs.sh')
-rwxr-xr-x | gen_initramfs.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 30474700..40318a23 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -1,6 +1,7 @@ #!/bin/bash # $Id$ +COPY_BINARIES=false CPIO_ARGS="--quiet -o -H newc" # The copy_binaries function is explicitly released under the CC0 license to @@ -24,6 +25,8 @@ copy_binaries() { local destdir=$1 shift + COPY_BINARIES=true + for binary in "$@"; do [[ -e "${binary}" ]] \ || gen_die "Binary ${binary} could not be found" @@ -448,6 +451,28 @@ append_zfs(){ rm -rf "${TEMP}/initramfs-zfs-temp" > /dev/null } +append_linker() { + if [ -d "${TEMP}/initramfs-linker-temp" ] + then + rm -r "${TEMP}/initramfs-linker-temp" + fi + + mkdir -p "${TEMP}/initramfs-linker-temp/etc/ld.so.conf.d" + + cp "/etc/ld.so."{cache,conf} "${TEMP}/initramfs-linker-temp/etc/" 2> /dev/null \ + || gen_die "Could not copy ld.so.{cache,conf}" + + cp -r "/etc/ld.so.conf.d" "${TEMP}/initramfs-linker-temp/etc/" 2> /dev/null \ + || gen_die "Could not copy ld.so.conf.d" + + cd "${TEMP}/initramfs-linker-temp/" + log_future_cpio_content + find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ + || gen_die "compressing linker cpio" + cd "${TEMP}" + rm -rf "${TEMP}/initramfs-linker-temp" > /dev/null +} + append_splash(){ splash_geninitramfs=`which splash_geninitramfs 2>/dev/null` if [ -x "${splash_geninitramfs}" ] @@ -800,6 +825,11 @@ create_initramfs() { append_data 'overlay' fi + if ${COPY_BINARIES} + then + append_data 'linker' + fi + # Finalize cpio by removing duplicate files print_info 1 " >> Finalizing cpio..." local TDIR="${TEMP}/initramfs-final" |