Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. targets += vmlinux.itb
  85. targets += vmlinux.gz.itb
  86. targets += vmlinux.bz2.itb
  87. targets += vmlinux.lzma.itb
  88. targets += vmlinux.lzo.itb
  89. ifeq ($(ADDR_BITS),32)
  90. itb_addr_cells = 1
  91. endif
  92. ifeq ($(ADDR_BITS),64)
  93. itb_addr_cells = 2
  94. endif
  95. quiet_cmd_cpp_its_S = ITS $@
  96. cmd_cpp_its_S = $(CPP) $(cpp_flags) -P -C -o $@ $< \
  97. -DKERNEL_NAME="\"Linux $(KERNELRELEASE)\"" \
  98. -DVMLINUX_BINARY="\"$(3)\"" \
  99. -DVMLINUX_COMPRESSION="\"$(2)\"" \
  100. -DVMLINUX_LOAD_ADDRESS=$(VMLINUX_LOAD_ADDRESS) \
  101. -DVMLINUX_ENTRY_ADDRESS=$(VMLINUX_ENTRY_ADDRESS) \
  102. -DADDR_BITS=$(ADDR_BITS) \
  103. -DADDR_CELLS=$(itb_addr_cells)
  104. $(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
  105. $(call if_changed_dep,cpp_its_S,none,vmlinux.bin)
  106. $(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
  107. $(call if_changed_dep,cpp_its_S,gzip,vmlinux.bin.gz)
  108. $(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
  109. $(call if_changed_dep,cpp_its_S,bzip2,vmlinux.bin.bz2)
  110. $(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
  111. $(call if_changed_dep,cpp_its_S,lzma,vmlinux.bin.lzma)
  112. $(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
  113. $(call if_changed_dep,cpp_its_S,lzo,vmlinux.bin.lzo)
  114. quiet_cmd_itb-image = ITB $@
  115. cmd_itb-image = \
  116. env PATH="$(objtree)/scripts/dtc:$(PATH)" \
  117. $(CONFIG_SHELL) $(MKIMAGE) \
  118. -D "-I dts -O dtb -p 500 \
  119. --include $(objtree)/arch/mips \
  120. --warning no-unit_address_vs_reg" \
  121. -f $(2) $@
  122. $(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE
  123. $(call if_changed,itb-image,$<)
  124. $(obj)/vmlinux.gz.itb: $(obj)/vmlinux.gz.its $(obj)/vmlinux.bin.gz FORCE
  125. $(call if_changed,itb-image,$<)
  126. $(obj)/vmlinux.bz2.itb: $(obj)/vmlinux.bz2.its $(obj)/vmlinux.bin.bz2 FORCE
  127. $(call if_changed,itb-image,$<)
  128. $(obj)/vmlinux.lzma.itb: $(obj)/vmlinux.lzma.its $(obj)/vmlinux.bin.lzma FORCE
  129. $(call if_changed,itb-image,$<)
  130. $(obj)/vmlinux.lzo.itb: $(obj)/vmlinux.lzo.its $(obj)/vmlinux.bin.lzo FORCE
  131. $(call if_changed,itb-image,$<)