Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #
  2. # This file is subject to the terms and conditions of the GNU General Public
  3. # License. See the file "COPYING" in the main directory of this archive
  4. # for more details.
  5. #
  6. # Copyright (C) 1995, 1998, 2001, 2002 by Ralf Baechle
  7. # Copyright (C) 2004 Maciej W. Rozycki
  8. #
  9. #
  10. # Some DECstations need all possible sections of an ECOFF executable
  11. #
  12. ifdef CONFIG_MACH_DECSTATION
  13. e2eflag := -a
  14. endif
  15. #
  16. # Drop some uninteresting sections in the kernel.
  17. # This is only relevant for ELF kernels but doesn't hurt a.out
  18. #
  19. drop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
  20. strip-flags := $(addprefix --remove-section=,$(drop-sections))
  21. hostprogs-y := elf2ecoff
  22. suffix-y := bin
  23. suffix-$(CONFIG_KERNEL_BZIP2) := bz2
  24. suffix-$(CONFIG_KERNEL_GZIP) := gz
  25. suffix-$(CONFIG_KERNEL_LZMA) := lzma
  26. suffix-$(CONFIG_KERNEL_LZO) := lzo
  27. targets := vmlinux.ecoff
  28. quiet_cmd_ecoff = ECOFF $@
  29. cmd_ecoff = $(obj)/elf2ecoff $(VMLINUX) $@ $(e2eflag)
  30. $(obj)/vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) FORCE
  31. $(call if_changed,ecoff)
  32. targets += vmlinux.bin
  33. quiet_cmd_bin = OBJCOPY $@
  34. cmd_bin = $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $@
  35. $(obj)/vmlinux.bin: $(VMLINUX) FORCE
  36. $(call if_changed,bin)
  37. targets += vmlinux.srec
  38. quiet_cmd_srec = OBJCOPY $@
  39. cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
  40. $(obj)/vmlinux.srec: $(VMLINUX) FORCE
  41. $(call if_changed,srec)
  42. UIMAGE_LOADADDR = $(VMLINUX_LOAD_ADDRESS)
  43. UIMAGE_ENTRYADDR = $(VMLINUX_ENTRY_ADDRESS)
  44. #
  45. # Compressed vmlinux images
  46. #
  47. extra-y += vmlinux.bin.bz2
  48. extra-y += vmlinux.bin.gz
  49. extra-y += vmlinux.bin.lzma
  50. extra-y += vmlinux.bin.lzo
  51. $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
  52. $(call if_changed,bzip2)
  53. $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
  54. $(call if_changed,gzip)
  55. $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
  56. $(call if_changed,lzma)
  57. $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
  58. $(call if_changed,lzo)
  59. #
  60. # Compressed u-boot images
  61. #
  62. targets += uImage
  63. targets += uImage.bin
  64. targets += uImage.bz2
  65. targets += uImage.gz
  66. targets += uImage.lzma
  67. targets += uImage.lzo
  68. $(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
  69. $(call if_changed,uimage,none)
  70. $(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE
  71. $(call if_changed,uimage,bzip2)
  72. $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
  73. $(call if_changed,uimage,gzip)
  74. $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
  75. $(call if_changed,uimage,lzma)
  76. $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
  77. $(call if_changed,uimage,lzo)
  78. $(obj)/uImage: $(obj)/uImage.$(suffix-y)
  79. @ln -sf $(notdir $<) $@
  80. @echo ' Image $@ is ready'
  81. #
  82. # Flattened Image Tree (.itb) images
  83. #
  84. ifeq ($(ADDR_BITS),32)
  85. itb_addr_cells = 1
  86. endif
  87. ifeq ($(ADDR_BITS),64)
  88. itb_addr_cells = 2
  89. endif
  90. targets += vmlinux.its.S
  91. quiet_cmd_its_cat = CAT $@
  92. cmd_its_cat = cat $(filter-out $(PHONY), $^) >$@
  93. $(obj)/vmlinux.its.S: $(addprefix $(srctree)/arch/mips/$(PLATFORM)/,$(ITS_INPUTS)) FORCE
  94. $(call if_changed,its_cat)
  95. targets += vmlinux.its
  96. targets += vmlinux.gz.its
  97. targets += vmlinux.bz2.its
  98. targets += vmlinux.lzma.its
  99. targets += vmlinux.lzo.its
  100. quiet_cmd_cpp_its_S = ITS $@
  101. cmd_cpp_its_S = $(CPP) -P -C -o $@ $< \
  102. -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
  103. -DVMLINUX_BINARY="\"$(3)\"" \
  104. -DVMLINUX_COMPRESSION="\"$(2)\"" \
  105. -DVMLINUX_LOAD_ADDRESS=$(VMLINUX_LOAD_ADDRESS) \
  106. -DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS) \
  107. -DADDR_BITS=$(ADDR_BITS) \
  108. -DADDR_CELLS=$(itb_addr_cells)
  109. $(obj)/vmlinux.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
  110. $(call if_changed,cpp_its_S,none,vmlinux.bin)
  111. $(obj)/vmlinux.gz.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
  112. $(call if_changed,cpp_its_S,gzip,vmlinux.bin.gz)
  113. $(obj)/vmlinux.bz2.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
  114. $(call if_changed,cpp_its_S,bzip2,vmlinux.bin.bz2)
  115. $(obj)/vmlinux.lzma.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
  116. $(call if_changed,cpp_its_S,lzma,vmlinux.bin.lzma)
  117. $(obj)/vmlinux.lzo.its: $(obj)/vmlinux.its.S $(VMLINUX) FORCE
  118. $(call if_changed,cpp_its_S,lzo,vmlinux.bin.lzo)
  119. targets += vmlinux.itb
  120. targets += vmlinux.gz.itb
  121. targets += vmlinux.bz2.itb
  122. targets += vmlinux.lzma.itb
  123. targets += vmlinux.lzo.itb
  124. quiet_cmd_itb-image = ITB $@
  125. cmd_itb-image = \
  126. env PATH="$(objtree)/scripts/dtc:$(PATH)" \
  127. $(CONFIG_SHELL) $(MKIMAGE) \
  128. -D "-I dts -O dtb -p 500 \
  129. --include $(objtree)/arch/mips \
  130. --warning no-unit_address_vs_reg" \
  131. -f $(2) $@
  132. $(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE
  133. $(call if_changed,itb-image,$<)
  134. $(obj)/vmlinux.%.itb: $(obj)/vmlinux.%.its $(obj)/vmlinux.bin.% FORCE
  135. $(call if_changed,itb-image,$<)