3 # Copyright (C) 2012 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
10 READELF
="${READELF:-readelf}"
11 OBJCOPY
="${OBJCOPY:-objcopy}"
13 XARGS
="${XARGS:-xargs -r}"
15 [ -z "$TARGETS" ] && {
16 echo "$SELF: no directories / files specified"
17 echo "usage: $SELF [PATH...]"
21 find $TARGETS -type f
-a -exec file {} \
; | \
22 sed -n -e 's/^\(.*\):.*ELF.*\(executable\|shared object\).*,.* stripped/\1/p' | \
23 $XARGS -n1 $READELF -d | \
24 awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \
27 tmp
=`mktemp $TMP_DIR/dep.XXXXXXXX`
28 for kmod
in `find $TARGETS -type f -name \*.ko`; do
29 $OBJCOPY -O binary
-j .modinfo
$kmod $tmp
30 sed -e 's,\x00,\n,g' $tmp | \
31 sed -ne '/^depends=.\+/ { s/^depends=//; s/,/.ko\n/g; s/$/.ko/p; q }'