xref: /linux/arch/powerpc/boot/Makefile (revision 866bfc75f40e4f8a00d268f73f3a02f572e6c082)
194b212c2SPaul Mackerras# Makefile for making ELF bootable images for booting on CHRP
294b212c2SPaul Mackerras# using Open Firmware.
394b212c2SPaul Mackerras#
494b212c2SPaul Mackerras# Geert Uytterhoeven	September 1997
594b212c2SPaul Mackerras#
694b212c2SPaul Mackerras# Based on coffboot by Paul Mackerras
794b212c2SPaul Mackerras# Simplified for ppc64 by Todd Inglett
894b212c2SPaul Mackerras#
994b212c2SPaul Mackerras# NOTE:	this code is built for 32 bit in ELF32 format even though
1094b212c2SPaul Mackerras#	it packages a 64 bit kernel.  We do this to simplify the
1194b212c2SPaul Mackerras#	bootloader and increase compatibility with OpenFirmware.
1294b212c2SPaul Mackerras#
1394b212c2SPaul Mackerras#	To this end we need to define BOOTCC, etc, as the tools
14b610b978SDavid Gibson#	needed to build the 32 bit image.  That's normally the same
15b610b978SDavid Gibson#	compiler for the rest of the kernel, with the -m32 flag added.
1694b212c2SPaul Mackerras#	To make it easier to setup a cross compiler,
1794b212c2SPaul Mackerras#	CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
1894b212c2SPaul Mackerras#	in the toplevel makefile.
1994b212c2SPaul Mackerras
202bf11819SPaul Mackerrasall: $(obj)/zImage
2194b212c2SPaul Mackerras
2222750d98SOliver O'Hallorancompress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP
23c762c69eSOliver O'Hallorancompress-$(CONFIG_KERNEL_XZ)   := CONFIG_KERNEL_XZ
2422750d98SOliver O'Halloran
25b610b978SDavid GibsonBOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
266846ee5cSBenjamin Herrenschmidt		 -fno-strict-aliasing -Os -msoft-float -pipe \
27b610b978SDavid Gibson		 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
2822750d98SOliver O'Halloran		 -D$(compress-y)
2922750d98SOliver O'Halloran
3065c5ec11SMichael EllermanBOOTCC := $(CC)
31147c0516SCédric Le Goaterifdef CONFIG_PPC64_BOOT_WRAPPER
32147c0516SCédric Le GoaterBOOTCFLAGS	+= -m64
3365c5ec11SMichael Ellermanelse
3465c5ec11SMichael EllermanBOOTCFLAGS	+= -m32
3565c5ec11SMichael Ellermanifdef CROSS32_COMPILE
3665c5ec11SMichael Ellerman    BOOTCC := $(CROSS32_COMPILE)gcc
37147c0516SCédric Le Goaterendif
3865c5ec11SMichael Ellermanendif
3965c5ec11SMichael Ellerman
4065c5ec11SMichael EllermanBOOTCFLAGS	+= -isystem $(shell $(BOOTCC) -print-file-name=include)
4165c5ec11SMichael Ellerman
42147c0516SCédric Le Goaterifdef CONFIG_CPU_BIG_ENDIAN
43147c0516SCédric Le GoaterBOOTCFLAGS	+= -mbig-endian
44655471f5SBenjamin Herrenschmidtelse
45655471f5SBenjamin HerrenschmidtBOOTCFLAGS	+= -mlittle-endian
46655471f5SBenjamin HerrenschmidtBOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
47147c0516SCédric Le Goaterendif
48147c0516SCédric Le Goater
4994b212c2SPaul MackerrasBOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
5094b212c2SPaul Mackerras
51105c13ddSGrant Likelyifdef CONFIG_DEBUG_INFO
52105c13ddSGrant LikelyBOOTCFLAGS	+= -g
53105c13ddSGrant Likelyendif
54105c13ddSGrant Likely
55fda7ffd2SNiels Kristian Bech Jensenifeq ($(call cc-option-yn, -fstack-protector),y)
56fda7ffd2SNiels Kristian Bech JensenBOOTCFLAGS	+= -fno-stack-protector
57fda7ffd2SNiels Kristian Bech Jensenendif
58fda7ffd2SNiels Kristian Bech Jensen
5958ab5e0cSArnd BergmannBOOTCFLAGS	+= -I$(objtree)/$(obj) -I$(srctree)/$(obj)
6094b212c2SPaul Mackerras
6163849340SDirk BrandewieDTC_FLAGS	?= -p 1024
629d4ae9fcSKumar Gala
63bf2e70acSJosh Boyer$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
64bf2e70acSJosh Boyer$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
650cdf50a7SSolomon Peachy$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
66bf2e70acSJosh Boyer$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
67bf2e70acSJosh Boyer$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
689f3eefc4SJosh Boyer$(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
692e71cc0dSJosh Boyer$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
70b4e8c8ddSTorez Smith$(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
71228d5505STony Breeds$(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
722a2c74b2SAlistair Popple$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
73b9e4f176SGrant Likely$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
7460e41753SJosh Boyer
751b7898eeSOliver O'Halloran# The pre-boot decompressors pull in a lot of kernel headers and other source
761b7898eeSOliver O'Halloran# files. This creates a bit of a dependency headache since we need to copy
771b7898eeSOliver O'Halloran# these files into the build dir, fix up any includes and ensure that dependent
781b7898eeSOliver O'Halloran# files are copied in the right order.
791b7898eeSOliver O'Halloran
801b7898eeSOliver O'Halloran# these need to be seperate variables because they are copied out of different
811b7898eeSOliver O'Halloran# directories in the kernel tree. Sure you COULd merge them, but it's a
821b7898eeSOliver O'Halloran# cure-is-worse-than-disease situation.
831b7898eeSOliver O'Halloranzlib-decomp-$(CONFIG_KERNEL_GZIP) := decompress_inflate.c
8422750d98SOliver O'Halloranzlib-$(CONFIG_KERNEL_GZIP) := inffast.c inflate.c inftrees.c
8522750d98SOliver O'Halloranzlibheader-$(CONFIG_KERNEL_GZIP) := inffast.h inffixed.h inflate.h inftrees.h infutil.h
8622750d98SOliver O'Halloranzliblinuxheader-$(CONFIG_KERNEL_GZIP) := zlib.h zconf.h zutil.h
876bbc5476SHugh Blemings
881b7898eeSOliver O'Halloran$(addprefix $(obj)/, decompress.o): \
891b7898eeSOliver O'Halloran	$(addprefix $(obj)/,$(zlib-decomp-y))
901b7898eeSOliver O'Halloran
911b7898eeSOliver O'Halloran$(addprefix $(obj)/, $(zlib-decomp-y)): \
921b7898eeSOliver O'Halloran	$(addprefix $(obj)/,$(zliblinuxheader-y)) \
931b7898eeSOliver O'Halloran	$(addprefix $(obj)/,$(zlibheader-y)) \
941b7898eeSOliver O'Halloran	$(addprefix $(obj)/,$(zlib-y))
951b7898eeSOliver O'Halloran
961b7898eeSOliver O'Halloran$(addprefix $(obj)/,$(zlib-y)): \
9722750d98SOliver O'Halloran	$(addprefix $(obj)/,$(zliblinuxheader-y)) \
9822750d98SOliver O'Halloran	$(addprefix $(obj)/,$(zlibheader-y))
992bf11819SPaul Mackerras
1009fffb55fSDavid Gibsonlibfdt       := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
1019fffb55fSDavid Gibsonlibfdtheader := fdt.h libfdt.h libfdt_internal.h
1029fffb55fSDavid Gibson
103656ad58eSOliver O'Halloran$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o): \
1049fffb55fSDavid Gibson	$(addprefix $(obj)/,$(libfdtheader))
1059fffb55fSDavid Gibson
1067c868b66SNicholas Pigginsrc-wlib-y := string.S crt0.S stdio.c decompress.c main.c \
1079fffb55fSDavid Gibson		$(libfdt) libfdt-wrapper.c \
108ad9d2716SDavid Gibson		ns16550.c serial.c simple_alloc.c div64.S util.S \
1091b7898eeSOliver O'Halloran		elf_util.c $(zlib-y) devtree.c stdlib.c \
110*866bfc75SHannes Reinecke		oflib.c ofconsole.c cuboot.c cpm-serial.c \
111*866bfc75SHannes Reinecke		uartlite.c opal.c
112*866bfc75SHannes Reineckesrc-wlib-$(CONFIG_PPC_MPC52XX) += mpc52xx-psc.c
11310c77dbaSBen Hutchingssrc-wlib-$(CONFIG_PPC64_BOOT_WRAPPER) +=  opal-calls.S
1147c868b66SNicholas Pigginifndef CONFIG_PPC64_BOOT_WRAPPER
1157c868b66SNicholas Pigginsrc-wlib-y += crtsavres.S
1167c868b66SNicholas Pigginendif
117b81f18e5STony Breedssrc-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
118b81f18e5STony Breedssrc-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
119968159c0SChristophe Leroysrc-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c
120b81f18e5STony Breedssrc-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
121*866bfc75SHannes Reineckesrc-wlib-$(CONFIG_EMBEDDED6xx) += mpsc.c mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c
122b81f18e5STony Breeds
1230c9fa291SBenjamin Herrenschmidtsrc-plat-y := of.c epapr.c
124b81f18e5STony Breedssrc-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
125b81f18e5STony Breeds				treeboot-walnut.c cuboot-acadia.c \
126b81f18e5STony Breeds				cuboot-kilauea.c simpleboot.c \
127b81f18e5STony Breeds				virtex405-head.S virtex.c
128b81f18e5STony Breedssrc-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
129b81f18e5STony Breeds				cuboot-bamboo.c cuboot-sam440ep.c \
130b81f18e5STony Breeds				cuboot-sequoia.c cuboot-rainier.c \
131b81f18e5STony Breeds				cuboot-taishan.c cuboot-katmai.c \
132b81f18e5STony Breeds				cuboot-warp.c cuboot-yosemite.c \
133b81f18e5STony Breeds				treeboot-iss4xx.c treeboot-currituck.c \
1342a2c74b2SAlistair Popple				treeboot-akebono.c \
135b81f18e5STony Breeds				simpleboot.c fixed-head.S virtex.c
136968159c0SChristophe Leroysrc-plat-$(CONFIG_PPC_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
137b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
138b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
139b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c
140b81f18e5STony Breedssrc-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
141b81f18e5STony Breedssrc-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
142b81f18e5STony Breeds					cuboot-c2k.c gamecube-head.S \
143b81f18e5STony Breeds					gamecube.c wii-head.S wii.c holly.c \
1443c8464a9SPaul Gortmaker					fixed-head.S mvme5100.c
145b81f18e5STony Breedssrc-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
146b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
1470c9fa291SBenjamin Herrenschmidtsrc-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
1482d9afb36SCédric Le Goatersrc-plat-$(CONFIG_PPC_PSERIES) += pseries-head.S
1492d9afb36SCédric Le Goatersrc-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S
1502d9afb36SCédric Le Goatersrc-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S
15197493e2eSAlessio Igor Boganisrc-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c
152b81f18e5STony Breeds
153b81f18e5STony Breedssrc-wlib := $(sort $(src-wlib-y))
154b81f18e5STony Breedssrc-plat := $(sort $(src-plat-y))
155cd197ffcSDavid Gibsonsrc-boot := $(src-wlib) $(src-plat) empty.c
1562bf11819SPaul Mackerras
1572bf11819SPaul Mackerrassrc-boot := $(addprefix $(obj)/, $(src-boot))
1582bf11819SPaul Mackerrasobj-boot := $(addsuffix .o, $(basename $(src-boot)))
1592bf11819SPaul Mackerrasobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
1602bf11819SPaul Mackerrasobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
1610090e02bSMatthew McClintockobj-plat: $(libfdt)
1622bf11819SPaul Mackerras
1631a13de6dSOliver O'Halloranquiet_cmd_copy_kern_src = COPY    $@
1641a13de6dSOliver O'Halloran      cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@
16594b212c2SPaul Mackerras
16622750d98SOliver O'Halloran$(addprefix $(obj)/,$(zlib-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
1671a13de6dSOliver O'Halloran	$(call cmd,copy_kern_src)
16894b212c2SPaul Mackerras
16922750d98SOliver O'Halloran$(addprefix $(obj)/,$(zlibheader-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
1701a13de6dSOliver O'Halloran	$(call cmd,copy_kern_src)
17194b212c2SPaul Mackerras
17222750d98SOliver O'Halloran$(addprefix $(obj)/,$(zliblinuxheader-y)): $(obj)/%: $(srctree)/include/linux/%
1731a13de6dSOliver O'Halloran	$(call cmd,copy_kern_src)
17494b212c2SPaul Mackerras
1751b7898eeSOliver O'Halloran$(addprefix $(obj)/,$(zlib-decomp-y)): $(obj)/%: $(srctree)/lib/%
1761b7898eeSOliver O'Halloran	$(call cmd,copy_kern_src)
1771b7898eeSOliver O'Halloran
1789fffb55fSDavid Gibsonquiet_cmd_copy_libfdt = COPY    $@
1799fffb55fSDavid Gibson      cmd_copy_libfdt = cp $< $@
1809fffb55fSDavid Gibson
1819fffb55fSDavid Gibson$(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
1829fffb55fSDavid Gibson	$(call cmd,copy_libfdt)
1839fffb55fSDavid Gibson
1842bf11819SPaul Mackerras$(obj)/empty.c:
1856abe248eSMichael Ellerman	$(Q)touch $@
18694b212c2SPaul Mackerras
187147c0516SCédric Le Goater$(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
1886abe248eSMichael Ellerman	$(Q)cp $< $@
1892bf11819SPaul Mackerras
19022750d98SOliver O'Halloranclean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \
1911b7898eeSOliver O'Halloran		$(zlib-decomp-) $(libfdt) $(libfdtheader) \
192b58a4575SKumar Gala		empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
19394b212c2SPaul Mackerras
19494b212c2SPaul Mackerrasquiet_cmd_bootcc = BOOTCC  $@
19565c5ec11SMichael Ellerman      cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
19694b212c2SPaul Mackerras
19794b212c2SPaul Mackerrasquiet_cmd_bootas = BOOTAS  $@
19865c5ec11SMichael Ellerman      cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
19994b212c2SPaul Mackerras
2002bf11819SPaul Mackerrasquiet_cmd_bootar = BOOTAR  $@
20131355403SMichal Marek      cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
20294b212c2SPaul Mackerras
2039fffb55fSDavid Gibson$(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
2049fffb55fSDavid Gibson	$(call if_changed_dep,bootcc)
205235fd835SMilton Miller$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
2062f0dfeaaSDavid Gibson	$(Q)mkdir -p $(dir $@)
20794b212c2SPaul Mackerras	$(call if_changed_dep,bootcc)
208235fd835SMilton Miller$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
2092f0dfeaaSDavid Gibson	$(Q)mkdir -p $(dir $@)
21094b212c2SPaul Mackerras	$(call if_changed_dep,bootas)
21194b212c2SPaul Mackerras
212235fd835SMilton Miller$(obj)/wrapper.a: $(obj-wlib) FORCE
213235fd835SMilton Miller	$(call if_changed,bootar)
21494b212c2SPaul Mackerras
21597bb63e4SPaul Mackerrashostprogs-y	:= addnote hack-coff mktree
21666a45dd3SPaul Mackerras
217235fd835SMilton Millertargets		+= $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
218cd197ffcSDavid Gibsonextra-y		:= $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
219bafdb645SGeoff Levand		   $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
22094b212c2SPaul Mackerras
22125431333SGrant Likelydtstree		:= $(srctree)/$(src)/dts
22225431333SGrant Likely
2232bf11819SPaul Mackerraswrapper		:=$(srctree)/$(src)/wrapper
2249fffb55fSDavid Gibsonwrapperbits	:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
225235fd835SMilton Miller			$(wrapper) FORCE
22694b212c2SPaul Mackerras
2272bf11819SPaul Mackerras#############
2282bf11819SPaul Mackerras# Bits for building various flavours of zImage
22994b212c2SPaul Mackerras
2302bf11819SPaul Mackerrasifneq ($(CROSS32_COMPILE),)
231dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS32_COMPILE)"
2322bf11819SPaul Mackerraselse
2332bf11819SPaul Mackerrasifneq ($(CROSS_COMPILE),)
234dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS_COMPILE)"
2352bf11819SPaul Mackerrasendif
2362bf11819SPaul Mackerrasendif
23794b212c2SPaul Mackerras
238f1e510bbSOliver O'Hallorancompressor-$(CONFIG_KERNEL_GZIP) := gz
239c762c69eSOliver O'Hallorancompressor-$(CONFIG_KERNEL_XZ)   := xz
240f1e510bbSOliver O'Halloran
2419da82a6dSMilton Miller# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
2422bf11819SPaul Mackerrasquiet_cmd_wrap	= WRAP    $@
243f1e510bbSOliver O'Halloran      cmd_wrap	=$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \
244f1e510bbSOliver O'Halloran		$(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \
245f1e510bbSOliver O'Halloran		vmlinux
2462bf11819SPaul Mackerras
2472bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PSERIES)		+= zImage.pseries
24855190f88SBenjamin Herrenschmidtimage-$(CONFIG_PPC_POWERNV)		+= zImage.pseries
24958706ef9SCorey Minyardimage-$(CONFIG_PPC_MAPLE)		+= zImage.maple
250020533efSGeoff Levandimage-$(CONFIG_PPC_IBM_CELL_BLADE)	+= zImage.pseries
251595be948SGrant Likelyimage-$(CONFIG_PPC_PS3)			+= dtbImage.ps3
2522bf11819SPaul Mackerrasimage-$(CONFIG_PPC_CHRP)		+= zImage.chrp
2537839af33SNicolas DETimage-$(CONFIG_PPC_EFIKA)		+= zImage.chrp
2542bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC)		+= zImage.pmac
25532dde0f9SJosh Boyerimage-$(CONFIG_PPC_HOLLY)		+= dtbImage.holly
256ac18c673SScott Woodimage-$(CONFIG_DEFAULT_UIMAGE)		+= uImage
2576c5b59b9SDavid Gibsonimage-$(CONFIG_EPAPR_BOOT)		+= zImage.epapr
258ac18c673SScott Wood
25925431333SGrant Likely#
26025431333SGrant Likely# Targets which embed a device tree blob
26125431333SGrant Likely#
26225431333SGrant Likely# Theses are default targets to build images which embed device tree blobs.
26325431333SGrant Likely# They are only required on boards which do not have FDT support in firmware.
2642a94739cSNick Andrew# Boards with newish u-boot firmware can use the uImage target above
26525431333SGrant Likely#
26625431333SGrant Likely
26725431333SGrant Likely# Board ports in arch/powerpc/platform/40x/Kconfig
268595be948SGrant Likelyimage-$(CONFIG_EP405)			+= dtbImage.ep405
2690cdf50a7SSolomon Peachyimage-$(CONFIG_HOTFOOT)			+= cuImage.hotfoot
27025431333SGrant Likelyimage-$(CONFIG_WALNUT)			+= treeImage.walnut
27194c73a8fSJosh Boyerimage-$(CONFIG_ACADIA)			+= cuImage.acadia
27211eab297SBenjamin Herrenschmidtimage-$(CONFIG_OBS600)			+= uImage.obs600
27325431333SGrant Likely
27425431333SGrant Likely# Board ports in arch/powerpc/platform/44x/Kconfig
275f6dfc805SDavid Gibsonimage-$(CONFIG_EBONY)			+= treeImage.ebony cuImage.ebony
276658e8170SJosh Boyerimage-$(CONFIG_BAMBOO)			+= treeImage.bamboo cuImage.bamboo
277b6014e15SGiuseppe Covielloimage-$(CONFIG_SAM440EP)		+= cuImage.sam440ep
278606d08bcSValentine Barshakimage-$(CONFIG_SEQUOIA)			+= cuImage.sequoia
279295e7427SValentine Barshakimage-$(CONFIG_RAINIER)			+= cuImage.rainier
2806bbc5476SHugh Blemingsimage-$(CONFIG_TAISHAN)			+= cuImage.taishan
2813de9c9cdSBenjamin Herrenschmidtimage-$(CONFIG_KATMAI)			+= cuImage.katmai
2821e12f3c5SSean MacLennanimage-$(CONFIG_WARP)			+= cuImage.warp
283d0a48c9fSJosh Boyerimage-$(CONFIG_YOSEMITE)		+= cuImage.yosemite
284b4e8c8ddSTorez Smithimage-$(CONFIG_ISS4xx)			+= treeImage.iss4xx \
285b4e8c8ddSTorez Smith					   treeImage.iss4xx-mpic
286228d5505STony Breedsimage-$(CONFIG_CURRITUCK)			+= treeImage.currituck
2872a2c74b2SAlistair Poppleimage-$(CONFIG_AKEBONO)			+= treeImage.akebono
28894b212c2SPaul Mackerras
28925431333SGrant Likely# Board ports in arch/powerpc/platform/8xx/Kconfig
290efa58fbfSAdrian Bunkimage-$(CONFIG_MPC86XADS)		+= cuImage.mpc866ads
291efa58fbfSAdrian Bunkimage-$(CONFIG_MPC885ADS)		+= cuImage.mpc885ads
292595be948SGrant Likelyimage-$(CONFIG_PPC_EP88XC)		+= dtbImage.ep88xc
29325431333SGrant Likelyimage-$(CONFIG_PPC_ADDER875)		+= cuImage.adder875-uboot \
294595be948SGrant Likely					   dtbImage.adder875-redboot
29525431333SGrant Likely
29625431333SGrant Likely# Board ports in arch/powerpc/platform/52xx/Kconfig
297bfee95bbSGrant Likelyimage-$(CONFIG_PPC_LITE5200)		+= cuImage.lite5200 lite5200.dtb
298bfee95bbSGrant Likelyimage-$(CONFIG_PPC_LITE5200)		+= cuImage.lite5200b lite5200b.dtb
299bfee95bbSGrant Likelyimage-$(CONFIG_PPC_MEDIA5200)		+= cuImage.media5200 media5200.dtb
30025431333SGrant Likely
30125431333SGrant Likely# Board ports in arch/powerpc/platform/82xx/Kconfig
30225431333SGrant Likelyimage-$(CONFIG_MPC8272_ADS)		+= cuImage.mpc8272ads
30325431333SGrant Likelyimage-$(CONFIG_PQ2FADS)			+= cuImage.pq2fads
304595be948SGrant Likelyimage-$(CONFIG_EP8248E)			+= dtbImage.ep8248e
30525431333SGrant Likely
30625431333SGrant Likely# Board ports in arch/powerpc/platform/83xx/Kconfig
30725431333SGrant Likelyimage-$(CONFIG_MPC832x_MDS)		+= cuImage.mpc832x_mds
30825431333SGrant Likelyimage-$(CONFIG_MPC832x_RDB)		+= cuImage.mpc832x_rdb
30925431333SGrant Likelyimage-$(CONFIG_MPC834x_ITX)		+= cuImage.mpc8349emitx \
31025431333SGrant Likely					   cuImage.mpc8349emitxgp
31125431333SGrant Likelyimage-$(CONFIG_MPC834x_MDS)		+= cuImage.mpc834x_mds
31225431333SGrant Likelyimage-$(CONFIG_MPC836x_MDS)		+= cuImage.mpc836x_mds
31359d13f9dSBryan O'Donoghueimage-$(CONFIG_ASP834x)			+= dtbImage.asp834x-redboot
31425431333SGrant Likely
31525431333SGrant Likely# Board ports in arch/powerpc/platform/85xx/Kconfig
31625431333SGrant Likelyimage-$(CONFIG_MPC8540_ADS)		+= cuImage.mpc8540ads
31725431333SGrant Likelyimage-$(CONFIG_MPC8560_ADS)		+= cuImage.mpc8560ads
31825431333SGrant Likelyimage-$(CONFIG_MPC85xx_CDS)		+= cuImage.mpc8541cds \
3190d4fdd32SZhao Chenhui					   cuImage.mpc8548cds_32b \
32025431333SGrant Likely					   cuImage.mpc8555cds
32125431333SGrant Likelyimage-$(CONFIG_MPC85xx_MDS)		+= cuImage.mpc8568mds
32225431333SGrant Likelyimage-$(CONFIG_MPC85xx_DS)		+= cuImage.mpc8544ds \
32325431333SGrant Likely					   cuImage.mpc8572ds
32425431333SGrant Likelyimage-$(CONFIG_TQM8540)			+= cuImage.tqm8540
32525431333SGrant Likelyimage-$(CONFIG_TQM8541)			+= cuImage.tqm8541
3266dd1b64aSWolfgang Grandeggerimage-$(CONFIG_TQM8548)			+= cuImage.tqm8548
32725431333SGrant Likelyimage-$(CONFIG_TQM8555)			+= cuImage.tqm8555
32825431333SGrant Likelyimage-$(CONFIG_TQM8560)			+= cuImage.tqm8560
329a72a6f53SPaul Gortmakerimage-$(CONFIG_SBC8548)			+= cuImage.sbc8548
330ff880112SAlexandr Smirnovimage-$(CONFIG_KSI8560)			+= cuImage.ksi8560
33125431333SGrant Likely
33297493e2eSAlessio Igor Bogani# Board ports in arch/powerpc/platform/86xx/Kconfig
33397493e2eSAlessio Igor Boganiimage-$(CONFIG_MVME7100)                += dtbImage.mvme7100
33497493e2eSAlessio Igor Bogani
33525431333SGrant Likely# Board ports in arch/powerpc/platform/embedded6xx/Kconfig
33625431333SGrant Likelyimage-$(CONFIG_STORCENTER)		+= cuImage.storcenter
33725431333SGrant Likelyimage-$(CONFIG_MPC7448HPC2)		+= cuImage.mpc7448hpc2
338c6ec08e0SRemi Machetimage-$(CONFIG_PPC_C2K)			+= cuImage.c2k
339b68a24bcSAlbert Herranzimage-$(CONFIG_GAMECUBE)		+= dtbImage.gamecube
3406cdd2417SAlbert Herranzimage-$(CONFIG_WII)			+= dtbImage.wii
341be201981SStephen Chiversimage-$(CONFIG_MVME5100)		+= dtbImage.mvme5100
342b09c1644SScott Wood
3438f23735dSGerhard Pircher# Board port in arch/powerpc/platform/amigaone/Kconfig
3448f23735dSGerhard Pircherimage-$(CONFIG_AMIGAONE)		+= cuImage.amigaone
3458f23735dSGerhard Pircher
3469216ad8cSPaul Mackerras# For 32-bit powermacs, build the COFF and miboot images
3479216ad8cSPaul Mackerras# as well as the ELF images.
3482bf11819SPaul Mackerrasifeq ($(CONFIG_PPC32),y)
3492bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC)	+= zImage.coff zImage.miboot
3502bf11819SPaul Mackerrasendif
35166a45dd3SPaul Mackerras
352c356aa45SGrant Likely# Allow extra targets to be added to the defconfig
353c356aa45SGrant Likelyimage-y	+= $(subst ",,$(CONFIG_EXTRA_TARGETS))
354c356aa45SGrant Likely
355755457f9SMichal Marekinitrd-  := $(patsubst zImage%, zImage.initrd%, $(image-))
356f6dfc805SDavid Gibsoninitrd-y := $(patsubst zImage%, zImage.initrd%, \
357595be948SGrant Likely		$(patsubst dtbImage%, dtbImage.initrd%, \
3585d1a0411SJohn Linn		$(patsubst simpleImage%, simpleImage.initrd%, \
3595d1a0411SJohn Linn		$(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
3609da82a6dSMilton Millerinitrd-y := $(filter-out $(image-y), $(initrd-y))
361235fd835SMilton Millertargets	+= $(image-y) $(initrd-y)
36294b212c2SPaul Mackerras
3639da82a6dSMilton Miller$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
3649da82a6dSMilton Miller
3659da82a6dSMilton Miller# Don't put the ramdisk on the pattern rule; when its missing make will try
3669da82a6dSMilton Miller# the pattern rule with less dependencies that also matches (even with the
3679da82a6dSMilton Miller# hard dependency listed).
36842d0c932SMichael Ellerman$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) FORCE
36925431333SGrant Likely	$(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
3709da82a6dSMilton Miller
37142d0c932SMichael Ellerman$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits) FORCE
372699c659bSMichal Marek	$(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
37325431333SGrant Likely
374595be948SGrant Likely# dtbImage% - a dtbImage is a zImage with an embedded device tree blob
37542d0c932SMichael Ellerman$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE
376e04018e8SGrant Likely	$(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
37725431333SGrant Likely
37842d0c932SMichael Ellerman$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE
379e04018e8SGrant Likely	$(call if_changed,wrap,$*,,$(obj)/$*.dtb)
3809da82a6dSMilton Miller
3814bb09281STony Breeds# This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
3824bb09281STony Breeds# prefix
3834bb09281STony Breeds$(obj)/vmlinux.strip: vmlinux
3844bb09281STony Breeds	$(STRIP) -s -R .comment $< -o $@
3854bb09281STony Breeds
38642d0c932SMichael Ellerman$(obj)/uImage: vmlinux $(wrapperbits) FORCE
3879da82a6dSMilton Miller	$(call if_changed,wrap,uboot)
3889da82a6dSMilton Miller
38942d0c932SMichael Ellerman$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
39011eab297SBenjamin Herrenschmidt	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
39111eab297SBenjamin Herrenschmidt
39242d0c932SMichael Ellerman$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
39311eab297SBenjamin Herrenschmidt	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
39411eab297SBenjamin Herrenschmidt
39542d0c932SMichael Ellerman$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
396a4292d7aSGrant Likely	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
397a4292d7aSGrant Likely
39842d0c932SMichael Ellerman$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
399e04018e8SGrant Likely	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
4000fdd717eSScott Wood
40142d0c932SMichael Ellerman$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
402d2477b5cSGrant Likely	$(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
403d2477b5cSGrant Likely
40442d0c932SMichael Ellerman$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
405d2477b5cSGrant Likely	$(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb)
406d2477b5cSGrant Likely
40742d0c932SMichael Ellerman$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
408e04018e8SGrant Likely	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
409f6dfc805SDavid Gibson
41042d0c932SMichael Ellerman$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
411e04018e8SGrant Likely	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
412e04018e8SGrant Likely
413e04018e8SGrant Likely# Rule to build device tree blobs
4147c431851SStephen Warren$(obj)/%.dtb: $(src)/dts/%.dts FORCE
4157c431851SStephen Warren	$(call if_changed_dep,dtc)
4166a32d085SDavid Gibson
4174680c9d5SAlessio Igor Bogani$(obj)/%.dtb: $(src)/dts/fsl/%.dts FORCE
4184680c9d5SAlessio Igor Bogani	$(call if_changed_dep,dtc)
4194680c9d5SAlessio Igor Bogani
4204bb09281STony Breeds# If there isn't a platform selected then just strip the vmlinux.
4214bb09281STony Breedsifeq (,$(image-y))
4224bb09281STony Breedsimage-y := vmlinux.strip
4234bb09281STony Breedsendif
4244bb09281STony Breeds
4252bf11819SPaul Mackerras$(obj)/zImage:		$(addprefix $(obj)/, $(image-y))
4266abe248eSMichael Ellerman	$(Q)rm -f $@; ln $< $@
4272bf11819SPaul Mackerras$(obj)/zImage.initrd:	$(addprefix $(obj)/, $(initrd-y))
4286abe248eSMichael Ellerman	$(Q)rm -f $@; ln $< $@
42994b212c2SPaul Mackerras
430c913e5f9STony Breeds# Only install the vmlinux
431928370c6SAkinobu Mitainstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
432c913e5f9STony Breeds	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)"
433c913e5f9STony Breeds
434c913e5f9STony Breeds# Install the vmlinux and other built boot targets.
435c913e5f9STony BreedszInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
43629f1aff2SGrant Likely	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
43766a45dd3SPaul Mackerras
4381383a34fSMilton Miller# anything not in $(targets)
439b58a4575SKumar Galaclean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
440b58a4575SKumar Gala	zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
4411b041885SStephen Rothwell	zImage.miboot zImage.pmac zImage.pseries \
44258706ef9SCorey Minyard	zImage.maple simpleImage.* otheros.bld *.dtb
4431383a34fSMilton Miller
4441383a34fSMilton Miller# clean up files cached by wrapper
4451b7898eeSOliver O'Halloranclean-kernel-base := vmlinux.strip vmlinux.bin
4461b7898eeSOliver O'Halloranclean-kernel := $(addsuffix .gz,$(clean-kernel-base))
447c762c69eSOliver O'Halloranclean-kernel += $(addsuffix .xz,$(clean-kernel-base))
4481383a34fSMilton Miller# If not absolute clean-files are relative to $(obj).
4491383a34fSMilton Millerclean-files += $(addprefix $(objtree)/, $(clean-kernel))
450773f76b1SDavid Woodhouse
451773f76b1SDavid WoodhouseWRAPPER_OBJDIR := /usr/lib/kernel-wrapper
452773f76b1SDavid WoodhouseWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
453773f76b1SDavid WoodhouseWRAPPER_BINDIR := /usr/sbin
454773f76b1SDavid WoodhouseINSTALL := install
455773f76b1SDavid Woodhouse
456773f76b1SDavid Woodhouseextra-installed		:= $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
457773f76b1SDavid Woodhousehostprogs-installed	:= $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
458773f76b1SDavid Woodhousewrapper-installed	:= $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
4594d9ef89dSBen Hutchingsdts-installed		:= $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
460773f76b1SDavid Woodhouse
461773f76b1SDavid Woodhouseall-installed		:= $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
462773f76b1SDavid Woodhouse
463773f76b1SDavid Woodhousequiet_cmd_mkdir           = MKDIR   $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
464773f76b1SDavid Woodhouse      cmd_mkdir           = mkdir -p $@
465773f76b1SDavid Woodhouse
466773f76b1SDavid Woodhousequiet_cmd_install	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
467773f76b1SDavid Woodhouse      cmd_install	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
468773f76b1SDavid Woodhouse
469773f76b1SDavid Woodhousequiet_cmd_install_dts	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
470773f76b1SDavid Woodhouse      cmd_install_dts	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
471773f76b1SDavid Woodhouse
472773f76b1SDavid Woodhousequiet_cmd_install_exe	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
473773f76b1SDavid Woodhouse      cmd_install_exe	  = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
474773f76b1SDavid Woodhouse
475773f76b1SDavid Woodhousequiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
476773f76b1SDavid Woodhouse      cmd_install_wrapper = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
477773f76b1SDavid Woodhouse				sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
478773f76b1SDavid Woodhouse					  -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
479773f76b1SDavid Woodhouse
480773f76b1SDavid Woodhouse
481773f76b1SDavid Woodhouse$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
482773f76b1SDavid Woodhouse	$(call cmd,mkdir)
483773f76b1SDavid Woodhouse
484773f76b1SDavid Woodhouse$(extra-installed)	: $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
485773f76b1SDavid Woodhouse	$(call cmd,install)
486773f76b1SDavid Woodhouse
487773f76b1SDavid Woodhouse$(hostprogs-installed)  : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
488773f76b1SDavid Woodhouse	$(call cmd,install_exe)
489773f76b1SDavid Woodhouse
490773f76b1SDavid Woodhouse$(dts-installed)	: $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
491773f76b1SDavid Woodhouse	$(call cmd,install_dts)
492773f76b1SDavid Woodhouse
493773f76b1SDavid Woodhouse$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
494773f76b1SDavid Woodhouse	$(call cmd,install_wrapper)
495773f76b1SDavid Woodhouse
496773f76b1SDavid Woodhouse$(obj)/bootwrapper_install: $(all-installed)
497