diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-07-18 10:47:05 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-07-18 10:47:05 +0000 |
commit | d2f3ca4c6e48070cc7c14b3a4821793220e36b3c (patch) | |
tree | 044cbd92a001cf2761d45ff89bdb6667f5b24d6f | |
parent | 37632c2b5079887c090fc2a918aa807b76b5a3f9 (diff) |
build: implement kernel module dependency tracking
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37386 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-x | scripts/gen-dependencies.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/gen-dependencies.sh b/scripts/gen-dependencies.sh index df8073ea33..f324ba6c44 100755 --- a/scripts/gen-dependencies.sh +++ b/scripts/gen-dependencies.sh @@ -8,6 +8,7 @@ SELF=${0##*/} READELF="${READELF:-readelf}" +OBJCOPY="${OBJCOPY:-objcopy}" TARGETS=$* XARGS="${XARGS:-xargs -r}" @@ -22,3 +23,12 @@ find $TARGETS -type f -a -exec file {} \; | \ $XARGS -n1 readelf -d | \ awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \ sort -u + +tmp=`mktemp $TMP_DIR/dep.XXXXXXXX` +for kmod in `find $TARGETS -type f -name \*.ko`; do + $OBJCOPY -O binary -j .modinfo $kmod $tmp + sed -e 's,\x00,\n,g' $tmp | \ + egrep -a '^depends=' | \ + sed -e 's,^depends=,,' -e 's/,/\n/g' | \ + awk '{ print $1 ".ko" }' +done |