build: implement kernel module dependency tracking
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 37386
This commit is contained in:
parent
6640b83a3e
commit
18840ae808
1 changed files with 10 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
SELF=${0##*/}
|
SELF=${0##*/}
|
||||||
|
|
||||||
READELF="${READELF:-readelf}"
|
READELF="${READELF:-readelf}"
|
||||||
|
OBJCOPY="${OBJCOPY:-objcopy}"
|
||||||
TARGETS=$*
|
TARGETS=$*
|
||||||
XARGS="${XARGS:-xargs -r}"
|
XARGS="${XARGS:-xargs -r}"
|
||||||
|
|
||||||
|
@ -22,3 +23,12 @@ find $TARGETS -type f -a -exec file {} \; | \
|
||||||
$XARGS -n1 readelf -d | \
|
$XARGS -n1 readelf -d | \
|
||||||
awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \
|
awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \
|
||||||
sort -u
|
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
|
||||||
|
|
Loading…
Reference in a new issue