Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. ROOT_IMG := /usr/src/root.img
  6. ELFTOAOUT := elftoaout
  7. hostprogs-y := piggyback btfixupprep
  8. targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout
  9. clean-files := System.map
  10. quiet_cmd_elftoaout = ELFTOAOUT $@
  11. cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
  12. quiet_cmd_piggy = PIGGY $@
  13. cmd_piggy = $(obj)/piggyback $(BITS) $@ System.map $(ROOT_IMG)
  14. quiet_cmd_strip = STRIP $@
  15. cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $< -o $@
  16. ifeq ($(CONFIG_SPARC32),y)
  17. quiet_cmd_btfix = BTFIX $@
  18. cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
  19. quiet_cmd_sysmap = SYSMAP $(obj)/System.map
  20. cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
  21. quiet_cmd_image = LD $@
  22. cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
  23. define 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
  35. endef
  36. BTOBJS := $(patsubst %/, %/built-in.o, $(VMLINUX_INIT))
  37. BTLIBS := $(patsubst %/, %/built-in.o, $(VMLINUX_MAIN))
  38. LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
  39. --start-group $(BTLIBS) --end-group \
  40. $(kallsyms.o) $(obj)/btfix.o
  41. # Link the final image including btfixup'ed symbols.
  42. # This is a replacement for the link done in the top-level Makefile.
  43. # Note: No dependency on the prerequisite files since that would require
  44. # make to try check if they are updated - and due to changes
  45. # in gcc options (path for example) this would result in
  46. # these files being recompiled for each build.
  47. $(obj)/image: $(obj)/btfix.o FORCE
  48. $(call if_changed_rule,image)
  49. $(obj)/zImage: $(obj)/image
  50. $(call if_changed,strip)
  51. @echo ' kernel: $@ is ready'
  52. $(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
  53. $(call if_changed,btfix)
  54. endif
  55. ifeq ($(CONFIG_SPARC64),y)
  56. # Actual linking
  57. $(obj)/image: vmlinux FORCE
  58. $(call if_changed,strip)
  59. @echo ' kernel: $@ is ready'
  60. $(obj)/zImage: $(obj)/image
  61. $(call if_changed,gzip)
  62. @echo ' kernel: $@ is ready'
  63. $(obj)/vmlinux.aout: vmlinux FORCE
  64. $(call if_changed,elftoaout)
  65. @echo ' kernel: $@ is ready'
  66. else
  67. # The following lines make a readable image for U-Boot.
  68. # uImage - Binary file read by U-boot
  69. # uImage.o - object file of uImage for loading with a
  70. # flash programmer understanding ELF.
  71. OBJCOPYFLAGS_image.bin := -S -O binary -R .note -R .comment
  72. $(obj)/image.bin: $(obj)/image FORCE
  73. $(call if_changed,objcopy)
  74. $(obj)/image.gz: $(obj)/image.bin
  75. $(call if_changed,gzip)
  76. UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR)
  77. UIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)
  78. UIMAGE_COMPRESSION = gzip
  79. quiet_cmd_uimage.o = UIMAGE.O $@
  80. cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \
  81. -r -b binary $@ -o $@.o
  82. targets += uImage
  83. $(obj)/uImage: $(obj)/image.gz
  84. $(call if_changed,uimage)
  85. $(call if_changed,uimage.o)
  86. @echo ' Image $@ is ready'
  87. endif
  88. $(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE
  89. $(call if_changed,elftoaout)
  90. $(call if_changed,piggy)