1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tools/listlibs.sh Tue May 29 19:01:38 2018 +0200
1.3 @@ -0,0 +1,46 @@
1.4 +#!/bin/sh
1.5 +
1.6 +CONF="$1"
1.7 +
1.8 +if [ ! "$CONF" ] || [ ! -e "$CONF" ] ; then
1.9 + cat 1>&2 <<EOF
1.10 +Usage: $0 <configuration filename>
1.11 +
1.12 +List modules required by the given system/payload configuration. These modules
1.13 +should be added to the configuration file so that the dynamic linker can find
1.14 +them in the running system.
1.15 +EOF
1.16 + exit 1
1.17 +fi
1.18 +
1.19 +BIN=mybuild/bin/mips_32/l4f
1.20 +TMPLIBS=_libs.txt
1.21 +
1.22 +echo -n > "$TMPLIBS"
1.23 +
1.24 +for MODULE in `grep '^module ' "$CONF" | sed 's/module //'` ; do
1.25 + PROG=`basename "$MODULE" .cfg`
1.26 + if [ "$PROG" != "$MODULE" ] ; then
1.27 + continue
1.28 + fi
1.29 + PROG=`basename "$MODULE" .io`
1.30 + if [ "$PROG" != "$MODULE" ] ; then
1.31 + continue
1.32 + fi
1.33 + PROG=`basename "$MODULE" .so`
1.34 + if [ "$PROG" != "$MODULE" ] ; then
1.35 + continue
1.36 + fi
1.37 + if [ ! -e "$BIN/$PROG" ] ; then
1.38 + echo "Not found: $PROG" 1>&2
1.39 + exit 1
1.40 + fi
1.41 + mipsel-linux-gnu-readelf -d "$BIN/$PROG" | grep NEEDED | sed 's/.*\[//;s/\]$//' >> "$TMPLIBS"
1.42 +done
1.43 +
1.44 +# Explicitly add undetected module.
1.45 +
1.46 +echo "libl4sys-direct.so" >> "$TMPLIBS"
1.47 +
1.48 +sort -u "$TMPLIBS" | sed 's/^/module /'
1.49 +rm "$TMPLIBS"