Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh -x
0002 # Based on the vmlinux file create the System.map file
0003 # System.map is used by module-init tools and some debugging
0004 # tools to retrieve the actual addresses of symbols in the kernel.
0005 #
0006 # Usage
0007 # mksysmap vmlinux System.map
0008 
0009 
0010 #####
0011 # Generate System.map (actual filename passed as second argument)
0012 
0013 # $NM produces the following output:
0014 # f0081e80 T alloc_vfsmnt
0015 
0016 #   The second row specify the type of the symbol:
0017 #   A = Absolute
0018 #   B = Uninitialised data (.bss)
0019 #   C = Common symbol
0020 #   D = Initialised data
0021 #   G = Initialised data for small objects
0022 #   I = Indirect reference to another symbol
0023 #   N = Debugging symbol
0024 #   R = Read only
0025 #   S = Uninitialised data for small objects
0026 #   T = Text code symbol
0027 #   U = Undefined symbol
0028 #   V = Weak symbol
0029 #   W = Weak symbol
0030 #   Corresponding small letters are local symbols
0031 
0032 # For System.map filter away:
0033 #   a - local absolute symbols
0034 #   U - undefined global symbols
0035 #   N - debugging symbols
0036 #   w - local weak symbols
0037 
0038 # readprofile starts reading symbols when _stext is found, and
0039 # continue until it finds a symbol which is not either of 'T', 't',
0040 # 'W' or 'w'. __crc_ are 'A' and placed in the middle
0041 # so we just ignore them to let readprofile continue to work.
0042 # (At least sparc64 has __crc_ in the middle).
0043 
0044 $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)\|\( L0\)' > $2