| Line | |
|---|
| 1 | # $FreeWRT$
|
|---|
| 2 | #-
|
|---|
| 3 | # This file is part of the FreeWRT project. FreeWRT is copyrighted
|
|---|
| 4 | # material, please see the LICENCE file in the top-level directory
|
|---|
| 5 | # or at http://www.freewrt.org/licence for details.
|
|---|
| 6 |
|
|---|
| 7 | shopt -s extglob
|
|---|
| 8 |
|
|---|
| 9 | SELF=${0##*/}
|
|---|
| 10 |
|
|---|
| 11 | if [[ -z $prefix ]]; then
|
|---|
| 12 | echo >&2 "$SELF: strip command not defined ('prefix' variable not set)"
|
|---|
| 13 | exit 1
|
|---|
| 14 | fi
|
|---|
| 15 |
|
|---|
| 16 | TARGETS=$*
|
|---|
| 17 |
|
|---|
| 18 | if [[ -z $TARGETS ]]; then
|
|---|
| 19 | echo >&2 "$SELF: no directories / files specified"
|
|---|
| 20 | echo >&2 "usage: $SELF [PATH...]"
|
|---|
| 21 | exit 1
|
|---|
| 22 | fi
|
|---|
| 23 |
|
|---|
| 24 | find $TARGETS -type f -a -exec file {} \; | \
|
|---|
| 25 | sed -n -e 's/^\(.*\):.*ELF.*\(executable\|relocatable\|shared object\).*, not stripped/\1:\2/p' |
|
|---|
| 26 | while IFS=: read F S; do
|
|---|
| 27 | T="${prefix}strip -R .comment"
|
|---|
| 28 | if [[ $F = */lib/modules/2.*.@(o|ko) ]]; then
|
|---|
| 29 | S="kernel module $S"
|
|---|
| 30 | # kernel module parametres must not be stripped off
|
|---|
| 31 | T="$T --strip-unneeded $(echo $(${prefix}nm $F | \
|
|---|
| 32 | sed -n -e '/__param_/s/^.*__param_/-K /p' \
|
|---|
| 33 | -e '/__module_parm_/s/^.*__module_parm_/-K /p'))"
|
|---|
| 34 | fi
|
|---|
| 35 | echo "$SELF: $F:$S"
|
|---|
| 36 | # The following line intentionally left in to prove
|
|---|
| 37 | # to n0-1@ that I do test my changes… yes it works.
|
|---|
| 38 | #echo "D: $T $F"
|
|---|
| 39 | eval "$T $F"
|
|---|
| 40 | done
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.