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