diff options
author | Richard Yao <ryao@gentoo.org> | 2013-08-26 17:32:09 -0400 |
---|---|---|
committer | Richard Yao <ryao@gentoo.org> | 2014-02-26 23:29:37 -0500 |
commit | 175087e2365e78480c61abd20e2cf465160d81d5 (patch) | |
tree | 5f0744f5e49ed7600ec760cd4a2ca2f341bbbf9f | |
parent | Detect grub2-mkconfig failure (diff) | |
download | genkernel-175087e2365e78480c61abd20e2cf465160d81d5.tar.gz genkernel-175087e2365e78480c61abd20e2cf465160d81d5.tar.bz2 genkernel-175087e2365e78480c61abd20e2cf465160d81d5.zip |
Copy ld.so.conf and friends when copy_binaries is used
This fixes "error while loading shared libraries libgcc_s.so.1 cannot
open shared object file" when attempting to import a root pool on ARM.
Signed-off-by: Richard Yao <ryao@gentoo.org>
-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 3047470..40318a2 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" |