source: freewrt/scripts/rstrip.sh@ e840b97

Last change on this file since e840b97 was 7c9f6ae, checked in by Thorsten Glaser <tg@…>, 19 years ago

nbd (from OpenWrt) says via IRC that Linux 2.6 module parametres are
prefixed by a different value; adapt the script

tested for broadcom-wl on 2.4

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1925 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 1.1 KB
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
7shopt -s extglob
8
9SELF=${0##*/}
10
11if [[ -z $prefix ]]; then
12 echo >&2 "$SELF: strip command not defined ('prefix' variable not set)"
13 exit 1
14fi
15
16TARGETS=$*
17
18if [[ -z $TARGETS ]]; then
19 echo >&2 "$SELF: no directories / files specified"
20 echo >&2 "usage: $SELF [PATH...]"
21 exit 1
22fi
23
24find $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"
40done
Note: See TracBrowser for help on using the repository browser.