Browse Source

Tobias Hintze:

updated rockinitramfs to version 7



git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@8679 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
rocklinux
Tobias Hintze 17 years ago
parent
commit
7171dc8ef0
10 changed files with 100 additions and 109 deletions
  1. +3
    -0
      package/teha/rockinitramfs/build.d/00-skel
  2. +8
    -1
      package/teha/rockinitramfs/build.d/50-debug-bins
  3. +2
    -0
      package/teha/rockinitramfs/files/etc/ld.so.conf
  4. +0
    -25
      package/teha/rockinitramfs/libexec/99-finish
  5. +19
    -62
      package/teha/rockinitramfs/libexec/build-list.sh
  6. +65
    -0
      package/teha/rockinitramfs/libexec/functions
  7. +0
    -18
      package/teha/rockinitramfs/libexec/list-deps.sh
  8. +1
    -0
      package/teha/rockinitramfs/libexec/mkinitramfs.sh
  9. +1
    -2
      package/teha/rockinitramfs/rockinitramfs.conf
  10. +1
    -1
      package/teha/rockinitramfs/rockinitramfs.desc

+ 3
- 0
package/teha/rockinitramfs/build.d/00-skel

@ -25,6 +25,9 @@ dir /bin 0755 0 0
dir /sbin 0755 0 0
dir /etc 0755 0 0
dir /lib 0755 0 0
dir /lib64 0755 0 0
dir /usr 0755 0 0
slink /usr/lib64 /lib64 0755 0 0
dir /media 0755 0 0
dir /mnt 0755 0 0
dir /proc 0755 0 0

+ 8
- 1
package/teha/rockinitramfs/build.d/50-debug-bins

@ -2,13 +2,20 @@
BINLIST="
bin/ps bin/df bin/mkdir bin/more usr/bin/less sbin/fdisk usr/sbin/disktype
bin/cpio bin/gzip usr/bin/wc usr/bin/od sbin/mkfs.xfs bin/rmdir usr/bin/lsmod sbin/depmod
bin/cpio bin/gzip usr/bin/wc usr/bin/od
bin/rmdir usr/bin/lsmod sbin/depmod
usr/sbin/lspci sbin/ip bin/dmesg
usr/bin/mkfifo
sbin/ldconfig
usr/bin/id
usr/sbin/groupadd
sbin/mkfs.xfs
sbin/mkfs.ext2
sbin/mkfs.ext3
sbin/fsck.ext2
"
for x in $BINLIST

+ 2
- 0
package/teha/rockinitramfs/files/etc/ld.so.conf

@ -1,2 +1,4 @@
/lib64
/usr/lib64
/lib
/usr/lib

+ 0
- 25
package/teha/rockinitramfs/libexec/99-finish

@ -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

+ 19
- 62
package/teha/rockinitramfs/libexec/build-list.sh

@ -3,68 +3,25 @@
# shall be called by mkinitramfs.sh only.
# sources each file in ./build.d/
#!/bin/sh
#
# find dynamic (share library) dependencies for a binary
# courtesy of rockinitrd package.
#
libdirs=""
for N in ${rootdir}/lib `sed -e"s,^,${rootdir}," ${rootdir}/etc/ld.so.conf | tr '\n' ' '` ; do
[ -d "$N" ] && libdirs="$libdirs $N"
done
needed_libs() {
local x y z library libqueue liblist
libqueue="$( mktemp -t libqueue-XXXXXX )"
liblist="$( mktemp -d -t liblist-XXXXXX )"
# initialize the queue
for x ; do
echo "$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 ${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"
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 $srcname 755 0 0"
needed_libs $srcname | while read lib
do
echo "file /lib/`basename $lib` $lib 755 0 0"
done
}
if [ -z "$irfs_libexec_functions" ]
then
echo "sorry - some required functions are not declared."
echo "you need to source the 'functions' script first."
echo "try: source `dirname $0`/functions"
exit 1
fi
if [ -z "$builddir" ]
then
echo "\$builddir variable is not set."
exit 1
fi
if [ -z "$TMPDIR" ]
then
echo "\$TMPDIR variable is not set."
exit 1
fi
mkdir -pv $TMPDIR/targetdir

+ 65
- 0
package/teha/rockinitramfs/libexec/functions

@ -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

+ 0
- 18
package/teha/rockinitramfs/libexec/list-deps.sh

@ -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

+ 1
- 0
package/teha/rockinitramfs/libexec/mkinitramfs.sh

@ -159,6 +159,7 @@ export TMPDIR="/tmp/irfs-`date +%s`.$$"
mkdir -pv $TMPDIR
# compile our list of cpio-content
. ${libexecdir}/functions
${libexecdir}/build-list.sh > ${TMPDIR}/list
echo "$additional_gen_lines" | tr ';' '\n' >> ${TMPDIR}/list

+ 1
- 2
package/teha/rockinitramfs/rockinitramfs.conf

@ -28,9 +28,8 @@ build_main() {
$CC ${confdir}/libexec/gen_init_cpio.c -o $INST_DIR/libexec/gen_init_cpio
install -m 755 ${confdir}/libexec/functions ${INST_DIR}/libexec/
install -m 755 ${confdir}/libexec/build-list.sh ${INST_DIR}/libexec/
install -m 755 ${confdir}/libexec/list-deps.sh ${INST_DIR}/libexec/
install -m 755 ${confdir}/libexec/99-finish ${INST_DIR}/libexec/
install -m 755 ${confdir}/libexec/mkinitramfs.sh ${root}/usr/sbin/mkinitramfs

+ 1
- 1
package/teha/rockinitramfs/rockinitramfs.desc

@ -34,6 +34,6 @@
[L] GPL
[S] Stable
[V] 5
[V] 7
[P] X -X---5---9 236.500

Loading…
Cancel
Save