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