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