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