Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
  21. COMMONOBJS := start.o misc.o common.o
  22. CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
  23. targets := $(CHRPOBJS) dummy.o
  24. CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
  25. LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
  26. ifdef CONFIG_SMP
  27. END := .smp
  28. endif
  29. ifdef CONFIG_PPC64BRIDGE
  30. END += .64
  31. endif
  32. $(images)/ramdisk.image.gz:
  33. @echo ' MISSING $@'
  34. @echo ' RAM disk image must be provided separately'
  35. @/bin/false
  36. quiet_cmd_genimage = GEN $@
  37. cmd_genimage = $(OBJCOPY) -R .comment \
  38. --add-section=.image=$(images)/vmlinux.gz \
  39. --set-section-flags=.image=contents,alloc,load,readonly,data $< $@
  40. targets += image.o
  41. $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
  42. $(call if_changed,genimage)
  43. # Place the ramdisk in the initrd image.
  44. quiet_cmd_genimage-initrd = GEN $@
  45. cmd_genimage-initrd = $(OBJCOPY) $< $@ \
  46. --add-section=.ramdisk=$(images)/ramdisk.image.gz \
  47. --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
  48. targets += image.initrd.o
  49. $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
  50. $(call if_changed,genimage-initrd)
  51. targets += crt0.o
  52. $(obj)/crt0.o: $(common)/crt0.S FORCE
  53. $(call if_changed_dep,as_o_S)
  54. quiet_cmd_gen-chrp = CHRP $@
  55. cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
  56. $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
  57. $(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
  58. $(srctree)/$(boot)/ld.script
  59. $(call cmd,gen-chrp)
  60. $(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
  61. $(srctree)/$(boot)/ld.script
  62. $(call cmd,gen-chrp)
  63. quiet_cmd_addnote = ADDNOTE $@
  64. cmd_addnote = cat $< > $@ && $(utils)/addnote $@
  65. $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
  66. %-rs6k: %
  67. $(call cmd,addnote)
  68. # The targets used on the make command-line
  69. .PHONY: zImage zImage.initrd
  70. zImage: $(images)/zImage.chrp \
  71. $(images)/zImage.chrp-rs6k
  72. @echo ' kernel: $@ is ready ($<)'
  73. zImage.initrd: $(images)/zImage.initrd.chrp \
  74. $(images)/zImage.initrd.chrp-rs6k
  75. @echo ' kernel: $@ is ready ($<)'
  76. TFTPIMAGE := /tftpboot/zImage
  77. .PHONY: znetboot znetboot.initrd
  78. znetboot: $(images)/zImage.chrp
  79. cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
  80. @echo ' kernel: $@ is ready ($<)'
  81. znetboot.initrd:$(images)/zImage.initrd.chrp
  82. cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
  83. @echo ' kernel: $@ is ready ($<)'