/arch/ppc/boot/openfirmware/Makefile

https://bitbucket.org/evzijst/gittest · Makefile · 188 lines · 140 code · 34 blank · 14 comment · 6 complexity · b7d548b7a1c1217182504c6e1347a765 MD5 · raw file

  1. # Makefile for making bootable images on various OpenFirmware machines.
  2. #
  3. # Paul Mackerras January 1997
  4. # XCOFF bootable images for PowerMacs
  5. # Geert Uytterhoeven September 1997
  6. # ELF bootable iamges for CHRP machines.
  7. # Tom Rini January 2001
  8. # Cleaned up, moved into arch/ppc/boot/pmac
  9. # Tom Rini July/August 2002
  10. # Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
  11. # rules.
  12. zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
  13. zImage.initrd znetboot.initrd: initrd := .initrd
  14. boot := arch/ppc/boot
  15. common := $(boot)/common
  16. utils := $(boot)/utils
  17. bootlib := $(boot)/lib
  18. of1275 := $(boot)/of1275
  19. images := $(boot)/images
  20. OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
  21. COFF_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \
  22. -Bstatic
  23. CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
  24. NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000
  25. COMMONOBJS := start.o misc.o common.o
  26. COFFOBJS := coffcrt0.o $(COMMONOBJS) coffmain.o
  27. CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
  28. NEWWORLDOBJS := crt0.o $(COMMONOBJS) newworldmain.o
  29. targets := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o
  30. COFFOBJS := $(addprefix $(obj)/, $(COFFOBJS))
  31. CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
  32. NEWWORLDOBJS := $(addprefix $(obj)/, $(NEWWORLDOBJS))
  33. LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
  34. HACKCOFF := $(utils)/hack-coff
  35. ifdef CONFIG_SMP
  36. END := .smp
  37. endif
  38. ifdef CONFIG_PPC64BRIDGE
  39. END += .64
  40. endif
  41. $(images)/ramdisk.image.gz:
  42. @echo ' MISSING $@'
  43. @echo ' RAM disk image must be provided separately'
  44. @/bin/false
  45. objcpxmon-$(CONFIG_XMON) := --add-section=.sysmap=System.map \
  46. --set-section-flags=.sysmap=contents,alloc,load,readonly,data
  47. quiet_cmd_genimage = GEN $@
  48. cmd_genimage = $(OBJCOPY) -R .comment \
  49. --add-section=.image=$(images)/vmlinux.gz \
  50. --set-section-flags=.image=contents,alloc,load,readonly,data \
  51. $(objcpxmon-y) $< $@
  52. targets += image.o
  53. $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
  54. $(call if_changed,genimage)
  55. # Place the ramdisk in the initrd image.
  56. quiet_cmd_genimage-initrd = GEN $@
  57. cmd_genimage-initrd = $(OBJCOPY) $< $@ \
  58. --add-section=.ramdisk=$(images)/ramdisk.image.gz \
  59. --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
  60. targets += image.initrd.o
  61. $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
  62. $(call if_changed,genimage-initrd)
  63. # Create the note section for New-World PowerMacs.
  64. quiet_cmd_mknote = MKNOTE $@
  65. cmd_mknote = $(utils)/mknote > $@
  66. targets += note
  67. $(obj)/note: $(utils)/mknote FORCE
  68. $(call if_changed,mknote)
  69. $(obj)/coffcrt0.o: EXTRA_AFLAGS := -traditional -DXCOFF
  70. $(obj)/crt0.o: EXTRA_AFLAGS := -traditional
  71. targets += coffcrt0.o crt0.o
  72. $(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE
  73. $(call if_changed_dep,as_o_S)
  74. quiet_cmd_gencoffb = COFF $@
  75. cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \
  76. $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
  77. targets += coffboot
  78. $(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE
  79. $(call if_changed,gencoffb)
  80. targets += coffboot.initrd
  81. $(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \
  82. $(srctree)/$(boot)/ld.script FORCE
  83. $(call if_changed,gencoffb)
  84. quiet_cmd_gen-coff = COFF $@
  85. cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \
  86. $(HACKCOFF) $@ && \
  87. ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac
  88. $(images)/vmlinux.coff: $(obj)/coffboot
  89. $(call cmd,gen-coff)
  90. $(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
  91. $(call cmd,gen-coff)
  92. quiet_cmd_gen-elf-pmac = ELF $@
  93. cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \
  94. $(NEWWORLDOBJS) $(LIBS) $< && \
  95. $(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \
  96. -R .comment $(del-ramdisk-sec)
  97. $(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \
  98. $(obj)/note $(srctree)/$(boot)/ld.script
  99. $(call cmd,gen-elf-pmac)
  100. $(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \
  101. $(LIBS) $(obj)/note \
  102. $(srctree)/$(boot)/ld.script
  103. $(call cmd,gen-elf-pmac)
  104. quiet_cmd_gen-chrp = CHRP $@
  105. cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
  106. $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
  107. $(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
  108. $(srctree)/$(boot)/ld.script
  109. $(call cmd,gen-chrp)
  110. $(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
  111. $(srctree)/$(boot)/ld.script
  112. $(call cmd,gen-chrp)
  113. quiet_cmd_addnote = ADDNOTE $@
  114. cmd_addnote = cat $< > $@ && $(utils)/addnote $@
  115. $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
  116. %-rs6k: %
  117. $(call cmd,addnote)
  118. quiet_cmd_gen-miboot = GEN $@
  119. cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \
  120. --add-section=$1=$(word 2, $^) $< $@
  121. $(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
  122. $(call cmd,gen-miboot,image)
  123. $(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
  124. $(call cmd,gen-miboot,initrd)
  125. # The targets used on the make command-line
  126. .PHONY: zImage zImage.initrd
  127. zImage: $(images)/vmlinux.coff \
  128. $(images)/vmlinux.elf-pmac \
  129. $(images)/zImage.chrp \
  130. $(images)/zImage.chrp-rs6k \
  131. $(images)/miboot.image
  132. @echo ' kernel: $@ is ready ($<)'
  133. zImage.initrd: $(images)/vmlinux.initrd.coff \
  134. $(images)/vmlinux.initrd.elf-pmac \
  135. $(images)/zImage.initrd.chrp \
  136. $(images)/zImage.initrd.chrp-rs6k \
  137. $(images)/miboot.initrd.image
  138. @echo ' kernel: $@ is ready ($<)'
  139. TFTPIMAGE := /tftpboot/zImage
  140. .PHONY: znetboot znetboot.initrd
  141. znetboot: $(images)/vmlinux.coff \
  142. $(images)/vmlinux.elf-pmac \
  143. $(images)/zImage.chrp
  144. cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
  145. cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf
  146. cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
  147. @echo ' kernel: $@ is ready ($<)'
  148. znetboot.initrd:$(images)/vmlinux.initrd.coff \
  149. $(images)/vmlinux.initrd.elf-pmac \
  150. $(images)/zImage.initrd.chrp
  151. cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
  152. cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
  153. cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
  154. @echo ' kernel: $@ is ready ($<)'