Commit a66dcfe1 authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild/sparc: Use new generic mksysmap script to generate System.map

o Introduced usage of the mksysmap script.
o Improved the non-verbose output to look like this:
  BTFIX   arch/sparc/boot/btfix.S
  AS      arch/sparc/boot/btfix.o
  LD      arch/sparc/boot/image
  SYSMAP  arch/sparc/boot/System.map

o No longer generate System.map for each build
o Use normal AS rule to compile btfix.S
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 1d3fa84d
......@@ -8,27 +8,51 @@ ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout
host-progs := piggyback btfixupprep
targets := tftpboot.img btfix.o btfix.s image
targets := tftpboot.img btfix.o btfix.S image
quiet_cmd_elftoaout = ELFTOAOUT $@
cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
quiet_cmd_piggy = PIGGY $@
quiet_cmd_piggy = PIGGY $@
cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
quiet_cmd_btfix = BTFIX $@
quiet_cmd_btfix = BTFIX $@
cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
quiet_cmd_sysmap = SYSMAP $(obj)/System.map
cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
quiet_cmd_image = LD $@
cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
define rule_image
$(if $($(quiet)cmd_image), \
echo ' $($(quiet)cmd_image)' &&) \
$(cmd_image); \
$(if $($(quiet)cmd_sysmap), \
echo ' $($(quiet)cmd_sysmap)' &&) \
$(cmd_sysmap) $@ $(obj)/System.map; \
if [ $$? -ne 0 ]; then \
rm -f $@; \
/bin/false; \
fi; \
echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
endef
BTOBJS := $(HEAD_Y) $(INIT_Y)
BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) --start-group $(BTLIBS) --end-group $(kallsyms.o)
LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) \
--start-group $(BTLIBS) --end-group \
$(kallsyms.o) $(obj)/btfix.o
# Actual linking
# Link the final image including btfixup'ed symbols.
# This is a replacement for the link done in the top-level Makefile.
# Note: No dependency on the prerequisite files since that would require
# make to try check if they are updated - and due to changes
# in gcc options (path for example) this would result in
# these files being recompiled for each build.
$(obj)/image: $(obj)/btfix.o FORCE
$(call if_changed,ld)
$(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(obj)/System.map
$(call if_changed_rule,image)
$(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
$(call if_changed,elftoaout)
$(call if_changed,piggy)
$(obj)/btfix.s: $(obj)/btfixupprep vmlinux FORCE
$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
$(call if_changed,btfix)
......@@ -18,7 +18,7 @@
# they are used by the sparc BTFIXUP logic - and is assumed to be undefined.
if [ "`$NM -u $1 | grep -v ' ____'`" != "" ]; then
if [ "`$NM -u $1 | grep -v ' ___'`" != "" ]; then
echo "$1: error: undefined symbol(s) found:"
$NM -u $1 | grep -v ' ___'
exit 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment