xref: /linux/arch/powerpc/boot/Makefile (revision 295e742734179380fbd977a113e0182cc3fa9fb0)
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
22b610b978SDavid GibsonBOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
23b610b978SDavid Gibson		 -fno-strict-aliasing -Os -msoft-float -pipe \
24b610b978SDavid Gibson		 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
25b610b978SDavid Gibson		 -isystem $(shell $(CROSS32CC) -print-file-name=include)
2694b212c2SPaul MackerrasBOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
2794b212c2SPaul Mackerras
28105c13ddSGrant Likelyifdef CONFIG_DEBUG_INFO
29105c13ddSGrant LikelyBOOTCFLAGS	+= -g
30105c13ddSGrant Likelyendif
31105c13ddSGrant Likely
32fda7ffd2SNiels Kristian Bech Jensenifeq ($(call cc-option-yn, -fstack-protector),y)
33fda7ffd2SNiels Kristian Bech JensenBOOTCFLAGS	+= -fno-stack-protector
34fda7ffd2SNiels Kristian Bech Jensenendif
35fda7ffd2SNiels Kristian Bech Jensen
362f0dfeaaSDavid GibsonBOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt
3794b212c2SPaul Mackerras
38869680c1SJosh Boyer$(obj)/4xx.o: BOOTCFLAGS += -mcpu=440
39988519acSDavid Gibson$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
406bbc5476SHugh Blemings$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440
413de9c9cdSBenjamin Herrenschmidt$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
422e71cc0dSJosh Boyer$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
4360e41753SJosh Boyer
446bbc5476SHugh Blemings
452bf11819SPaul Mackerraszlib       := inffast.c inflate.c inftrees.c
462bf11819SPaul Mackerraszlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
472bf11819SPaul Mackerraszliblinuxheader := zlib.h zconf.h zutil.h
482bf11819SPaul Mackerras
49d25a9d66SDavid Gibson$(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \
50d25a9d66SDavid Gibson	$(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
512bf11819SPaul Mackerras
522f0dfeaaSDavid Gibsonsrc-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
53430b01e8SDavid Gibsonsrc-wlib := string.S crt0.S stdio.c main.c \
542f0dfeaaSDavid Gibson		$(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \
55ad9d2716SDavid Gibson		ns16550.c serial.c simple_alloc.c div64.S util.S \
562e601613SDavid Gibson		gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
57d0f53fafSScott Wood		4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
58bbc6fac3SScott Wood		cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
59bbc6fac3SScott Wood		fsl-soc.c mpc8xx.c pq2.c
6085498ae8SGrant Likelysrc-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \
61bafdb645SGeoff Levand		cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
62606d08bcSValentine Barshak		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
6311c146ccSScott Wood		cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c cuboot-bamboo.c \
643de9c9cdSBenjamin Herrenschmidt		fixed-head.S ep88xc.c cuboot-hpc2.c ep405.c cuboot-taishan.c \
65*295e7427SValentine Barshak		cuboot-katmai.c cuboot-rainier.c
66cd197ffcSDavid Gibsonsrc-boot := $(src-wlib) $(src-plat) empty.c
672bf11819SPaul Mackerras
682bf11819SPaul Mackerrassrc-boot := $(addprefix $(obj)/, $(src-boot))
692bf11819SPaul Mackerrasobj-boot := $(addsuffix .o, $(basename $(src-boot)))
702bf11819SPaul Mackerrasobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
712bf11819SPaul Mackerrasobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
722bf11819SPaul Mackerras
7394b212c2SPaul Mackerrasquiet_cmd_copy_zlib = COPY    $@
7467ccd2fcSSegher Boessenkool      cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
7594b212c2SPaul Mackerras
7694b212c2SPaul Mackerrasquiet_cmd_copy_zlibheader = COPY    $@
7767ccd2fcSSegher Boessenkool      cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
7894b212c2SPaul Mackerras# stddef.h for NULL
7994b212c2SPaul Mackerrasquiet_cmd_copy_zliblinuxheader = COPY    $@
8067ccd2fcSSegher Boessenkool      cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
8194b212c2SPaul Mackerras
8294b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
8394b212c2SPaul Mackerras	$(call cmd,copy_zlib)
8494b212c2SPaul Mackerras
8594b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
8694b212c2SPaul Mackerras	$(call cmd,copy_zlibheader)
8794b212c2SPaul Mackerras
8894b212c2SPaul Mackerras$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
8994b212c2SPaul Mackerras	$(call cmd,copy_zliblinuxheader)
9094b212c2SPaul Mackerras
912bf11819SPaul Mackerras$(obj)/empty.c:
922bf11819SPaul Mackerras	@touch $@
9394b212c2SPaul Mackerras
94bafdb645SGeoff Levand$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S
952bf11819SPaul Mackerras	@cp $< $@
962bf11819SPaul Mackerras
972bf11819SPaul Mackerrasclean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
98bafdb645SGeoff Levand		empty.c zImage zImage.coff.lds zImage.ps3.lds zImage.lds
9994b212c2SPaul Mackerras
10094b212c2SPaul Mackerrasquiet_cmd_bootcc = BOOTCC  $@
10194b212c2SPaul Mackerras      cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
10294b212c2SPaul Mackerras
10394b212c2SPaul Mackerrasquiet_cmd_bootas = BOOTAS  $@
10494b212c2SPaul Mackerras      cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
10594b212c2SPaul Mackerras
1062bf11819SPaul Mackerrasquiet_cmd_bootar = BOOTAR  $@
107235fd835SMilton Miller      cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
10894b212c2SPaul Mackerras
109235fd835SMilton Miller$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
1102f0dfeaaSDavid Gibson	$(Q)mkdir -p $(dir $@)
11194b212c2SPaul Mackerras	$(call if_changed_dep,bootcc)
112235fd835SMilton Miller$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
1132f0dfeaaSDavid Gibson	$(Q)mkdir -p $(dir $@)
11494b212c2SPaul Mackerras	$(call if_changed_dep,bootas)
11594b212c2SPaul Mackerras
116235fd835SMilton Miller$(obj)/wrapper.a: $(obj-wlib) FORCE
117235fd835SMilton Miller	$(call if_changed,bootar)
11894b212c2SPaul Mackerras
119e2dc87a1SDavid Gibsonhostprogs-y	:= addnote addRamDisk hack-coff mktree dtc
12066a45dd3SPaul Mackerras
121235fd835SMilton Millertargets		+= $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
122cd197ffcSDavid Gibsonextra-y		:= $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
123bafdb645SGeoff Levand		   $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
12494b212c2SPaul Mackerras
1252bf11819SPaul Mackerraswrapper		:=$(srctree)/$(src)/wrapper
126e2dc87a1SDavid Gibsonwrapperbits	:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \
127235fd835SMilton Miller			$(wrapper) FORCE
12894b212c2SPaul Mackerras
1292bf11819SPaul Mackerras#############
130e2dc87a1SDavid Gibson# Bits for building dtc
131e2dc87a1SDavid Gibson# DTC_GENPARSER      := 1    # Uncomment to rebuild flex/bison output
132e2dc87a1SDavid Gibson
133e2dc87a1SDavid Gibsondtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o
134e2dc87a1SDavid Gibsondtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
135e2dc87a1SDavid Gibsondtc-objs := $(addprefix dtc-src/, $(dtc-objs))
136e2dc87a1SDavid Gibson
137e2dc87a1SDavid Gibson# prerequisites on generated files needs to be explicit
138e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h
139e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.o:  $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h
140e2dc87a1SDavid Gibson
141e2dc87a1SDavid GibsonHOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/
142e2dc87a1SDavid Gibson
143e2dc87a1SDavid Gibsontargets += dtc-src/dtc-parser.tab.c
144e2dc87a1SDavid Gibsontargets += dtc-src/dtc-lexer.lex.c
145e2dc87a1SDavid Gibson
146e2dc87a1SDavid Gibsonifdef DTC_GENPARSER
147e2dc87a1SDavid GibsonBISON = bison
148e2dc87a1SDavid GibsonFLEX = flex
149e2dc87a1SDavid Gibson
150e2dc87a1SDavid Gibsonquiet_cmd_bison = BISON   $@
151e2dc87a1SDavid Gibson      cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped
152e2dc87a1SDavid Gibsonquiet_cmd_flex = FLEX    $@
153e2dc87a1SDavid Gibson      cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
154e2dc87a1SDavid Gibson
155e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE
156e2dc87a1SDavid Gibson     $(call if_changed,bison)
157e2dc87a1SDavid Gibson
158e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c
159e2dc87a1SDavid Gibson
160e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE
161e2dc87a1SDavid Gibson     $(call if_changed,flex)
162e2dc87a1SDavid Gibsonendif
163e2dc87a1SDavid Gibson
164e2dc87a1SDavid Gibson#############
1652bf11819SPaul Mackerras# Bits for building various flavours of zImage
16694b212c2SPaul Mackerras
1672bf11819SPaul Mackerrasifneq ($(CROSS32_COMPILE),)
168dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS32_COMPILE)"
1692bf11819SPaul Mackerraselse
1702bf11819SPaul Mackerrasifneq ($(CROSS_COMPILE),)
171dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS_COMPILE)"
1722bf11819SPaul Mackerrasendif
1732bf11819SPaul Mackerrasendif
17494b212c2SPaul Mackerras
1759da82a6dSMilton Miller# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
1762bf11819SPaul Mackerrasquiet_cmd_wrap	= WRAP    $@
1779da82a6dSMilton Miller      cmd_wrap	=$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
1789da82a6dSMilton Miller		$(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux
1792bf11819SPaul Mackerras
1802bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PSERIES)		+= zImage.pseries
1812bf11819SPaul Mackerrasimage-$(CONFIG_PPC_MAPLE)		+= zImage.pseries
182020533efSGeoff Levandimage-$(CONFIG_PPC_IBM_CELL_BLADE)	+= zImage.pseries
1838a8944aaSGeoff Levandimage-$(CONFIG_PPC_PS3)			+= zImage.ps3
184c347b798SIshizaki Kouimage-$(CONFIG_PPC_CELLEB)		+= zImage.pseries
1852bf11819SPaul Mackerrasimage-$(CONFIG_PPC_CHRP)		+= zImage.chrp
1867839af33SNicolas DETimage-$(CONFIG_PPC_EFIKA)		+= zImage.chrp
1872bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC)		+= zImage.pmac
188b0e80206SMark A. Greerimage-$(CONFIG_PPC_HOLLY)		+= zImage.holly
189c368d921SMark A. Greerimage-$(CONFIG_PPC_PRPMC2800)		+= zImage.prpmc2800
1900570d4edSStephen Rothwellimage-$(CONFIG_PPC_ISERIES)		+= zImage.iseries
191ac18c673SScott Woodimage-$(CONFIG_DEFAULT_UIMAGE)		+= uImage
192ac18c673SScott Wood
193ac18c673SScott Woodifneq ($(CONFIG_DEVICE_TREE),"")
1940b195812SScott Woodimage-$(CONFIG_PPC_8xx)			+= cuImage.8xx
19511c146ccSScott Woodimage-$(CONFIG_PPC_EP88XC)		+= zImage.ep88xc
19661974038SBenjamin Herrenschmidtimage-$(CONFIG_EP405)			+= zImage.ep405
197e5d8d54dSScott Woodimage-$(CONFIG_8260)			+= cuImage.pq2
19885498ae8SGrant Likelyimage-$(CONFIG_PPC_MPC52xx)		+= cuImage.52xx
199a6afacb6SDavid Gibsonimage-$(CONFIG_PPC_83xx)		+= cuImage.83xx
200a6afacb6SDavid Gibsonimage-$(CONFIG_PPC_85xx)		+= cuImage.85xx
201c4e05bc5SRoy Zangimage-$(CONFIG_MPC7448HPC2)		+= cuImage.hpc2
202f6dfc805SDavid Gibsonimage-$(CONFIG_EBONY)			+= treeImage.ebony cuImage.ebony
203658e8170SJosh Boyerimage-$(CONFIG_BAMBOO)			+= treeImage.bamboo cuImage.bamboo
204606d08bcSValentine Barshakimage-$(CONFIG_SEQUOIA)			+= cuImage.sequoia
205*295e7427SValentine Barshakimage-$(CONFIG_RAINIER)			+= cuImage.rainier
2065326152fSJosh Boyerimage-$(CONFIG_WALNUT)			+= treeImage.walnut
2076bbc5476SHugh Blemingsimage-$(CONFIG_TAISHAN)			+= cuImage.taishan
2083de9c9cdSBenjamin Herrenschmidtimage-$(CONFIG_KATMAI)			+= cuImage.katmai
209ac18c673SScott Woodendif
21094b212c2SPaul Mackerras
2119216ad8cSPaul Mackerras# For 32-bit powermacs, build the COFF and miboot images
2129216ad8cSPaul Mackerras# as well as the ELF images.
2132bf11819SPaul Mackerrasifeq ($(CONFIG_PPC32),y)
2142bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC)	+= zImage.coff zImage.miboot
2152bf11819SPaul Mackerrasendif
21666a45dd3SPaul Mackerras
2175d7960ffSMilton Millerinitrd-  := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
218f6dfc805SDavid Gibsoninitrd-y := $(patsubst zImage%, zImage.initrd%, \
219f6dfc805SDavid Gibson		$(patsubst treeImage%, treeImage.initrd%, $(image-y)))
2209da82a6dSMilton Millerinitrd-y := $(filter-out $(image-y), $(initrd-y))
221235fd835SMilton Millertargets	+= $(image-y) $(initrd-y)
22294b212c2SPaul Mackerras
2239da82a6dSMilton Miller$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
2249da82a6dSMilton Miller
225a00cec48SMark A. Greer# If CONFIG_WANT_DEVICE_TREE is set and CONFIG_DEVICE_TREE isn't an
226a00cec48SMark A. Greer# empty string, define 'dts' to be path to the dts
227a00cec48SMark A. Greer# CONFIG_DEVICE_TREE will have "" around it, make sure to strip them
228a00cec48SMark A. Greerifeq ($(CONFIG_WANT_DEVICE_TREE),y)
229a00cec48SMark A. Greerifneq ($(CONFIG_DEVICE_TREE),"")
230a00cec48SMark A. Greerdts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\
231a00cec48SMark A. Greer	,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE:"%"=%)
232a00cec48SMark A. Greerendif
233a00cec48SMark A. Greerendif
234a00cec48SMark A. Greer
2359da82a6dSMilton Miller# Don't put the ramdisk on the pattern rule; when its missing make will try
2369da82a6dSMilton Miller# the pattern rule with less dependencies that also matches (even with the
2379da82a6dSMilton Miller# hard dependency listed).
238a00cec48SMark A. Greer$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) $(dts)
239a00cec48SMark A. Greer	$(call if_changed,wrap,$*,$(dts),,$(obj)/ramdisk.image.gz)
2409da82a6dSMilton Miller
241a00cec48SMark A. Greer$(obj)/zImage.%: vmlinux $(wrapperbits) $(dts)
242a00cec48SMark A. Greer	$(call if_changed,wrap,$*,$(dts))
2439da82a6dSMilton Miller
2444bb09281STony Breeds# This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
2454bb09281STony Breeds# prefix
2464bb09281STony Breeds$(obj)/vmlinux.strip: vmlinux
2474bb09281STony Breeds	$(STRIP) -s -R .comment $< -o $@
2484bb09281STony Breeds
2490570d4edSStephen Rothwell$(obj)/zImage.iseries: vmlinux
2500570d4edSStephen Rothwell	$(STRIP) -s -R .comment $< -o $@
2510570d4edSStephen Rothwell
252bafdb645SGeoff Levand$(obj)/zImage.ps3: vmlinux  $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts
253bafdb645SGeoff Levand	$(STRIP) -s -R .comment $< -o vmlinux.strip
254bafdb645SGeoff Levand	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,)
2559da82a6dSMilton Miller
256bafdb645SGeoff Levand$(obj)/zImage.initrd.ps3: vmlinux  $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts $(obj)/ramdisk.image.gz
257bafdb645SGeoff Levand	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,$(obj)/ramdisk.image.gz)
2589da82a6dSMilton Miller
2599da82a6dSMilton Miller$(obj)/uImage: vmlinux $(wrapperbits)
2609da82a6dSMilton Miller	$(call if_changed,wrap,uboot)
2619da82a6dSMilton Miller
262d25a9d66SDavid Gibson$(obj)/cuImage.%: vmlinux $(dts) $(wrapperbits)
263a6afacb6SDavid Gibson	$(call if_changed,wrap,cuboot-$*,$(dts))
2640fdd717eSScott Wood
265f6dfc805SDavid Gibson$(obj)/treeImage.initrd.%: vmlinux $(dts) $(wrapperbits)
266f6dfc805SDavid Gibson	$(call if_changed,wrap,treeboot-$*,$(dts),,$(obj)/ramdisk.image.gz)
267f6dfc805SDavid Gibson
2686a32d085SDavid Gibson$(obj)/treeImage.%: vmlinux $(dts) $(wrapperbits)
2696a32d085SDavid Gibson	$(call if_changed,wrap,treeboot-$*,$(dts))
2706a32d085SDavid Gibson
2714bb09281STony Breeds# If there isn't a platform selected then just strip the vmlinux.
2724bb09281STony Breedsifeq (,$(image-y))
2734bb09281STony Breedsimage-y := vmlinux.strip
2744bb09281STony Breedsendif
2754bb09281STony Breeds
2762bf11819SPaul Mackerras$(obj)/zImage:		$(addprefix $(obj)/, $(image-y))
2772bf11819SPaul Mackerras	@rm -f $@; ln $< $@
2782bf11819SPaul Mackerras$(obj)/zImage.initrd:	$(addprefix $(obj)/, $(initrd-y))
2792bf11819SPaul Mackerras	@rm -f $@; ln $< $@
28094b212c2SPaul Mackerras
281928370c6SAkinobu Mitainstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
2822bf11819SPaul Mackerras	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
28366a45dd3SPaul Mackerras
2841383a34fSMilton Miller# anything not in $(targets)
285bafdb645SGeoff Levandclean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* \
286bafdb645SGeoff Levand	otheros.bld
2871383a34fSMilton Miller
2881383a34fSMilton Miller# clean up files cached by wrapper
2891383a34fSMilton Millerclean-kernel := vmlinux.strip vmlinux.bin
2901383a34fSMilton Millerclean-kernel += $(addsuffix .gz,$(clean-kernel))
2911383a34fSMilton Miller# If not absolute clean-files are relative to $(obj).
2921383a34fSMilton Millerclean-files += $(addprefix $(objtree)/, $(clean-kernel))
293773f76b1SDavid Woodhouse
294773f76b1SDavid WoodhouseWRAPPER_OBJDIR := /usr/lib/kernel-wrapper
295773f76b1SDavid WoodhouseWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
296773f76b1SDavid WoodhouseWRAPPER_BINDIR := /usr/sbin
297773f76b1SDavid WoodhouseINSTALL := install
298773f76b1SDavid Woodhouse
299773f76b1SDavid Woodhouseextra-installed		:= $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
300773f76b1SDavid Woodhousehostprogs-installed	:= $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
301773f76b1SDavid Woodhousewrapper-installed	:= $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
302773f76b1SDavid Woodhousedts-installed		:= $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts))
303773f76b1SDavid Woodhouse
304773f76b1SDavid Woodhouseall-installed		:= $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
305773f76b1SDavid Woodhouse
306773f76b1SDavid Woodhousequiet_cmd_mkdir           = MKDIR   $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
307773f76b1SDavid Woodhouse      cmd_mkdir           = mkdir -p $@
308773f76b1SDavid Woodhouse
309773f76b1SDavid Woodhousequiet_cmd_install	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
310773f76b1SDavid Woodhouse      cmd_install	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
311773f76b1SDavid Woodhouse
312773f76b1SDavid Woodhousequiet_cmd_install_dts	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
313773f76b1SDavid Woodhouse      cmd_install_dts	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
314773f76b1SDavid Woodhouse
315773f76b1SDavid Woodhousequiet_cmd_install_exe	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
316773f76b1SDavid Woodhouse      cmd_install_exe	  = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
317773f76b1SDavid Woodhouse
318773f76b1SDavid Woodhousequiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
319773f76b1SDavid Woodhouse      cmd_install_wrapper = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
320773f76b1SDavid Woodhouse				sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
321773f76b1SDavid Woodhouse					  -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
322773f76b1SDavid Woodhouse
323773f76b1SDavid Woodhouse
324773f76b1SDavid Woodhouse$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
325773f76b1SDavid Woodhouse	$(call cmd,mkdir)
326773f76b1SDavid Woodhouse
327773f76b1SDavid Woodhouse$(extra-installed)	: $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
328773f76b1SDavid Woodhouse	$(call cmd,install)
329773f76b1SDavid Woodhouse
330773f76b1SDavid Woodhouse$(hostprogs-installed)  : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
331773f76b1SDavid Woodhouse	$(call cmd,install_exe)
332773f76b1SDavid Woodhouse
333773f76b1SDavid Woodhouse$(dts-installed)	: $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
334773f76b1SDavid Woodhouse	$(call cmd,install_dts)
335773f76b1SDavid Woodhouse
336773f76b1SDavid Woodhouse$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
337773f76b1SDavid Woodhouse	$(call cmd,install_wrapper)
338773f76b1SDavid Woodhouse
339773f76b1SDavid Woodhouse$(obj)/bootwrapper_install: $(all-installed)
340773f76b1SDavid Woodhouse
341