Makefile
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. # This is far from simple, but I couldn't think of a good name.  This is
  2. # for making the 'zImage' or 'zImage.initrd' on a number of targets.
  3. #
  4. # Author: Tom Rini <trini@mvista.com>
  5. #
  6. # Copyright 2001-2002 MontaVista Software Inc.
  7. #
  8. # Notes:
  9. # (1) For machine targets which produce more than one image, define
  10. # ZNETBOOT and ZNETBOOTRD to the image which should be available for
  11. # 'znetboot' and 'znetboot.initrd`
  12. # (2) For machine targets which use the mktree program, define END to be
  13. # the machine name you want in the image, and you can optionally set
  14. # ENTRYPOINT which the image should be loaded at.  The optimal setting
  15. # for ENTRYPOINT is the link address.
  16. #
  17. # This program is free software; you can redistribute  it and/or modify it
  18. # under  the terms of  the GNU General  Public License as published by the
  19. # Free Software Foundation;  either version 2 of the  License, or (at your
  20. # option) any later version.
  21. USE_STANDARD_AS_RULE := true
  22. # Normally, we use the 'misc-simple.c' file for decompress_kernel and
  23. # whatnot.  Sometimes we need to override this however.
  24. MISC := ../common/misc-simple.o
  25. ifeq ($(CONFIG_EMBEDDEDBOOT),y)
  26. ZIMAGE := zImage-EMBEDDED
  27. ZIMAGEINITRD := zImage.initrd-EMBEDDED
  28. TFTPIMAGE := /tftpboot/zImage.embedded
  29. MISC := misc-embedded.o
  30. endif
  31. ifeq ($(CONFIG_GEMINI),y)
  32. ZIMAGE := zImage-SMON
  33. ZIMAGEINITRD := zImage.initrd-SMON
  34. EXTRA := direct.o
  35. TFTPIMAGE := /tftpboot/zImage.gemini
  36. endif
  37. ifeq ($(CONFIG_PAL4),y)
  38. ZIMAGE := zImage-PAL4
  39. ZIMAGEINITRD := zImage.initrd-PAL4
  40. EXTRA := direct.o
  41. TFTPIMAGE := /tftpboot/zImage.pal4
  42. endif
  43. ifeq ($(CONFIG_SPRUCE),y)
  44. ZIMAGE := zImage-TREE
  45. ZIMAGEINITRD := zImage.initrd-TREE
  46. EXTRA := direct.o
  47. ENTRYPOINT := 0x00800000
  48. MISC := misc-spruce.o
  49. END := spruce
  50. TFTPIMAGE := /tftpboot/zImage.$(END)
  51. endif
  52. ifeq ($(CONFIG_SMP),y)
  53. TFTPIMAGE += .smp
  54. endif
  55. # Setup a default address to put ourselves, change it as needed.
  56. LD_ARGS = -T ../ld.script -Ttext 0x00800000 -Bstatic
  57. ifdef CONFIG_8xx
  58. LD_ARGS := -T ../ld.script -Ttext 0x00180000 -Bstatic
  59. endif
  60. ifeq ($(CONFIG_8260)$(CONFIG_4xx),y)
  61. LD_ARGS := -T ../ld.script -Ttext 0x00400000 -Bstatic
  62. endif
  63. OBJCOPY_ARGS := -O elf32-powerpc
  64. # head.o and ../common/relocate.o must be at the start.
  65. obj-y := head.o ../common/relocate.o $(EXTRA) 
  66. $(MISC) ../common/misc-common.o 
  67. ../common/string.o ../common/util.o
  68. obj-$(CONFIG_4xx) += embed_config.o
  69. obj-$(CONFIG_8xx) += embed_config.o
  70. obj-$(CONFIG_8260) += embed_config.o
  71. obj-$(CONFIG_BSEIP) += iic.o
  72. obj-$(CONFIG_MBX) += iic.o
  73. obj-$(CONFIG_RPXCLASSIC) += iic.o
  74. obj-$(CONFIG_RPXLITE) += iic.o
  75. # Different boards need different serial implementations.
  76. ifeq ($(CONFIG_SERIAL_CONSOLE),y)
  77. obj-$(CONFIG_8xx) += m8xx_tty.o
  78. obj-$(CONFIG_8260) += m8260_tty.o
  79. obj-$(CONFIG_SERIAL) += ../common/ns16550.o
  80. endif
  81. LIBS := ../lib/zlib.a
  82. # Tools
  83. MKPREP := ../utils/mkprep
  84. MKTREE := ../utils/mktree
  85. zvmlinux: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz ../common/dummy.o
  86. $(OBJCOPY) $(OBJCOPY_ARGS) 
  87. --add-section=.image=../images/vmlinux.gz 
  88. --set-section-flags=.image=contents,alloc,load,readonly,data 
  89. ../common/dummy.o image.o
  90. $(LD) $(LD_ARGS) -o $@ $(obj-y) image.o $(LIBS)
  91. $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr 
  92. -R .ramdisk -R .sysmap
  93. zvmlinux.initrd: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz 
  94. ../common/dummy.o
  95. $(OBJCOPY) $(OBJCOPY_ARGS) 
  96. --add-section=.ramdisk=../images/ramdisk.image.gz 
  97. --set-section-flags=.ramdisk=contents,alloc,load,readonly,data 
  98. --add-section=.image=../images/vmlinux.gz 
  99. --set-section-flags=.image=contents,alloc,load,readonly,data 
  100. ../common/dummy.o image.o
  101. $(LD) $(LD_ARGS) -o $@ $(obj-y) image.o $(LIBS)
  102. $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr 
  103. -R .sysmap
  104. # Sort-of dummy rules, that let us format the image we want.
  105. zImage: $(ZIMAGE)
  106. rm -f zvmlinux
  107. zImage.initrd: $(ZIMAGEINITRD)
  108. rm -f zvmlinux.initrd
  109. znetboot: zImage
  110. ifneq ($(ZNETBOOT),)
  111. cp ../images/$(ZNETBOOT) $(TFTPIMAGE)
  112. else
  113. cp ../images/zImage.* $(TFTPIMAGE)
  114. endif
  115. znetboot.initrd: zImage.initrd
  116. ifneq ($(ZNETBOOTRD),)
  117. cp ../images/$(ZNETBOOTRD) $(TFTPIMAGE)
  118. else
  119. cp ../images/zImage.* $(TFTPIMAGE)
  120. endif
  121. zImage-EMBEDDED: zvmlinux
  122. mv zvmlinux ../images/zImage.embedded
  123. zImage.initrd-EMBEDDED: zvmlinux.initrd
  124. mv zvmlinux.initrd ../images/zImage.initrd.embedded
  125. zImage-PAL4: zvmlinux
  126. cp zvmlinux ../images/zImage.pal4
  127. zImage.initrd-PAL4: zvmlinux.initrd
  128. cp zvmlinux.initrd ../images/zImage.initrd.pal4
  129. zImage-SMON: zvmlinux
  130. dd if=zvmlinux of=../images/zImage.gemini skip=64 bs=1k
  131. zImage.initrd-SMON: zvmlinux.initrd
  132. dd if=zvmlinux.initrd of=../images/zImage.initrd.gemini skip=64 bs=1k
  133. zImage-TREE: zvmlinux
  134. $(MKTREE) zvmlinux ../images/zImage.$(END) $(ENTRYPOINT)
  135. zImage.initrd-TREE: zvmlinux.initrd
  136. $(MKTREE) zvmlinux.initrd ../images/zImage.initrd.$(END) $(ENTRYPOINT)
  137. include $(TOPDIR)/Rules.make