2 # Based on the relocatable vmlinux file and offset create the
3 # new vmlinux and System.map file. New vmlinux and System.map is
4 # intend to be used by debugging tools to retrieve the actual
5 # addresses of symbols in the kernel.
8 # mksysmap vmlinux-old offset
10 # Author : Jia Ma (jia.ma@samsung.com)
11 # Created on : 21 Sep 2015
12 # Copyright (c) Samsung Electronics 2015
14 if test $# -ne 2; then
15 echo "Usage: $0 vmlinux offset"
23 if [[ -z "$offset" ||
-z "$vmlinux" ]]; then
24 echo "$0 : variable not set"
28 if [[ ! -f $vmlinux ]]; then
29 echo "$vmlinux file not exist!"
34 OBJCOPY
=$ARM_TOOLCHAIN-objcopy
36 if [[ -z "$ARM_TOOLCHAIN" ]]; then
37 echo "Please specify ARM toolchain"
41 echo "+Patching System.map --> System.map.patched"
42 ### generate runtime System.map file¡¡###
43 $OBJCOPY --adjust-vma $offset $vmlinux vmlinux.tmp
2>/dev
/null
44 $NM -n vmlinux.tmp |
grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > System.map.patched
47 echo "+Patching $vmlinux -->vmlinux.patched"
48 # following simply change the vmlinux from DYN type to EXEC type
49 # to avoid the JTag load the dyn symbol into the system: e.g. there will be 2 start_kernel in the JTag symbol list, 1 from SYMBOL table, 1 from RELO section
50 if [[ ! -f "elfedit" ]]; then
51 echo "Can find elfedit"
55 cp vmlinux vmlinux.patched
56 elfedit
--output-type exec vmlinux.patched