Makefile 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. # Makefile for making ELF bootable images for booting on CHRP
  2. # using Open Firmware.
  3. #
  4. # Geert Uytterhoeven September 1997
  5. #
  6. # Based on coffboot by Paul Mackerras
  7. # Simplified for ppc64 by Todd Inglett
  8. #
  9. # NOTE: this code is built for 32 bit in ELF32 format even though
  10. # it packages a 64 bit kernel. We do this to simplify the
  11. # bootloader and increase compatibility with OpenFirmware.
  12. #
  13. # To this end we need to define BOOTCC, etc, as the tools
  14. # needed to build the 32 bit image. That's normally the same
  15. # compiler for the rest of the kernel, with the -m32 flag added.
  16. # To make it easier to setup a cross compiler,
  17. # CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
  18. # in the toplevel makefile.
  19. all: $(obj)/zImage
  20. compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP
  21. compress-$(CONFIG_KERNEL_XZ) := CONFIG_KERNEL_XZ
  22. BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
  23. -fno-strict-aliasing -Os -msoft-float -pipe \
  24. -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
  25. -isystem $(shell $(CROSS32CC) -print-file-name=include) \
  26. -D$(compress-y)
  27. ifdef CONFIG_PPC64_BOOT_WRAPPER
  28. BOOTCFLAGS += -m64
  29. endif
  30. ifdef CONFIG_CPU_BIG_ENDIAN
  31. BOOTCFLAGS += -mbig-endian
  32. else
  33. BOOTCFLAGS += -mlittle-endian
  34. BOOTCFLAGS += $(call cc-option,-mabi=elfv2)
  35. endif
  36. BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
  37. ifdef CONFIG_DEBUG_INFO
  38. BOOTCFLAGS += -g
  39. endif
  40. ifeq ($(call cc-option-yn, -fstack-protector),y)
  41. BOOTCFLAGS += -fno-stack-protector
  42. endif
  43. BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj)
  44. DTC_FLAGS ?= -p 1024
  45. $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
  46. $(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
  47. $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
  48. $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
  49. $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
  50. $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
  51. $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
  52. $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
  53. $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
  54. $(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
  55. $(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
  56. # The pre-boot decompressors pull in a lot of kernel headers and other source
  57. # files. This creates a bit of a dependency headache since we need to copy
  58. # these files into the build dir, fix up any includes and ensure that dependent
  59. # files are copied in the right order.
  60. # these need to be seperate variables because they are copied out of different
  61. # directories in the kernel tree. Sure you COULd merge them, but it's a
  62. # cure-is-worse-than-disease situation.
  63. zlib-decomp-$(CONFIG_KERNEL_GZIP) := decompress_inflate.c
  64. zlib-$(CONFIG_KERNEL_GZIP) := inffast.c inflate.c inftrees.c
  65. zlibheader-$(CONFIG_KERNEL_GZIP) := inffast.h inffixed.h inflate.h inftrees.h infutil.h
  66. zliblinuxheader-$(CONFIG_KERNEL_GZIP) := zlib.h zconf.h zutil.h
  67. $(addprefix $(obj)/, decompress.o): \
  68. $(addprefix $(obj)/,$(zlib-decomp-y))
  69. $(addprefix $(obj)/, $(zlib-decomp-y)): \
  70. $(addprefix $(obj)/,$(zliblinuxheader-y)) \
  71. $(addprefix $(obj)/,$(zlibheader-y)) \
  72. $(addprefix $(obj)/,$(zlib-y))
  73. $(addprefix $(obj)/,$(zlib-y)): \
  74. $(addprefix $(obj)/,$(zliblinuxheader-y)) \
  75. $(addprefix $(obj)/,$(zlibheader-y))
  76. libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
  77. libfdtheader := fdt.h libfdt.h libfdt_internal.h
  78. $(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o \
  79. treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o): \
  80. $(addprefix $(obj)/,$(libfdtheader))
  81. src-wlib-y := string.S crt0.S crtsavres.S stdio.c decompress.c main.c \
  82. $(libfdt) libfdt-wrapper.c \
  83. ns16550.c serial.c simple_alloc.c div64.S util.S \
  84. elf_util.c $(zlib-y) devtree.c stdlib.c \
  85. oflib.c ofconsole.c cuboot.c mpsc.c cpm-serial.c \
  86. uartlite.c mpc52xx-psc.c opal.c
  87. src-wlib-$(CONFIG_PPC64_BOOT_WRAPPER) += opal-calls.S
  88. src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
  89. src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
  90. src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c fsl-soc.c
  91. src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
  92. src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c
  93. src-plat-y := of.c epapr.c
  94. src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
  95. treeboot-walnut.c cuboot-acadia.c \
  96. cuboot-kilauea.c simpleboot.c \
  97. virtex405-head.S virtex.c
  98. src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
  99. cuboot-bamboo.c cuboot-sam440ep.c \
  100. cuboot-sequoia.c cuboot-rainier.c \
  101. cuboot-taishan.c cuboot-katmai.c \
  102. cuboot-warp.c cuboot-yosemite.c \
  103. treeboot-iss4xx.c treeboot-currituck.c \
  104. treeboot-akebono.c \
  105. simpleboot.c fixed-head.S virtex.c
  106. src-plat-$(CONFIG_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
  107. src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
  108. src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
  109. src-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c
  110. src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
  111. src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
  112. cuboot-c2k.c gamecube-head.S \
  113. gamecube.c wii-head.S wii.c holly.c \
  114. fixed-head.S mvme5100.c
  115. src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
  116. src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
  117. src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
  118. src-plat-$(CONFIG_PPC_PSERIES) += pseries-head.S
  119. src-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S
  120. src-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S
  121. src-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c
  122. src-wlib := $(sort $(src-wlib-y))
  123. src-plat := $(sort $(src-plat-y))
  124. src-boot := $(src-wlib) $(src-plat) empty.c
  125. src-boot := $(addprefix $(obj)/, $(src-boot))
  126. obj-boot := $(addsuffix .o, $(basename $(src-boot)))
  127. obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
  128. obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
  129. obj-plat: $(libfdt)
  130. quiet_cmd_copy_kern_src = COPY $@
  131. cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@
  132. $(addprefix $(obj)/,$(zlib-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
  133. $(call cmd,copy_kern_src)
  134. $(addprefix $(obj)/,$(zlibheader-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
  135. $(call cmd,copy_kern_src)
  136. $(addprefix $(obj)/,$(zliblinuxheader-y)): $(obj)/%: $(srctree)/include/linux/%
  137. $(call cmd,copy_kern_src)
  138. $(addprefix $(obj)/,$(zlib-decomp-y)): $(obj)/%: $(srctree)/lib/%
  139. $(call cmd,copy_kern_src)
  140. quiet_cmd_copy_libfdt = COPY $@
  141. cmd_copy_libfdt = cp $< $@
  142. $(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
  143. $(call cmd,copy_libfdt)
  144. $(obj)/empty.c:
  145. $(Q)touch $@
  146. $(obj)/zImage.lds: $(obj)/%: $(srctree)/$(src)/%.S
  147. $(CROSS32CC) $(cpp_flags) -E -Wp,-MD,$(depfile) -P -Upowerpc \
  148. -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
  149. $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
  150. $(Q)cp $< $@
  151. clean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \
  152. $(zlib-decomp-) $(libfdt) $(libfdtheader) \
  153. empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
  154. quiet_cmd_bootcc = BOOTCC $@
  155. cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
  156. quiet_cmd_bootas = BOOTAS $@
  157. cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
  158. quiet_cmd_bootar = BOOTAR $@
  159. cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
  160. $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
  161. $(call if_changed_dep,bootcc)
  162. $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
  163. $(Q)mkdir -p $(dir $@)
  164. $(call if_changed_dep,bootcc)
  165. $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
  166. $(Q)mkdir -p $(dir $@)
  167. $(call if_changed_dep,bootas)
  168. $(obj)/wrapper.a: $(obj-wlib) FORCE
  169. $(call if_changed,bootar)
  170. hostprogs-y := addnote hack-coff mktree
  171. targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
  172. extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
  173. $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
  174. dtstree := $(srctree)/$(src)/dts
  175. wrapper :=$(srctree)/$(src)/wrapper
  176. wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
  177. $(wrapper) FORCE
  178. #############
  179. # Bits for building various flavours of zImage
  180. ifneq ($(CROSS32_COMPILE),)
  181. CROSSWRAP := -C "$(CROSS32_COMPILE)"
  182. else
  183. ifneq ($(CROSS_COMPILE),)
  184. CROSSWRAP := -C "$(CROSS_COMPILE)"
  185. endif
  186. endif
  187. compressor-$(CONFIG_KERNEL_GZIP) := gz
  188. compressor-$(CONFIG_KERNEL_XZ) := xz
  189. # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
  190. quiet_cmd_wrap = WRAP $@
  191. cmd_wrap =$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \
  192. $(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \
  193. vmlinux
  194. image-$(CONFIG_PPC_PSERIES) += zImage.pseries
  195. image-$(CONFIG_PPC_POWERNV) += zImage.pseries
  196. image-$(CONFIG_PPC_MAPLE) += zImage.maple
  197. image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries
  198. image-$(CONFIG_PPC_PS3) += dtbImage.ps3
  199. image-$(CONFIG_PPC_CHRP) += zImage.chrp
  200. image-$(CONFIG_PPC_EFIKA) += zImage.chrp
  201. image-$(CONFIG_PPC_PMAC) += zImage.pmac
  202. image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
  203. image-$(CONFIG_DEFAULT_UIMAGE) += uImage
  204. image-$(CONFIG_EPAPR_BOOT) += zImage.epapr
  205. #
  206. # Targets which embed a device tree blob
  207. #
  208. # Theses are default targets to build images which embed device tree blobs.
  209. # They are only required on boards which do not have FDT support in firmware.
  210. # Boards with newish u-boot firmware can use the uImage target above
  211. #
  212. # Board ports in arch/powerpc/platform/40x/Kconfig
  213. image-$(CONFIG_EP405) += dtbImage.ep405
  214. image-$(CONFIG_HOTFOOT) += cuImage.hotfoot
  215. image-$(CONFIG_WALNUT) += treeImage.walnut
  216. image-$(CONFIG_ACADIA) += cuImage.acadia
  217. image-$(CONFIG_OBS600) += uImage.obs600
  218. # Board ports in arch/powerpc/platform/44x/Kconfig
  219. image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
  220. image-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo
  221. image-$(CONFIG_SAM440EP) += cuImage.sam440ep
  222. image-$(CONFIG_SEQUOIA) += cuImage.sequoia
  223. image-$(CONFIG_RAINIER) += cuImage.rainier
  224. image-$(CONFIG_TAISHAN) += cuImage.taishan
  225. image-$(CONFIG_KATMAI) += cuImage.katmai
  226. image-$(CONFIG_WARP) += cuImage.warp
  227. image-$(CONFIG_YOSEMITE) += cuImage.yosemite
  228. image-$(CONFIG_ISS4xx) += treeImage.iss4xx \
  229. treeImage.iss4xx-mpic
  230. image-$(CONFIG_CURRITUCK) += treeImage.currituck
  231. image-$(CONFIG_AKEBONO) += treeImage.akebono
  232. # Board ports in arch/powerpc/platform/8xx/Kconfig
  233. image-$(CONFIG_MPC86XADS) += cuImage.mpc866ads
  234. image-$(CONFIG_MPC885ADS) += cuImage.mpc885ads
  235. image-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc
  236. image-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \
  237. dtbImage.adder875-redboot
  238. # Board ports in arch/powerpc/platform/52xx/Kconfig
  239. image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 lite5200.dtb
  240. image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b lite5200b.dtb
  241. image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 media5200.dtb
  242. # Board ports in arch/powerpc/platform/82xx/Kconfig
  243. image-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads
  244. image-$(CONFIG_PQ2FADS) += cuImage.pq2fads
  245. image-$(CONFIG_EP8248E) += dtbImage.ep8248e
  246. # Board ports in arch/powerpc/platform/83xx/Kconfig
  247. image-$(CONFIG_MPC832x_MDS) += cuImage.mpc832x_mds
  248. image-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb
  249. image-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \
  250. cuImage.mpc8349emitxgp
  251. image-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds
  252. image-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds
  253. image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
  254. # Board ports in arch/powerpc/platform/85xx/Kconfig
  255. image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
  256. image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads
  257. image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \
  258. cuImage.mpc8548cds_32b \
  259. cuImage.mpc8555cds
  260. image-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds
  261. image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \
  262. cuImage.mpc8572ds
  263. image-$(CONFIG_TQM8540) += cuImage.tqm8540
  264. image-$(CONFIG_TQM8541) += cuImage.tqm8541
  265. image-$(CONFIG_TQM8548) += cuImage.tqm8548
  266. image-$(CONFIG_TQM8555) += cuImage.tqm8555
  267. image-$(CONFIG_TQM8560) += cuImage.tqm8560
  268. image-$(CONFIG_SBC8548) += cuImage.sbc8548
  269. image-$(CONFIG_KSI8560) += cuImage.ksi8560
  270. # Board ports in arch/powerpc/platform/86xx/Kconfig
  271. image-$(CONFIG_MVME7100) += dtbImage.mvme7100
  272. # Board ports in arch/powerpc/platform/embedded6xx/Kconfig
  273. image-$(CONFIG_STORCENTER) += cuImage.storcenter
  274. image-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2
  275. image-$(CONFIG_PPC_C2K) += cuImage.c2k
  276. image-$(CONFIG_GAMECUBE) += dtbImage.gamecube
  277. image-$(CONFIG_WII) += dtbImage.wii
  278. image-$(CONFIG_MVME5100) += dtbImage.mvme5100
  279. # Board port in arch/powerpc/platform/amigaone/Kconfig
  280. image-$(CONFIG_AMIGAONE) += cuImage.amigaone
  281. # For 32-bit powermacs, build the COFF and miboot images
  282. # as well as the ELF images.
  283. ifeq ($(CONFIG_PPC32),y)
  284. image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
  285. endif
  286. # Allow extra targets to be added to the defconfig
  287. image-y += $(subst ",,$(CONFIG_EXTRA_TARGETS))
  288. initrd- := $(patsubst zImage%, zImage.initrd%, $(image-))
  289. initrd-y := $(patsubst zImage%, zImage.initrd%, \
  290. $(patsubst dtbImage%, dtbImage.initrd%, \
  291. $(patsubst simpleImage%, simpleImage.initrd%, \
  292. $(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
  293. initrd-y := $(filter-out $(image-y), $(initrd-y))
  294. targets += $(image-y) $(initrd-y)
  295. $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
  296. # Don't put the ramdisk on the pattern rule; when its missing make will try
  297. # the pattern rule with less dependencies that also matches (even with the
  298. # hard dependency listed).
  299. $(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
  300. $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
  301. $(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits)
  302. $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
  303. # dtbImage% - a dtbImage is a zImage with an embedded device tree blob
  304. $(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
  305. $(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
  306. $(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
  307. $(call if_changed,wrap,$*,,$(obj)/$*.dtb)
  308. # This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
  309. # prefix
  310. $(obj)/vmlinux.strip: vmlinux
  311. $(STRIP) -s -R .comment $< -o $@
  312. $(obj)/uImage: vmlinux $(wrapperbits)
  313. $(call if_changed,wrap,uboot)
  314. $(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  315. $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
  316. $(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  317. $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
  318. $(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  319. $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
  320. $(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  321. $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
  322. $(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  323. $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
  324. $(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  325. $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb)
  326. $(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  327. $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
  328. $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
  329. $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
  330. # Rule to build device tree blobs
  331. $(obj)/%.dtb: $(src)/dts/%.dts FORCE
  332. $(call if_changed_dep,dtc)
  333. $(obj)/%.dtb: $(src)/dts/fsl/%.dts FORCE
  334. $(call if_changed_dep,dtc)
  335. # If there isn't a platform selected then just strip the vmlinux.
  336. ifeq (,$(image-y))
  337. image-y := vmlinux.strip
  338. endif
  339. $(obj)/zImage: $(addprefix $(obj)/, $(image-y))
  340. $(Q)rm -f $@; ln $< $@
  341. $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
  342. $(Q)rm -f $@; ln $< $@
  343. # Only install the vmlinux
  344. install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
  345. sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)"
  346. # Install the vmlinux and other built boot targets.
  347. zInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
  348. sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
  349. # anything not in $(targets)
  350. clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
  351. zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
  352. zImage.miboot zImage.pmac zImage.pseries \
  353. zImage.maple simpleImage.* otheros.bld *.dtb
  354. # clean up files cached by wrapper
  355. clean-kernel-base := vmlinux.strip vmlinux.bin
  356. clean-kernel := $(addsuffix .gz,$(clean-kernel-base))
  357. clean-kernel += $(addsuffix .xz,$(clean-kernel-base))
  358. # If not absolute clean-files are relative to $(obj).
  359. clean-files += $(addprefix $(objtree)/, $(clean-kernel))
  360. WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
  361. WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
  362. WRAPPER_BINDIR := /usr/sbin
  363. INSTALL := install
  364. extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
  365. hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
  366. wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
  367. dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
  368. all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
  369. quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
  370. cmd_mkdir = mkdir -p $@
  371. quiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
  372. cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
  373. quiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
  374. cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
  375. quiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
  376. cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
  377. quiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
  378. cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
  379. sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
  380. -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
  381. $(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
  382. $(call cmd,mkdir)
  383. $(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
  384. $(call cmd,install)
  385. $(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
  386. $(call cmd,install_exe)
  387. $(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
  388. $(call cmd,install_dts)
  389. $(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
  390. $(call cmd,install_wrapper)
  391. $(obj)/bootwrapper_install: $(all-installed)