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