1 |
commit: 175087e2365e78480c61abd20e2cf465160d81d5 |
2 |
Author: Richard Yao <ryao <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 26 21:32:09 2013 +0000 |
4 |
Commit: Richard Yao <ryao <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 27 04:29:37 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=175087e2 |
7 |
|
8 |
Copy ld.so.conf and friends when copy_binaries is used |
9 |
|
10 |
This fixes "error while loading shared libraries libgcc_s.so.1 cannot |
11 |
open shared object file" when attempting to import a root pool on ARM. |
12 |
|
13 |
Signed-off-by: Richard Yao <ryao <AT> gentoo.org> |
14 |
|
15 |
--- |
16 |
gen_initramfs.sh | 30 ++++++++++++++++++++++++++++++ |
17 |
1 file changed, 30 insertions(+) |
18 |
|
19 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
20 |
index 3047470..40318a2 100755 |
21 |
--- a/gen_initramfs.sh |
22 |
+++ b/gen_initramfs.sh |
23 |
@@ -1,6 +1,7 @@ |
24 |
#!/bin/bash |
25 |
# $Id$ |
26 |
|
27 |
+COPY_BINARIES=false |
28 |
CPIO_ARGS="--quiet -o -H newc" |
29 |
|
30 |
# The copy_binaries function is explicitly released under the CC0 license to |
31 |
@@ -24,6 +25,8 @@ copy_binaries() { |
32 |
local destdir=$1 |
33 |
shift |
34 |
|
35 |
+ COPY_BINARIES=true |
36 |
+ |
37 |
for binary in "$@"; do |
38 |
[[ -e "${binary}" ]] \ |
39 |
|| gen_die "Binary ${binary} could not be found" |
40 |
@@ -448,6 +451,28 @@ append_zfs(){ |
41 |
rm -rf "${TEMP}/initramfs-zfs-temp" > /dev/null |
42 |
} |
43 |
|
44 |
+append_linker() { |
45 |
+ if [ -d "${TEMP}/initramfs-linker-temp" ] |
46 |
+ then |
47 |
+ rm -r "${TEMP}/initramfs-linker-temp" |
48 |
+ fi |
49 |
+ |
50 |
+ mkdir -p "${TEMP}/initramfs-linker-temp/etc/ld.so.conf.d" |
51 |
+ |
52 |
+ cp "/etc/ld.so."{cache,conf} "${TEMP}/initramfs-linker-temp/etc/" 2> /dev/null \ |
53 |
+ || gen_die "Could not copy ld.so.{cache,conf}" |
54 |
+ |
55 |
+ cp -r "/etc/ld.so.conf.d" "${TEMP}/initramfs-linker-temp/etc/" 2> /dev/null \ |
56 |
+ || gen_die "Could not copy ld.so.conf.d" |
57 |
+ |
58 |
+ cd "${TEMP}/initramfs-linker-temp/" |
59 |
+ log_future_cpio_content |
60 |
+ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ |
61 |
+ || gen_die "compressing linker cpio" |
62 |
+ cd "${TEMP}" |
63 |
+ rm -rf "${TEMP}/initramfs-linker-temp" > /dev/null |
64 |
+} |
65 |
+ |
66 |
append_splash(){ |
67 |
splash_geninitramfs=`which splash_geninitramfs 2>/dev/null` |
68 |
if [ -x "${splash_geninitramfs}" ] |
69 |
@@ -800,6 +825,11 @@ create_initramfs() { |
70 |
append_data 'overlay' |
71 |
fi |
72 |
|
73 |
+ if ${COPY_BINARIES} |
74 |
+ then |
75 |
+ append_data 'linker' |
76 |
+ fi |
77 |
+ |
78 |
# Finalize cpio by removing duplicate files |
79 |
print_info 1 " >> Finalizing cpio..." |
80 |
local TDIR="${TEMP}/initramfs-final" |