From ecb1dc892297d5d99876907328fed732feefeab2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 20 May 2009 04:35:14 -0400 Subject: 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 --- Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d14678070e..4445b4b6a3 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) -- cgit v1.2.1