1 # Makefile for the Sparc boot stuff.
3 # Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
4 # Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
6 ROOT_IMG := /usr/src/root.img
9 hostprogs-y := piggyback btfixupprep
10 targets := tftpboot.img btfix.o btfix.S image
12 quiet_cmd_elftoaout = ELFTOAOUT $@
13 cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
14 quiet_cmd_piggy = PIGGY $@
15 cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
16 quiet_cmd_btfix = BTFIX $@
17 cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
18 quiet_cmd_sysmap = SYSMAP $(obj)/System.map
19 cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
20 quiet_cmd_image = LD $@
21 cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
22 quiet_cmd_strip = STRIP $@
23 cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $(obj)/image -o $@
27 $(if $($(quiet)cmd_image), \
28 echo ' $($(quiet)cmd_image)' &&) \
30 $(if $($(quiet)cmd_sysmap), \
31 echo ' $($(quiet)cmd_sysmap)' &&) \
32 $(cmd_sysmap) $@ $(obj)/System.map; \
33 if [ $$? -ne 0 ]; then \
37 echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
40 BTOBJS := $(HEAD_Y) $(INIT_Y)
41 BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
42 LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
43 --start-group $(BTLIBS) --end-group \
44 $(kallsyms.o) $(obj)/btfix.o
46 # Link the final image including btfixup'ed symbols.
47 # This is a replacement for the link done in the top-level Makefile.
48 # Note: No dependency on the prerequisite files since that would require
49 # make to try check if they are updated - and due to changes
50 # in gcc options (path for example) this would result in
51 # these files being recompiled for each build.
52 $(obj)/image: $(obj)/btfix.o FORCE
53 $(call if_changed_rule,image)
55 $(obj)/zImage: $(obj)/image
56 $(call if_changed,strip)
58 $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
59 $(call if_changed,elftoaout)
60 $(call if_changed,piggy)
62 $(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
63 $(call if_changed,btfix)