# HG changeset patch # User Paul Boddie # Date 1527613298 -7200 # Node ID b921e4f8cd4c8602b291a3bc5210ca140a6db5d0 # Parent b14943b6433cd99106ce6a935a541bc3b57713ba Added a script that attempts to show library module requirements for a payload. This also shows a library that will not be detected. diff -r b14943b6433c -r b921e4f8cd4c tools/listlibs.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/listlibs.sh Tue May 29 19:01:38 2018 +0200 @@ -0,0 +1,46 @@ +#!/bin/sh + +CONF="$1" + +if [ ! "$CONF" ] || [ ! -e "$CONF" ] ; then + cat 1>&2 < + +List modules required by the given system/payload configuration. These modules +should be added to the configuration file so that the dynamic linker can find +them in the running system. +EOF + exit 1 +fi + +BIN=mybuild/bin/mips_32/l4f +TMPLIBS=_libs.txt + +echo -n > "$TMPLIBS" + +for MODULE in `grep '^module ' "$CONF" | sed 's/module //'` ; do + PROG=`basename "$MODULE" .cfg` + if [ "$PROG" != "$MODULE" ] ; then + continue + fi + PROG=`basename "$MODULE" .io` + if [ "$PROG" != "$MODULE" ] ; then + continue + fi + PROG=`basename "$MODULE" .so` + if [ "$PROG" != "$MODULE" ] ; then + continue + fi + if [ ! -e "$BIN/$PROG" ] ; then + echo "Not found: $PROG" 1>&2 + exit 1 + fi + mipsel-linux-gnu-readelf -d "$BIN/$PROG" | grep NEEDED | sed 's/.*\[//;s/\]$//' >> "$TMPLIBS" +done + +# Explicitly add undetected module. + +echo "libl4sys-direct.so" >> "$TMPLIBS" + +sort -u "$TMPLIBS" | sed 's/^/module /' +rm "$TMPLIBS"