Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Makefile for making bootable images on various OpenFirmware machines.
  2. #
  3. # This file is included by the global makefile so that you can add your own
  4. # architecture-specific flags and dependencies.
  5. #
  6. # Paul Mackerras January 1997
  7. # XCOFF bootable images for PowerMacs
  8. # Geert Uytterhoeven September 1997
  9. # ELF bootable iamges for CHRP machines.
  10. # Tom Rini January 2001
  11. # Cleaned up, moved into arch/ppc/boot/pmac
  12. # Tom Rini July/August 2002
  13. # Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
  14. # rules.
  15. zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
  16. zImage.initrd znetboot.initrd: initrd := .initrd
  17. boot := arch/ppc/boot
  18. common := $(boot)/common
  19. utils := $(boot)/utils
  20. bootlib := $(boot)/lib
  21. of1275 := $(boot)/of1275
  22. images := $(boot)/images
  23. CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
  24. COMMONOBJS := start.o misc.o common.o
  25. CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
  26. targets := $(CHRPOBJS) dummy.o
  27. CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
  28. LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
  29. ifdef CONFIG_SMP
  30. END := .smp
  31. endif
  32. ifdef CONFIG_PPC64BRIDGE
  33. END += .64
  34. endif
  35. $(images)/ramdisk.image.gz:
  36. @echo ' MISSING $@'
  37. @echo ' RAM disk image must be provided separately'
  38. @/bin/false
  39. quiet_cmd_genimage = GEN $@
  40. cmd_genimage = $(OBJCOPY) -R .comment \
  41. --add-section=.image=$(images)/vmlinux.gz \
  42. --set-section-flags=.image=contents,alloc,load,readonly,data $< $@
  43. targets += image.o
  44. $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
  45. $(call if_changed,genimage)
  46. # Place the ramdisk in the initrd image.
  47. quiet_cmd_genimage-initrd = GEN $@
  48. cmd_genimage-initrd = $(OBJCOPY) $< $@ \
  49. --add-section=.ramdisk=$(images)/ramdisk.image.gz \
  50. --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
  51. targets += image.initrd.o
  52. $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
  53. $(call if_changed,genimage-initrd)
  54. targets += crt0.o
  55. $(obj)/crt0.o: $(common)/crt0.S FORCE
  56. $(call if_changed_dep,as_o_S)
  57. quiet_cmd_gen-chrp = CHRP $@
  58. cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
  59. $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
  60. $(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
  61. $(srctree)/$(boot)/ld.script
  62. $(call cmd,gen-chrp)
  63. $(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
  64. $(srctree)/$(boot)/ld.script
  65. $(call cmd,gen-chrp)
  66. quiet_cmd_addnote = ADDNOTE $@
  67. cmd_addnote = cat $< > $@ && $(utils)/addnote $@
  68. $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
  69. %-rs6k: %
  70. $(call cmd,addnote)
  71. # The targets used on the make command-line
  72. PHONY += zImage zImage.initrd
  73. zImage: $(images)/zImage.chrp \
  74. $(images)/zImage.chrp-rs6k
  75. @echo ' kernel: $@ is ready ($<)'
  76. zImage.initrd: $(images)/zImage.initrd.chrp \
  77. $(images)/zImage.initrd.chrp-rs6k
  78. @echo ' kernel: $@ is ready ($<)'
  79. TFTPIMAGE := /tftpboot/zImage
  80. PHONY += znetboot znetboot.initrd
  81. znetboot: $(images)/zImage.chrp
  82. cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
  83. @echo ' kernel: $@ is ready ($<)'
  84. znetboot.initrd:$(images)/zImage.initrd.chrp
  85. cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
  86. @echo ' kernel: $@ is ready ($<)'