1 # SPDX-License-Identifier: GPL-2.0
2 # Makefile for making ELF bootable images for booting on CHRP
5 # Geert Uytterhoeven September 1997
7 # Based on coffboot by Paul Mackerras
8 # Simplified for ppc64 by Todd Inglett
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.
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.
24 BOOTCC
:= $(CROSS32_COMPILE
)gcc
25 BOOTAR
:= $(CROSS32_COMPILE
)ar
31 BOOTCFLAGS
:= -Wall
-Wundef
-Wstrict-prototypes
-Wno-trigraphs \
32 -fno-strict-aliasing
-O2
-msoft-float
-mno-altivec
-mno-vsx \
33 -pipe
-fomit-frame-pointer
-fno-builtin
-fPIC
-nostdinc \
36 ifdef CONFIG_PPC64_BOOT_WRAPPER
42 BOOTCFLAGS
+= -isystem
$(shell $(BOOTCC
) -print-file-name
=include)
44 ifdef CONFIG_CPU_BIG_ENDIAN
45 BOOTCFLAGS
+= -mbig-endian
47 BOOTCFLAGS
+= -mlittle-endian
48 BOOTCFLAGS
+= $(call cc-option
,-mabi
=elfv2
)
51 BOOTAFLAGS
:= -D__ASSEMBLY__
$(BOOTCFLAGS
) -nostdinc
55 ifdef CONFIG_CC_IS_CLANG
56 BOOTCFLAGS
+= $(CLANG_FLAGS
)
57 BOOTAFLAGS
+= $(CLANG_FLAGS
)
60 ifdef CONFIG_DEBUG_INFO
64 ifeq ($(call cc-option-yn
, -fstack-protector
),y
)
65 BOOTCFLAGS
+= -fno-stack-protector
68 BOOTCFLAGS
+= -I
$(objtree
)/$(obj
) -I
$(srctree
)/$(obj
)
72 $(obj
)/4xx.o
: BOOTCFLAGS
+= -mcpu
=405
73 $(obj
)/ebony.o
: BOOTCFLAGS
+= -mcpu
=405
74 $(obj
)/cuboot-hotfoot.o
: BOOTCFLAGS
+= -mcpu
=405
75 $(obj
)/cuboot-taishan.o
: BOOTCFLAGS
+= -mcpu
=405
76 $(obj
)/cuboot-katmai.o
: BOOTCFLAGS
+= -mcpu
=405
77 $(obj
)/cuboot-acadia.o
: BOOTCFLAGS
+= -mcpu
=405
78 $(obj
)/treeboot-walnut.o
: BOOTCFLAGS
+= -mcpu
=405
79 $(obj
)/treeboot-iss4xx.o
: BOOTCFLAGS
+= -mcpu
=405
80 $(obj
)/treeboot-currituck.o
: BOOTCFLAGS
+= -mcpu
=405
81 $(obj
)/treeboot-akebono.o
: BOOTCFLAGS
+= -mcpu
=405
82 $(obj
)/virtex405-head.o
: BOOTAFLAGS
+= -mcpu
=405
84 # The pre-boot decompressors pull in a lot of kernel headers and other source
85 # files. This creates a bit of a dependency headache since we need to copy
86 # these files into the build dir, fix up any includes and ensure that dependent
87 # files are copied in the right order.
89 # these need to be seperate variables because they are copied out of different
90 # directories in the kernel tree. Sure you COULd merge them, but it's a
91 # cure-is-worse-than-disease situation.
92 zlib-decomp-
$(CONFIG_KERNEL_GZIP
) := decompress_inflate.c
93 zlib-
$(CONFIG_KERNEL_GZIP
) := inffast.c inflate.c inftrees.c
94 zlibheader-
$(CONFIG_KERNEL_GZIP
) := inffast.h inffixed.h inflate.h inftrees.h infutil.h
95 zliblinuxheader-
$(CONFIG_KERNEL_GZIP
) := zlib.h zconf.h zutil.h
97 $(addprefix $(obj
)/, decompress.o
): \
98 $(addprefix $(obj
)/,$(zlib-decomp-y
))
100 $(addprefix $(obj
)/, $(zlib-decomp-y
)): \
101 $(addprefix $(obj
)/,$(zliblinuxheader-y
)) \
102 $(addprefix $(obj
)/,$(zlibheader-y
)) \
103 $(addprefix $(obj
)/,$(zlib-y
))
105 $(addprefix $(obj
)/,$(zlib-y
)): \
106 $(addprefix $(obj
)/,$(zliblinuxheader-y
)) \
107 $(addprefix $(obj
)/,$(zlibheader-y
))
109 libfdt
:= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
110 libfdtheader
:= fdt.h libfdt.h libfdt_internal.h
112 $(addprefix $(obj
)/,$(libfdt
) libfdt-wrapper.o simpleboot.o epapr.o opal.o \
113 treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o
): \
114 $(addprefix $(obj
)/,$(libfdtheader
))
116 src-wlib-y
:= string.S crt0.S stdio.c decompress.c main.c \
117 $(libfdt
) libfdt-wrapper.c \
118 ns16550.c serial.c simple_alloc.c div64.S util.S \
119 elf_util.c
$(zlib-y
) devtree.c stdlib.c \
120 oflib.c ofconsole.c cuboot.c
122 src-wlib-
$(CONFIG_PPC_MPC52XX
) += mpc52xx-psc.c
123 src-wlib-
$(CONFIG_PPC64_BOOT_WRAPPER
) += opal-calls.S opal.c
124 ifndef CONFIG_PPC64_BOOT_WRAPPER
125 src-wlib-y
+= crtsavres.S
127 src-wlib-
$(CONFIG_40x
) += 4xx.c planetcore.c
128 src-wlib-
$(CONFIG_44x
) += 4xx.c ebony.c bamboo.c
129 src-wlib-
$(CONFIG_PPC_8xx
) += mpc8xx.c planetcore.c fsl-soc.c
130 src-wlib-
$(CONFIG_PPC_82xx
) += pq2.c fsl-soc.c planetcore.c
131 src-wlib-
$(CONFIG_EMBEDDED6xx
) += ugecon.c fsl-soc.c
132 src-wlib-
$(CONFIG_XILINX_VIRTEX
) += uartlite.c
133 src-wlib-
$(CONFIG_CPM
) += cpm-serial.c
135 src-plat-y
:= of.c epapr.c
136 src-plat-
$(CONFIG_40x
) += fixed-head.S ep405.c cuboot-hotfoot.c \
137 treeboot-walnut.c cuboot-acadia.c \
138 cuboot-kilauea.c simpleboot.c \
139 virtex405-head.S virtex.c
140 src-plat-
$(CONFIG_44x
) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
141 cuboot-bamboo.c cuboot-sam440ep.c \
142 cuboot-sequoia.c cuboot-rainier.c \
143 cuboot-taishan.c cuboot-katmai.c \
144 cuboot-warp.c cuboot-yosemite.c \
145 treeboot-iss4xx.c treeboot-currituck.c \
147 simpleboot.c fixed-head.S virtex.c
148 src-plat-
$(CONFIG_PPC_8xx
) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
149 src-plat-
$(CONFIG_PPC_MPC52xx
) += cuboot-52xx.c
150 src-plat-
$(CONFIG_PPC_82xx
) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
151 src-plat-
$(CONFIG_PPC_83xx
) += cuboot-83xx.c fixed-head.S redboot-83xx.c
152 src-plat-
$(CONFIG_FSL_SOC_BOOKE
) += cuboot-85xx.c cuboot-85xx-cpm2.c
153 src-plat-
$(CONFIG_EMBEDDED6xx
) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
154 gamecube-head.S gamecube.c \
155 wii-head.S wii.c holly.c \
156 fixed-head.S mvme5100.c
157 src-plat-
$(CONFIG_AMIGAONE
) += cuboot-amigaone.c
158 src-plat-
$(CONFIG_PPC_PS3
) += ps3-head.S ps3-hvcall.S ps3.c
159 src-plat-
$(CONFIG_EPAPR_BOOT
) += epapr.c epapr-wrapper.c
160 src-plat-
$(CONFIG_PPC_PSERIES
) += pseries-head.S
161 src-plat-
$(CONFIG_PPC_POWERNV
) += pseries-head.S
162 src-plat-
$(CONFIG_PPC_IBM_CELL_BLADE
) += pseries-head.S
163 src-plat-
$(CONFIG_MVME7100
) += motload-head.S mvme7100.c
165 src-wlib
:= $(sort $(src-wlib-y
))
166 src-plat
:= $(sort $(src-plat-y
))
167 src-boot
:= $(src-wlib
) $(src-plat
) empty.c
169 src-boot
:= $(addprefix $(obj
)/, $(src-boot
))
170 obj-boot
:= $(addsuffix .o
, $(basename $(src-boot
)))
171 obj-wlib
:= $(addsuffix .o
, $(basename $(addprefix $(obj
)/, $(src-wlib
))))
172 obj-plat
:= $(addsuffix .o
, $(basename $(addprefix $(obj
)/, $(src-plat
))))
175 quiet_cmd_copy_kern_src
= COPY
$@
176 cmd_copy_kern_src
= sed
-f
$(srctree
)/arch
/powerpc
/boot
/fixup-headers.sed
$< > $@
178 $(addprefix $(obj
)/,$(zlib-y
)): $(obj
)/%: $(srctree
)/lib
/zlib_inflate
/%
179 $(call cmd
,copy_kern_src
)
181 $(addprefix $(obj
)/,$(zlibheader-y
)): $(obj
)/%: $(srctree
)/lib
/zlib_inflate
/%
182 $(call cmd
,copy_kern_src
)
184 $(addprefix $(obj
)/,$(zliblinuxheader-y
)): $(obj
)/%: $(srctree
)/include/linux
/%
185 $(call cmd
,copy_kern_src
)
187 $(addprefix $(obj
)/,$(zlib-decomp-y
)): $(obj
)/%: $(srctree
)/lib
/%
188 $(call cmd
,copy_kern_src
)
190 quiet_cmd_copy_libfdt
= COPY
$@
191 cmd_copy_libfdt
= cp
$< $@
193 $(addprefix $(obj
)/,$(libfdt
) $(libfdtheader
)): $(obj
)/%: $(srctree
)/scripts
/dtc
/libfdt
/%
194 $(call cmd
,copy_libfdt
)
199 $(obj
)/zImage.coff.lds
$(obj
)/zImage.ps3.lds
: $(obj
)/%: $(srctree
)/$(src
)/%.S
202 clean-files
:= $(zlib-
) $(zlibheader-
) $(zliblinuxheader-
) \
203 $(zlib-decomp-
) $(libfdt
) $(libfdtheader
) \
204 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
206 quiet_cmd_bootcc
= BOOTCC
$@
207 cmd_bootcc
= $(BOOTCC
) -Wp
,-MD
,$(depfile
) $(BOOTCFLAGS
) -c
-o
$@
$<
209 quiet_cmd_bootas
= BOOTAS
$@
210 cmd_bootas
= $(BOOTCC
) -Wp
,-MD
,$(depfile
) $(BOOTAFLAGS
) -c
-o
$@
$<
212 quiet_cmd_bootar
= BOOTAR
$@
213 cmd_bootar
= $(BOOTAR
) $(BOOTARFLAGS
) $@.
$$$$ $(real-prereqs
); mv
$@.
$$$$ $@
215 $(obj-libfdt
): $(obj
)/%.o
: $(srctree
)/scripts
/dtc
/libfdt
/%.c FORCE
216 $(call if_changed_dep
,bootcc
)
217 $(patsubst %.c
,%.o
, $(filter %.c
, $(src-boot
))): %.o
: %.c FORCE
218 $(Q
)mkdir
-p
$(dir $@
)
219 $(call if_changed_dep
,bootcc
)
220 $(patsubst %.S
,%.o
, $(filter %.S
, $(src-boot
))): %.o
: %.S FORCE
221 $(Q
)mkdir
-p
$(dir $@
)
222 $(call if_changed_dep
,bootas
)
224 $(obj
)/wrapper.a
: $(obj-wlib
) FORCE
225 $(call if_changed
,bootar
)
227 hostprogs-y
:= addnote hack-coff mktree
229 targets
+= $(patsubst $(obj
)/%,%,$(obj-boot
) wrapper.a
)
230 extra-y
:= $(obj
)/wrapper.a
$(obj-plat
) $(obj
)/empty.o \
231 $(obj
)/zImage.lds
$(obj
)/zImage.coff.lds
$(obj
)/zImage.ps3.lds
233 dtstree
:= $(srctree
)/$(src
)/dts
235 wrapper
:=$(srctree
)/$(src
)/wrapper
236 wrapperbits
:= $(extra-y
) $(addprefix $(obj
)/,addnote hack-coff mktree
) \
240 # Bits for building various flavours of zImage
242 ifneq ($(CROSS32_COMPILE
),)
243 CROSSWRAP
:= -C
"$(CROSS32_COMPILE)"
245 ifneq ($(CROSS_COMPILE
),)
246 CROSSWRAP
:= -C
"$(CROSS_COMPILE)"
250 compressor-
$(CONFIG_KERNEL_GZIP
) := gz
251 compressor-
$(CONFIG_KERNEL_XZ
) := xz
252 compressor-
$(CONFIG_KERNEL_LZMA
) := lzma
253 compressor-
$(CONFIG_KERNEL_LZO
) := lzo
255 # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
256 quiet_cmd_wrap
= WRAP
$@
257 cmd_wrap
=$(CONFIG_SHELL
) $(wrapper
) -Z
$(compressor-y
) -c
-o
$@
-p
$2 \
258 $(CROSSWRAP
) $(if
$3, -s
$3)$(if
$4, -d
$4)$(if
$5, -i
$5) \
261 image-
$(CONFIG_PPC_PSERIES
) += zImage.pseries
262 image-
$(CONFIG_PPC_POWERNV
) += zImage.pseries
263 image-
$(CONFIG_PPC_MAPLE
) += zImage.maple
264 image-
$(CONFIG_PPC_IBM_CELL_BLADE
) += zImage.pseries
265 image-
$(CONFIG_PPC_PS3
) += dtbImage.ps3
266 image-
$(CONFIG_PPC_CHRP
) += zImage.chrp
267 image-
$(CONFIG_PPC_EFIKA
) += zImage.chrp
268 image-
$(CONFIG_PPC_PMAC
) += zImage.pmac
269 image-
$(CONFIG_PPC_HOLLY
) += dtbImage.holly
270 image-
$(CONFIG_DEFAULT_UIMAGE
) += uImage
271 image-
$(CONFIG_EPAPR_BOOT
) += zImage.epapr
274 # Targets which embed a device tree blob
276 # Theses are default targets to build images which embed device tree blobs.
277 # They are only required on boards which do not have FDT support in firmware.
278 # Boards with newish u-boot firmware can use the uImage target above
281 # Board ports in arch/powerpc/platform/40x/Kconfig
282 image-
$(CONFIG_EP405
) += dtbImage.ep405
283 image-
$(CONFIG_HOTFOOT
) += cuImage.hotfoot
284 image-
$(CONFIG_WALNUT
) += treeImage.walnut
285 image-
$(CONFIG_ACADIA
) += cuImage.acadia
286 image-
$(CONFIG_OBS600
) += uImage.obs600
288 # Board ports in arch/powerpc/platform/44x/Kconfig
289 image-
$(CONFIG_EBONY
) += treeImage.ebony cuImage.ebony
290 image-
$(CONFIG_BAMBOO
) += treeImage.bamboo cuImage.bamboo
291 image-
$(CONFIG_SAM440EP
) += cuImage.sam440ep
292 image-
$(CONFIG_SEQUOIA
) += cuImage.sequoia
293 image-
$(CONFIG_RAINIER
) += cuImage.rainier
294 image-
$(CONFIG_TAISHAN
) += cuImage.taishan
295 image-
$(CONFIG_KATMAI
) += cuImage.katmai
296 image-
$(CONFIG_WARP
) += cuImage.warp
297 image-
$(CONFIG_YOSEMITE
) += cuImage.yosemite
298 image-
$(CONFIG_ISS4xx
) += treeImage.iss4xx \
299 treeImage.iss4xx-mpic
300 image-
$(CONFIG_CURRITUCK
) += treeImage.currituck
301 image-
$(CONFIG_AKEBONO
) += treeImage.akebono
303 # Board ports in arch/powerpc/platform/8xx/Kconfig
304 image-
$(CONFIG_MPC86XADS
) += cuImage.mpc866ads
305 image-
$(CONFIG_MPC885ADS
) += cuImage.mpc885ads
306 image-
$(CONFIG_PPC_EP88XC
) += dtbImage.ep88xc
307 image-
$(CONFIG_PPC_ADDER875
) += cuImage.adder875-uboot \
308 dtbImage.adder875-redboot
310 # Board ports in arch/powerpc/platform/52xx/Kconfig
311 image-
$(CONFIG_PPC_LITE5200
) += cuImage.lite5200
312 image-
$(CONFIG_PPC_LITE5200
) += cuImage.lite5200b
313 image-
$(CONFIG_PPC_MEDIA5200
) += cuImage.media5200
315 # Board ports in arch/powerpc/platform/82xx/Kconfig
316 image-
$(CONFIG_MPC8272_ADS
) += cuImage.mpc8272ads
317 image-
$(CONFIG_PQ2FADS
) += cuImage.pq2fads
318 image-
$(CONFIG_EP8248E
) += dtbImage.ep8248e
320 # Board ports in arch/powerpc/platform/83xx/Kconfig
321 image-
$(CONFIG_MPC832x_MDS
) += cuImage.mpc832x_mds
322 image-
$(CONFIG_MPC832x_RDB
) += cuImage.mpc832x_rdb
323 image-
$(CONFIG_MPC834x_ITX
) += cuImage.mpc8349emitx \
324 cuImage.mpc8349emitxgp
325 image-
$(CONFIG_MPC834x_MDS
) += cuImage.mpc834x_mds
326 image-
$(CONFIG_MPC836x_MDS
) += cuImage.mpc836x_mds
327 image-
$(CONFIG_ASP834x
) += dtbImage.asp834x-redboot
329 # Board ports in arch/powerpc/platform/85xx/Kconfig
330 image-
$(CONFIG_MPC8540_ADS
) += cuImage.mpc8540ads
331 image-
$(CONFIG_MPC8560_ADS
) += cuImage.mpc8560ads
332 image-
$(CONFIG_MPC85xx_CDS
) += cuImage.mpc8541cds \
333 cuImage.mpc8548cds_32b \
335 image-
$(CONFIG_MPC85xx_MDS
) += cuImage.mpc8568mds
336 image-
$(CONFIG_MPC85xx_DS
) += cuImage.mpc8544ds \
338 image-
$(CONFIG_TQM8540
) += cuImage.tqm8540
339 image-
$(CONFIG_TQM8541
) += cuImage.tqm8541
340 image-
$(CONFIG_TQM8548
) += cuImage.tqm8548
341 image-
$(CONFIG_TQM8555
) += cuImage.tqm8555
342 image-
$(CONFIG_TQM8560
) += cuImage.tqm8560
343 image-
$(CONFIG_SBC8548
) += cuImage.sbc8548
344 image-
$(CONFIG_KSI8560
) += cuImage.ksi8560
346 # Board ports in arch/powerpc/platform/86xx/Kconfig
347 image-
$(CONFIG_MVME7100
) += dtbImage.mvme7100
349 # Board ports in arch/powerpc/platform/embedded6xx/Kconfig
350 image-
$(CONFIG_STORCENTER
) += cuImage.storcenter
351 image-
$(CONFIG_MPC7448HPC2
) += cuImage.mpc7448hpc2
352 image-
$(CONFIG_GAMECUBE
) += dtbImage.gamecube
353 image-
$(CONFIG_WII
) += dtbImage.wii
354 image-
$(CONFIG_MVME5100
) += dtbImage.mvme5100
356 # Board port in arch/powerpc/platform/amigaone/Kconfig
357 image-
$(CONFIG_AMIGAONE
) += cuImage.amigaone
359 # For 32-bit powermacs, build the COFF and miboot images
360 # as well as the ELF images.
362 image-
$(CONFIG_PPC_PMAC
) += zImage.coff zImage.miboot
365 # Allow extra targets to be added to the defconfig
366 image-y
+= $(subst ",,$(CONFIG_EXTRA_TARGETS))
368 initrd- := $(patsubst zImage%, zImage.initrd%, $(image-))
369 initrd-y := $(patsubst zImage%, zImage.initrd%, \
370 $(patsubst dtbImage%, dtbImage.initrd%, \
371 $(patsubst simpleImage%, simpleImage.initrd%, \
372 $(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
373 initrd-y := $(filter-out $(image-y), $(initrd-y))
374 targets += $(image-y) $(initrd-y)
376 $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
378 # Don't put the ramdisk on the pattern rule; when its missing make will try
379 # the pattern rule with less dependencies that also matches (even with the
380 # hard dependency listed).
381 $(obj)/zImage.initrd.%: vmlinux $(wrapperbits) FORCE
382 $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
384 $(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits) FORCE
385 $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
387 # dtbImage% - a dtbImage is a zImage with an embedded device tree blob
388 $(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
389 $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
391 $(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
392 $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb)
394 # This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
396 $(obj)/vmlinux.strip: vmlinux
397 $(STRIP) -s -R .comment $< -o $@
399 $(obj)/uImage: vmlinux $(wrapperbits) FORCE
400 $(call if_changed,wrap,uboot)
402 $(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
403 $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
405 $(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
406 $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb)
408 $(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
409 $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
411 $(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
412 $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb)
414 $(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
415 $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
417 $(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
418 $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb)
420 $(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
421 $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
423 $(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
424 $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb)
426 # Needed for the above targets to work with dts/fsl/ files
427 $(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb
430 # If there isn't a platform selected then just strip the vmlinux.
432 image-y := vmlinux.strip
435 $(obj)/zImage: $(addprefix $(obj)/, $(image-y))
436 $(Q)rm -f $@; ln $< $@
437 $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
438 $(Q)rm -f $@; ln $< $@
440 # Only install the vmlinux
441 install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
442 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE
)" vmlinux System.map "$(INSTALL_PATH
)"
444 # Install the vmlinux and other built boot targets.
445 zInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
446 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE
)" vmlinux System.map "$(INSTALL_PATH
)" $^
448 # anything not in $(targets)
449 clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
450 zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
451 zImage.miboot zImage.pmac zImage.pseries \
452 zImage.maple simpleImage.* otheros.bld
454 # clean up files cached by wrapper
455 clean-kernel-base := vmlinux.strip vmlinux.bin
456 clean-kernel := $(addsuffix .gz,$(clean-kernel-base))
457 clean-kernel += $(addsuffix .xz,$(clean-kernel-base))
458 # If not absolute clean-files are relative to $(obj).
459 clean-files += $(addprefix $(objtree)/, $(clean-kernel))
461 WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
462 WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
463 WRAPPER_BINDIR := /usr/sbin
466 extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
467 hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
468 wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
469 dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
471 all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
473 quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
474 cmd_mkdir = mkdir -p $@
476 quiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
477 cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
479 quiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
480 cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
482 quiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
483 cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
485 quiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
486 cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
487 sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
488 -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
491 $(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
494 $(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
497 $(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
498 $(call cmd,install_exe)
500 $(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
501 $(call cmd,install_dts)
503 $(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
504 $(call cmd,install_wrapper)
506 $(obj)/bootwrapper_install: $(all-installed)