diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-07-18 10:47:05 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-07-18 10:47:05 +0000 |
commit | 18840ae8081fbac61b3d1ed4bdaefac46c1d3892 (patch) | |
tree | 752d6f043bbb6976897f69ef1c48ebbf5d16bc5f /scripts | |
parent | 6640b83a3ed626b6c233a48b9f271a52b5ffb980 (diff) | |
download | upstream-18840ae8081fbac61b3d1ed4bdaefac46c1d3892.tar.gz upstream-18840ae8081fbac61b3d1ed4bdaefac46c1d3892.tar.bz2 upstream-18840ae8081fbac61b3d1ed4bdaefac46c1d3892.zip |
build: implement kernel module dependency tracking
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 37386
Diffstat (limited to 'scripts')
-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 |