summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-05-20 04:35:14 -0400
committerWolfgang Denk <wd@denx.de>2009-06-12 20:45:48 +0200
commitecb1dc892297d5d99876907328fed732feefeab2 (patch)
tree60f14fd9310612bb4ee23d819d9f8fad859beda7 /Makefile
parent36c9169aa6f79ddf604a3bca64e145654f94888b (diff)
downloadu-boot-imx-ecb1dc892297d5d99876907328fed732feefeab2.zip
u-boot-imx-ecb1dc892297d5d99876907328fed732feefeab2.tar.gz
u-boot-imx-ecb1dc892297d5d99876907328fed732feefeab2.tar.bz2
Add support for Linux-like kallsysms
The kernel stores address<->symbol names in it so things can be decoded at runtime. Do it in U-Boot, and we get nice symbol decoding when crashing. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 13 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index d146780..4445b4b 100644
--- a/Makefile
+++ b/Makefile
@@ -344,12 +344,19 @@ $(obj)u-boot.sha1: $(obj)u-boot.bin
$(obj)u-boot.dis: $(obj)u-boot
$(OBJDUMP) -d $< > $@
-$(obj)u-boot: depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
+GEN_UBOOT = \
UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
-Map u-boot.map -o u-boot
+$(obj)u-boot: depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
+ $(GEN_UBOOT)
+ifeq ($(CONFIG_KALLSYMS),y)
+ smap=`$(call SYSTEM_MAP,u-boot) | awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\0"}'` ; \
+ $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" -c common/system_map.c -o $(obj)common/system_map.o
+ $(GEN_UBOOT) $(obj)common/system_map.o
+endif
$(OBJS): depend
$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
@@ -448,10 +455,12 @@ cscope:
> cscope.files
cscope -b -q -k
-$(obj)System.map: $(obj)u-boot
- @$(NM) $< | \
+SYSTEM_MAP = \
+ $(NM) $1 | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
- sort > $(obj)System.map
+ LC_ALL=C sort
+$(obj)System.map: $(obj)u-boot
+ @$(call SYSTEM_MAP,$<) > $(obj)System.map
#
# Auto-generate the autoconf.mk file (which is included by all makefiles)