updated rockinitramfs to version 7 git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@8679 c5f82cb5-29bc-0310-9cd0-bff59a50e3bcrocklinux
@ -1,2 +1,4 @@ |
|||
/lib64 |
|||
/usr/lib64 |
|||
/lib |
|||
/usr/lib |
@ -1,25 +0,0 @@ |
|||
#!/bin/sh |
|||
|
|||
targetdir="`pwd`" |
|||
|
|||
find . -mindepth 1 -printf "%y %P %#m %U %G %l\n" \ |
|||
| while read type name filemod uid gid slink ; do |
|||
case "$type" in |
|||
b|c) |
|||
majorminor="$( file $name | sed -e "s,.*(\([0-9]*\)/\([0-9]*\))$,\1 \2," )" |
|||
echo "nod /$name $filemod $uid $gid $type $majorminor" |
|||
;; |
|||
d) |
|||
echo "dir /$name $filemod $uid $gid" |
|||
;; |
|||
f) |
|||
echo "file /$name $targetdir/$name $filemod $uid $gid" |
|||
;; |
|||
l) |
|||
echo "slink /$name $slink $filemod $uid $gid" |
|||
;; |
|||
p) |
|||
echo "pipe /$name $filemod $uid $gid" |
|||
;; |
|||
esac |
|||
done |
@ -0,0 +1,65 @@ |
|||
|
|||
export irfs_libexec_functions=1 |
|||
|
|||
# find dynamic (share library) dependencies for a binary |
|||
# honors $rootdir and emulates sort of chroot therin |
|||
needed_libs() { |
|||
local x y z library libqueue liblist libdirs |
|||
|
|||
# be sure to favor the 64bit locations |
|||
libdirs="$rootdir/lib64 $rootdir/usr/lib64 $rootdir/lib" |
|||
for N in `sed -e"s,^,${rootdir}," ${rootdir}/etc/ld.so.conf | tr '\n' ' '` ; do |
|||
[ -d "$N" ] && libdirs="$libdirs $N" |
|||
done |
|||
|
|||
libqueue="$( mktemp -t libqueue-XXXXXX )" |
|||
liblist="$( mktemp -d -t liblist-XXXXXX )" |
|||
|
|||
# initialize the queue with $* |
|||
for x ; do |
|||
echo "$rootdir/$x" |
|||
done > "$libqueue" |
|||
|
|||
# get the required libraries of each file |
|||
while read y ; do |
|||
${cross_compile}readelf -d "${y}" 2>/dev/null | grep "(NEEDED)" | |
|||
sed -e "s,.*Shared library: \[\(.*\)\],\1," | |
|||
while read library ; do |
|||
[ -e "$liblist/$library" ] && continue |
|||
|
|||
# use the first library with this name |
|||
find -L ${libdirs} -maxdepth 1 -name "${library}" 2>/dev/null | |
|||
head -n1 | |
|||
while read z ; do |
|||
# put the libraries found into the queue, because they might |
|||
# require other libraries themselves |
|||
echo "$z" >> "$libqueue" |
|||
echo "$z" | sed -e"s,^${rootdir},," |
|||
done |
|||
|
|||
# list this library as processed |
|||
touch "$liblist/$library" |
|||
done |
|||
done < "$libqueue" |
|||
rm -f "$libqueue" ; rm -rf "$liblist" |
|||
} |
|||
|
|||
# add a file ($1) to the contents-list of initramfs |
|||
# optionally you can give a different destination filename |
|||
# in $2 |
|||
# the output is a gen_init_cpio compatible list including all |
|||
# dynamic dependencies and the file itself. |
|||
add_with_deps() { |
|||
srcname=$1 ; shift |
|||
dstname=$srcname |
|||
[ -n "$1" ] && dstname=$1 |
|||
|
|||
echo "file $dstname $rootdir/$srcname 755 0 0" |
|||
needed_libs $srcname | while read lib |
|||
do |
|||
echo "file $lib $rootdir/$lib 755 0 0" |
|||
done |
|||
} |
|||
|
|||
export -f needed_libs |
|||
export -f add_with_deps |
@ -1,18 +0,0 @@ |
|||
#!/bin/sh |
|||
# |
|||
# find dynamic (share library) dependencies for a binary |
|||
# courtesy of rockinitrd package. |
|||
# |
|||
export rootdir="" |
|||
|
|||
export libdirs="${rootdir}/lib ${rootdir}/usr/lib" |
|||
|
|||
for x in $* |
|||
do |
|||
readelf -d $x 2>/dev/null | grep "(NEEDED)" | |
|||
sed -e"s,.*Shared library: \[\(.*\)\],\1," | |
|||
while read library ; do |
|||
find $libdirs -maxdepth 1 -name "$library" | head -n 1 | |
|||
sed -e "s,^$rootdir,,g" |
|||
done |
|||
done |