xref: /linux/arch/powerpc/boot/Makefile (revision 1e12f3c59d045b152d4482f8b6ab19573e869c40)
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
603490cba5SJon Loeligersrc-plat := of.c cuboot-52xx.c cuboot-824x.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*1e12f3c5SSean MacLennan		cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
66*1e12f3c5SSean MacLennan		cuboot-warp.c
67cd197ffcSDavid Gibsonsrc-boot := $(src-wlib) $(src-plat) empty.c
682bf11819SPaul Mackerras
692bf11819SPaul Mackerrassrc-boot := $(addprefix $(obj)/, $(src-boot))
702bf11819SPaul Mackerrasobj-boot := $(addsuffix .o, $(basename $(src-boot)))
712bf11819SPaul Mackerrasobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
722bf11819SPaul Mackerrasobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
732bf11819SPaul Mackerras
7494b212c2SPaul Mackerrasquiet_cmd_copy_zlib = COPY    $@
7567ccd2fcSSegher Boessenkool      cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
7694b212c2SPaul Mackerras
7794b212c2SPaul Mackerrasquiet_cmd_copy_zlibheader = COPY    $@
7867ccd2fcSSegher Boessenkool      cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
7994b212c2SPaul Mackerras# stddef.h for NULL
8094b212c2SPaul Mackerrasquiet_cmd_copy_zliblinuxheader = COPY    $@
8167ccd2fcSSegher Boessenkool      cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
8294b212c2SPaul Mackerras
8394b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
8494b212c2SPaul Mackerras	$(call cmd,copy_zlib)
8594b212c2SPaul Mackerras
8694b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
8794b212c2SPaul Mackerras	$(call cmd,copy_zlibheader)
8894b212c2SPaul Mackerras
8994b212c2SPaul Mackerras$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
9094b212c2SPaul Mackerras	$(call cmd,copy_zliblinuxheader)
9194b212c2SPaul Mackerras
922bf11819SPaul Mackerras$(obj)/empty.c:
932bf11819SPaul Mackerras	@touch $@
9494b212c2SPaul Mackerras
95bafdb645SGeoff Levand$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S
962bf11819SPaul Mackerras	@cp $< $@
972bf11819SPaul Mackerras
982bf11819SPaul Mackerrasclean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
99bafdb645SGeoff Levand		empty.c zImage zImage.coff.lds zImage.ps3.lds zImage.lds
10094b212c2SPaul Mackerras
10194b212c2SPaul Mackerrasquiet_cmd_bootcc = BOOTCC  $@
10294b212c2SPaul Mackerras      cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
10394b212c2SPaul Mackerras
10494b212c2SPaul Mackerrasquiet_cmd_bootas = BOOTAS  $@
10594b212c2SPaul Mackerras      cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
10694b212c2SPaul Mackerras
1072bf11819SPaul Mackerrasquiet_cmd_bootar = BOOTAR  $@
108235fd835SMilton Miller      cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
10994b212c2SPaul Mackerras
110235fd835SMilton Miller$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
1112f0dfeaaSDavid Gibson	$(Q)mkdir -p $(dir $@)
11294b212c2SPaul Mackerras	$(call if_changed_dep,bootcc)
113235fd835SMilton Miller$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
1142f0dfeaaSDavid Gibson	$(Q)mkdir -p $(dir $@)
11594b212c2SPaul Mackerras	$(call if_changed_dep,bootas)
11694b212c2SPaul Mackerras
117235fd835SMilton Miller$(obj)/wrapper.a: $(obj-wlib) FORCE
118235fd835SMilton Miller	$(call if_changed,bootar)
11994b212c2SPaul Mackerras
120e2dc87a1SDavid Gibsonhostprogs-y	:= addnote addRamDisk hack-coff mktree dtc
12166a45dd3SPaul Mackerras
122235fd835SMilton Millertargets		+= $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
123cd197ffcSDavid Gibsonextra-y		:= $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
124bafdb645SGeoff Levand		   $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
12594b212c2SPaul Mackerras
1262bf11819SPaul Mackerraswrapper		:=$(srctree)/$(src)/wrapper
127e2dc87a1SDavid Gibsonwrapperbits	:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \
128235fd835SMilton Miller			$(wrapper) FORCE
12994b212c2SPaul Mackerras
1302bf11819SPaul Mackerras#############
131e2dc87a1SDavid Gibson# Bits for building dtc
132e2dc87a1SDavid Gibson# DTC_GENPARSER      := 1    # Uncomment to rebuild flex/bison output
133e2dc87a1SDavid Gibson
134e2dc87a1SDavid Gibsondtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o
135e2dc87a1SDavid Gibsondtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
136e2dc87a1SDavid Gibsondtc-objs := $(addprefix dtc-src/, $(dtc-objs))
137e2dc87a1SDavid Gibson
138e2dc87a1SDavid Gibson# prerequisites on generated files needs to be explicit
139e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h
140e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.o:  $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h
141e2dc87a1SDavid Gibson
142e2dc87a1SDavid GibsonHOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/
143e2dc87a1SDavid Gibson
144e2dc87a1SDavid Gibsontargets += dtc-src/dtc-parser.tab.c
145e2dc87a1SDavid Gibsontargets += dtc-src/dtc-lexer.lex.c
146e2dc87a1SDavid Gibson
147e2dc87a1SDavid Gibsonifdef DTC_GENPARSER
148e2dc87a1SDavid GibsonBISON = bison
149e2dc87a1SDavid GibsonFLEX = flex
150e2dc87a1SDavid Gibson
151e2dc87a1SDavid Gibsonquiet_cmd_bison = BISON   $@
152e2dc87a1SDavid Gibson      cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped
153e2dc87a1SDavid Gibsonquiet_cmd_flex = FLEX    $@
154e2dc87a1SDavid Gibson      cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
155e2dc87a1SDavid Gibson
156e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE
157e2dc87a1SDavid Gibson     $(call if_changed,bison)
158e2dc87a1SDavid Gibson
159e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c
160e2dc87a1SDavid Gibson
161e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE
162e2dc87a1SDavid Gibson     $(call if_changed,flex)
163e2dc87a1SDavid Gibsonendif
164e2dc87a1SDavid Gibson
165e2dc87a1SDavid Gibson#############
1662bf11819SPaul Mackerras# Bits for building various flavours of zImage
16794b212c2SPaul Mackerras
1682bf11819SPaul Mackerrasifneq ($(CROSS32_COMPILE),)
169dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS32_COMPILE)"
1702bf11819SPaul Mackerraselse
1712bf11819SPaul Mackerrasifneq ($(CROSS_COMPILE),)
172dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS_COMPILE)"
1732bf11819SPaul Mackerrasendif
1742bf11819SPaul Mackerrasendif
17594b212c2SPaul Mackerras
1769da82a6dSMilton Miller# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
1772bf11819SPaul Mackerrasquiet_cmd_wrap	= WRAP    $@
1789da82a6dSMilton Miller      cmd_wrap	=$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
1799da82a6dSMilton Miller		$(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux
1802bf11819SPaul Mackerras
1812bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PSERIES)		+= zImage.pseries
1822bf11819SPaul Mackerrasimage-$(CONFIG_PPC_MAPLE)		+= zImage.pseries
183020533efSGeoff Levandimage-$(CONFIG_PPC_IBM_CELL_BLADE)	+= zImage.pseries
1848a8944aaSGeoff Levandimage-$(CONFIG_PPC_PS3)			+= zImage.ps3
185c347b798SIshizaki Kouimage-$(CONFIG_PPC_CELLEB)		+= zImage.pseries
1862bf11819SPaul Mackerrasimage-$(CONFIG_PPC_CHRP)		+= zImage.chrp
1877839af33SNicolas DETimage-$(CONFIG_PPC_EFIKA)		+= zImage.chrp
1882bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC)		+= zImage.pmac
189b0e80206SMark A. Greerimage-$(CONFIG_PPC_HOLLY)		+= zImage.holly
190c368d921SMark A. Greerimage-$(CONFIG_PPC_PRPMC2800)		+= zImage.prpmc2800
1910570d4edSStephen Rothwellimage-$(CONFIG_PPC_ISERIES)		+= zImage.iseries
192ac18c673SScott Woodimage-$(CONFIG_DEFAULT_UIMAGE)		+= uImage
193ac18c673SScott Wood
194ac18c673SScott Woodifneq ($(CONFIG_DEVICE_TREE),"")
1950b195812SScott Woodimage-$(CONFIG_PPC_8xx)			+= cuImage.8xx
19611c146ccSScott Woodimage-$(CONFIG_PPC_EP88XC)		+= zImage.ep88xc
19761974038SBenjamin Herrenschmidtimage-$(CONFIG_EP405)			+= zImage.ep405
198e5d8d54dSScott Woodimage-$(CONFIG_8260)			+= cuImage.pq2
1990dde1a1dSScott Woodimage-$(CONFIG_EP8248E)			+= zImage.ep8248e
20085498ae8SGrant Likelyimage-$(CONFIG_PPC_MPC52xx)		+= cuImage.52xx
2013490cba5SJon Loeligerimage-$(CONFIG_STORCENTER)		+= cuImage.824x
202a6afacb6SDavid Gibsonimage-$(CONFIG_PPC_83xx)		+= cuImage.83xx
203a6afacb6SDavid Gibsonimage-$(CONFIG_PPC_85xx)		+= cuImage.85xx
204c4e05bc5SRoy Zangimage-$(CONFIG_MPC7448HPC2)		+= cuImage.hpc2
205f6dfc805SDavid Gibsonimage-$(CONFIG_EBONY)			+= treeImage.ebony cuImage.ebony
206658e8170SJosh Boyerimage-$(CONFIG_BAMBOO)			+= treeImage.bamboo cuImage.bamboo
207606d08bcSValentine Barshakimage-$(CONFIG_SEQUOIA)			+= cuImage.sequoia
208295e7427SValentine Barshakimage-$(CONFIG_RAINIER)			+= cuImage.rainier
2095326152fSJosh Boyerimage-$(CONFIG_WALNUT)			+= treeImage.walnut
2106bbc5476SHugh Blemingsimage-$(CONFIG_TAISHAN)			+= cuImage.taishan
2113de9c9cdSBenjamin Herrenschmidtimage-$(CONFIG_KATMAI)			+= cuImage.katmai
212*1e12f3c5SSean MacLennanimage-$(CONFIG_WARP)			+= cuImage.warp
213ac18c673SScott Woodendif
21494b212c2SPaul Mackerras
215b09c1644SScott Woodifneq ($(CONFIG_REDBOOT),"")
216b09c1644SScott Woodimage-$(CONFIG_PPC_8xx)			+= zImage.redboot-8xx
217b09c1644SScott Woodendif
218b09c1644SScott Wood
2199216ad8cSPaul Mackerras# For 32-bit powermacs, build the COFF and miboot images
2209216ad8cSPaul Mackerras# as well as the ELF images.
2212bf11819SPaul Mackerrasifeq ($(CONFIG_PPC32),y)
2222bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC)	+= zImage.coff zImage.miboot
2232bf11819SPaul Mackerrasendif
22466a45dd3SPaul Mackerras
2255d7960ffSMilton Millerinitrd-  := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
226f6dfc805SDavid Gibsoninitrd-y := $(patsubst zImage%, zImage.initrd%, \
227f6dfc805SDavid Gibson		$(patsubst treeImage%, treeImage.initrd%, $(image-y)))
2289da82a6dSMilton Millerinitrd-y := $(filter-out $(image-y), $(initrd-y))
229235fd835SMilton Millertargets	+= $(image-y) $(initrd-y)
23094b212c2SPaul Mackerras
2319da82a6dSMilton Miller$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
2329da82a6dSMilton Miller
233a00cec48SMark A. Greer# If CONFIG_WANT_DEVICE_TREE is set and CONFIG_DEVICE_TREE isn't an
234a00cec48SMark A. Greer# empty string, define 'dts' to be path to the dts
235a00cec48SMark A. Greer# CONFIG_DEVICE_TREE will have "" around it, make sure to strip them
236a00cec48SMark A. Greerifeq ($(CONFIG_WANT_DEVICE_TREE),y)
237a00cec48SMark A. Greerifneq ($(CONFIG_DEVICE_TREE),"")
238a00cec48SMark A. Greerdts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\
239a00cec48SMark A. Greer	,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE:"%"=%)
240a00cec48SMark A. Greerendif
241a00cec48SMark A. Greerendif
242a00cec48SMark A. Greer
2439da82a6dSMilton Miller# Don't put the ramdisk on the pattern rule; when its missing make will try
2449da82a6dSMilton Miller# the pattern rule with less dependencies that also matches (even with the
2459da82a6dSMilton Miller# hard dependency listed).
246a00cec48SMark A. Greer$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) $(dts)
247a00cec48SMark A. Greer	$(call if_changed,wrap,$*,$(dts),,$(obj)/ramdisk.image.gz)
2489da82a6dSMilton Miller
249a00cec48SMark A. Greer$(obj)/zImage.%: vmlinux $(wrapperbits) $(dts)
250a00cec48SMark A. Greer	$(call if_changed,wrap,$*,$(dts))
2519da82a6dSMilton Miller
2524bb09281STony Breeds# This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
2534bb09281STony Breeds# prefix
2544bb09281STony Breeds$(obj)/vmlinux.strip: vmlinux
2554bb09281STony Breeds	$(STRIP) -s -R .comment $< -o $@
2564bb09281STony Breeds
2570570d4edSStephen Rothwell$(obj)/zImage.iseries: vmlinux
2580570d4edSStephen Rothwell	$(STRIP) -s -R .comment $< -o $@
2590570d4edSStephen Rothwell
260bafdb645SGeoff Levand$(obj)/zImage.ps3: vmlinux  $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts
261bafdb645SGeoff Levand	$(STRIP) -s -R .comment $< -o vmlinux.strip
262bafdb645SGeoff Levand	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,)
2639da82a6dSMilton Miller
264bafdb645SGeoff Levand$(obj)/zImage.initrd.ps3: vmlinux  $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts $(obj)/ramdisk.image.gz
265bafdb645SGeoff Levand	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,$(obj)/ramdisk.image.gz)
2669da82a6dSMilton Miller
2679da82a6dSMilton Miller$(obj)/uImage: vmlinux $(wrapperbits)
2689da82a6dSMilton Miller	$(call if_changed,wrap,uboot)
2699da82a6dSMilton Miller
270d25a9d66SDavid Gibson$(obj)/cuImage.%: vmlinux $(dts) $(wrapperbits)
271a6afacb6SDavid Gibson	$(call if_changed,wrap,cuboot-$*,$(dts))
2720fdd717eSScott Wood
273f6dfc805SDavid Gibson$(obj)/treeImage.initrd.%: vmlinux $(dts) $(wrapperbits)
274f6dfc805SDavid Gibson	$(call if_changed,wrap,treeboot-$*,$(dts),,$(obj)/ramdisk.image.gz)
275f6dfc805SDavid Gibson
2766a32d085SDavid Gibson$(obj)/treeImage.%: vmlinux $(dts) $(wrapperbits)
2776a32d085SDavid Gibson	$(call if_changed,wrap,treeboot-$*,$(dts))
2786a32d085SDavid Gibson
2794bb09281STony Breeds# If there isn't a platform selected then just strip the vmlinux.
2804bb09281STony Breedsifeq (,$(image-y))
2814bb09281STony Breedsimage-y := vmlinux.strip
2824bb09281STony Breedsendif
2834bb09281STony Breeds
2842bf11819SPaul Mackerras$(obj)/zImage:		$(addprefix $(obj)/, $(image-y))
2852bf11819SPaul Mackerras	@rm -f $@; ln $< $@
2862bf11819SPaul Mackerras$(obj)/zImage.initrd:	$(addprefix $(obj)/, $(initrd-y))
2872bf11819SPaul Mackerras	@rm -f $@; ln $< $@
28894b212c2SPaul Mackerras
289928370c6SAkinobu Mitainstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
2902bf11819SPaul Mackerras	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
29166a45dd3SPaul Mackerras
2921383a34fSMilton Miller# anything not in $(targets)
293bafdb645SGeoff Levandclean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* \
294bafdb645SGeoff Levand	otheros.bld
2951383a34fSMilton Miller
2961383a34fSMilton Miller# clean up files cached by wrapper
2971383a34fSMilton Millerclean-kernel := vmlinux.strip vmlinux.bin
2981383a34fSMilton Millerclean-kernel += $(addsuffix .gz,$(clean-kernel))
2991383a34fSMilton Miller# If not absolute clean-files are relative to $(obj).
3001383a34fSMilton Millerclean-files += $(addprefix $(objtree)/, $(clean-kernel))
301773f76b1SDavid Woodhouse
302773f76b1SDavid WoodhouseWRAPPER_OBJDIR := /usr/lib/kernel-wrapper
303773f76b1SDavid WoodhouseWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
304773f76b1SDavid WoodhouseWRAPPER_BINDIR := /usr/sbin
305773f76b1SDavid WoodhouseINSTALL := install
306773f76b1SDavid Woodhouse
307773f76b1SDavid Woodhouseextra-installed		:= $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
308773f76b1SDavid Woodhousehostprogs-installed	:= $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
309773f76b1SDavid Woodhousewrapper-installed	:= $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
310773f76b1SDavid Woodhousedts-installed		:= $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts))
311773f76b1SDavid Woodhouse
312773f76b1SDavid Woodhouseall-installed		:= $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
313773f76b1SDavid Woodhouse
314773f76b1SDavid Woodhousequiet_cmd_mkdir           = MKDIR   $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
315773f76b1SDavid Woodhouse      cmd_mkdir           = mkdir -p $@
316773f76b1SDavid Woodhouse
317773f76b1SDavid Woodhousequiet_cmd_install	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
318773f76b1SDavid Woodhouse      cmd_install	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
319773f76b1SDavid Woodhouse
320773f76b1SDavid Woodhousequiet_cmd_install_dts	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
321773f76b1SDavid Woodhouse      cmd_install_dts	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
322773f76b1SDavid Woodhouse
323773f76b1SDavid Woodhousequiet_cmd_install_exe	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
324773f76b1SDavid Woodhouse      cmd_install_exe	  = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
325773f76b1SDavid Woodhouse
326773f76b1SDavid Woodhousequiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
327773f76b1SDavid Woodhouse      cmd_install_wrapper = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
328773f76b1SDavid Woodhouse				sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
329773f76b1SDavid Woodhouse					  -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
330773f76b1SDavid Woodhouse
331773f76b1SDavid Woodhouse
332773f76b1SDavid Woodhouse$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
333773f76b1SDavid Woodhouse	$(call cmd,mkdir)
334773f76b1SDavid Woodhouse
335773f76b1SDavid Woodhouse$(extra-installed)	: $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
336773f76b1SDavid Woodhouse	$(call cmd,install)
337773f76b1SDavid Woodhouse
338773f76b1SDavid Woodhouse$(hostprogs-installed)  : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
339773f76b1SDavid Woodhouse	$(call cmd,install_exe)
340773f76b1SDavid Woodhouse
341773f76b1SDavid Woodhouse$(dts-installed)	: $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
342773f76b1SDavid Woodhouse	$(call cmd,install_dts)
343773f76b1SDavid Woodhouse
344773f76b1SDavid Woodhouse$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
345773f76b1SDavid Woodhouse	$(call cmd,install_wrapper)
346773f76b1SDavid Woodhouse
347773f76b1SDavid Woodhouse$(obj)/bootwrapper_install: $(all-installed)
348773f76b1SDavid Woodhouse
349