blob: 4eec430d8fa86d7c197c2230285986c692198115 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001# Makefile for making ELF bootable images for booting on CHRP
2# using Open Firmware.
3#
4# Geert Uytterhoeven September 1997
5#
6# Based on coffboot by Paul Mackerras
7# Simplified for ppc64 by Todd Inglett
8#
9# NOTE: this code is built for 32 bit in ELF32 format even though
10# it packages a 64 bit kernel. We do this to simplify the
11# bootloader and increase compatibility with OpenFirmware.
12#
13# To this end we need to define BOOTCC, etc, as the tools
David Gibsonb610b972007-05-29 15:37:12 +100014# needed to build the 32 bit image. That's normally the same
15# compiler for the rest of the kernel, with the -m32 flag added.
Linus Torvalds1da177e2005-04-16 15:20:36 -070016# To make it easier to setup a cross compiler,
17# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
18# in the toplevel makefile.
19
Paul Mackerras2bf11812006-09-27 22:47:03 +100020all: $(obj)/zImage
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
David Gibsonb610b972007-05-29 15:37:12 +100022BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
Benjamin Herrenschmidt6846ee52010-01-13 16:19:34 +110023 -fno-strict-aliasing -Os -msoft-float -pipe \
David Gibsonb610b972007-05-29 15:37:12 +100024 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
Cédric Le Goater147c0512014-04-24 09:23:39 +020025 -isystem $(shell $(CROSS32CC) -print-file-name=include)
26ifdef CONFIG_PPC64_BOOT_WRAPPER
27BOOTCFLAGS += -m64
28endif
29ifdef CONFIG_CPU_BIG_ENDIAN
30BOOTCFLAGS += -mbig-endian
Benjamin Herrenschmidt655471f2015-09-15 11:24:17 +100031else
32BOOTCFLAGS += -mlittle-endian
33BOOTCFLAGS += $(call cc-option,-mabi=elfv2)
Cédric Le Goater147c0512014-04-24 09:23:39 +020034endif
35
Olaf Heringdecd3002005-08-08 13:24:38 +100036BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Grant Likely105c13d2007-10-04 14:05:01 +100038ifdef CONFIG_DEBUG_INFO
39BOOTCFLAGS += -g
40endif
41
Niels Kristian Bech Jensenfda7ffd2006-07-02 13:02:27 +020042ifeq ($(call cc-option-yn, -fstack-protector),y)
43BOOTCFLAGS += -fno-stack-protector
44endif
45
David Gibson9fffb552009-04-30 15:25:53 +100046BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
Olaf Hering70540362005-10-28 17:46:38 -070047
Dirk Brandewie63849342010-12-22 11:57:28 -080048DTC_FLAGS ?= -p 1024
Kumar Gala9d4ae9f2008-06-26 18:58:11 +100049
Josh Boyerbf2e70a2008-02-19 13:52:48 +110050$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
51$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
Solomon Peachy0cdf50a2009-08-20 10:19:47 +000052$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
Josh Boyerbf2e70a2008-02-19 13:52:48 +110053$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
54$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
Josh Boyer9f3eefc2008-11-25 06:33:35 +000055$(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
Josh Boyer2e71cc02007-09-24 07:32:15 -050056$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
Torez Smithb4e8c8d2010-03-05 10:45:54 +000057$(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
Tony Breeds228d5502011-11-30 21:39:24 +000058$(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
Alistair Popple2a2c74b2014-03-06 14:52:27 +110059$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
Grant Likelyb9e4f172008-04-25 03:33:44 +100060$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
Josh Boyer60e41752007-05-17 04:51:37 +100061
Hugh Blemings6bbc5472007-12-21 15:39:28 +110062
Paul Mackerras2bf11812006-09-27 22:47:03 +100063zlib := inffast.c inflate.c inftrees.c
64zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
65zliblinuxheader := zlib.h zconf.h zutil.h
66
Paul Gortmaker3c8464a2014-02-05 20:35:13 -050067$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o): \
David Gibsond25a9d62007-05-04 17:14:13 +100068 $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
Paul Mackerras2bf11812006-09-27 22:47:03 +100069
David Gibson9fffb552009-04-30 15:25:53 +100070libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
71libfdtheader := fdt.h libfdt.h libfdt_internal.h
72
Matthew McClintock73927692011-07-19 06:22:44 +000073$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o): \
David Gibson9fffb552009-04-30 15:25:53 +100074 $(addprefix $(obj)/,$(libfdtheader))
75
Tony Breedsb81f18e2012-04-03 15:00:39 +000076src-wlib-y := string.S crt0.S crtsavres.S stdio.c main.c \
David Gibson9fffb552009-04-30 15:25:53 +100077 $(libfdt) libfdt-wrapper.c \
David Gibsonad9d2712007-03-05 14:24:52 +110078 ns16550.c serial.c simple_alloc.c div64.S util.S \
Tony Breedsb81f18e2012-04-03 15:00:39 +000079 gunzip_util.c elf_util.c $(zlib) devtree.c stdlib.c \
80 oflib.c ofconsole.c cuboot.c mpsc.c cpm-serial.c \
81 uartlite.c mpc52xx-psc.c
82src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
83src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
Paul Gortmaker78f3d052014-01-09 15:33:35 -050084src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c fsl-soc.c
Tony Breedsb81f18e2012-04-03 15:00:39 +000085src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
Paul Gortmaker78f3d052014-01-09 15:33:35 -050086src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c
Tony Breedsb81f18e2012-04-03 15:00:39 +000087
Benjamin Herrenschmidt0c9fa292013-09-24 16:10:38 +100088src-plat-y := of.c epapr.c
Tony Breedsb81f18e2012-04-03 15:00:39 +000089src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
90 treeboot-walnut.c cuboot-acadia.c \
91 cuboot-kilauea.c simpleboot.c \
92 virtex405-head.S virtex.c
93src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
94 cuboot-bamboo.c cuboot-sam440ep.c \
95 cuboot-sequoia.c cuboot-rainier.c \
96 cuboot-taishan.c cuboot-katmai.c \
97 cuboot-warp.c cuboot-yosemite.c \
98 treeboot-iss4xx.c treeboot-currituck.c \
Alistair Popple2a2c74b2014-03-06 14:52:27 +110099 treeboot-akebono.c \
Tony Breedsb81f18e2012-04-03 15:00:39 +0000100 simpleboot.c fixed-head.S virtex.c
101src-plat-$(CONFIG_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
102src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
103src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
104src-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c
105src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
106src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
107 cuboot-c2k.c gamecube-head.S \
108 gamecube.c wii-head.S wii.c holly.c \
Paul Gortmaker3c8464a2014-02-05 20:35:13 -0500109 fixed-head.S mvme5100.c
Tony Breedsb81f18e2012-04-03 15:00:39 +0000110src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
111src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
Benjamin Herrenschmidt0c9fa292013-09-24 16:10:38 +1000112src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
Cédric Le Goater2d9afb32014-04-24 09:23:38 +0200113src-plat-$(CONFIG_PPC_PSERIES) += pseries-head.S
114src-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S
115src-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S
Cédric Le Goater2d9afb32014-04-24 09:23:38 +0200116src-plat-$(CONFIG_PPC_CELL_QPACE) += pseries-head.S
Tony Breedsb81f18e2012-04-03 15:00:39 +0000117
118src-wlib := $(sort $(src-wlib-y))
119src-plat := $(sort $(src-plat-y))
David Gibsoncd197ff2007-03-05 14:24:52 +1100120src-boot := $(src-wlib) $(src-plat) empty.c
Paul Mackerras2bf11812006-09-27 22:47:03 +1000121
122src-boot := $(addprefix $(obj)/, $(src-boot))
123obj-boot := $(addsuffix .o, $(basename $(src-boot)))
124obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
125obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
Matthew McClintock0090e022012-09-06 08:48:54 +0000126obj-plat: $(libfdt)
Paul Mackerras2bf11812006-09-27 22:47:03 +1000127
Olaf Hering70540362005-10-28 17:46:38 -0700128quiet_cmd_copy_zlib = COPY $@
Adrian Bunk3ff6eec2008-01-24 22:16:20 +0100129 cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
Olaf Hering70540362005-10-28 17:46:38 -0700130
131quiet_cmd_copy_zlibheader = COPY $@
Segher Boessenkool67ccd2f2007-05-16 22:49:22 +1000132 cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
Olaf Hering70540362005-10-28 17:46:38 -0700133# stddef.h for NULL
134quiet_cmd_copy_zliblinuxheader = COPY $@
Segher Boessenkool67ccd2f2007-05-16 22:49:22 +1000135 cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
Olaf Hering70540362005-10-28 17:46:38 -0700136
137$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
138 $(call cmd,copy_zlib)
139
140$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
141 $(call cmd,copy_zlibheader)
142
143$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
144 $(call cmd,copy_zliblinuxheader)
145
David Gibson9fffb552009-04-30 15:25:53 +1000146quiet_cmd_copy_libfdt = COPY $@
147 cmd_copy_libfdt = cp $< $@
148
149$(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
150 $(call cmd,copy_libfdt)
151
Paul Mackerras2bf11812006-09-27 22:47:03 +1000152$(obj)/empty.c:
153 @touch $@
Olaf Hering70540362005-10-28 17:46:38 -0700154
Cédric Le Goater147c0512014-04-24 09:23:39 +0200155$(obj)/zImage.lds: $(obj)/%: $(srctree)/$(src)/%.S
156 $(CROSS32CC) $(cpp_flags) -E -Wp,-MD,$(depfile) -P -Upowerpc \
157 -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
158
159$(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
Paul Mackerras2bf11812006-09-27 22:47:03 +1000160 @cp $< $@
161
162clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
David Gibson9fffb552009-04-30 15:25:53 +1000163 $(libfdt) $(libfdtheader) \
Kumar Galab58a4572008-05-18 13:23:03 -0500164 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
Olaf Hering70540362005-10-28 17:46:38 -0700165
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166quiet_cmd_bootcc = BOOTCC $@
167 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
168
169quiet_cmd_bootas = BOOTAS $@
170 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
171
Paul Mackerras2bf11812006-09-27 22:47:03 +1000172quiet_cmd_bootar = BOOTAR $@
Michal Marek31355402011-05-05 05:22:55 +0000173 cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
Geoff Levanda24c8482005-08-15 13:59:13 -0700174
David Gibson9fffb552009-04-30 15:25:53 +1000175$(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
176 $(call if_changed_dep,bootcc)
Milton Miller235fd832007-03-21 09:02:37 -0600177$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
David Gibson2f0dfea2007-12-10 14:28:39 +1100178 $(Q)mkdir -p $(dir $@)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 $(call if_changed_dep,bootcc)
Milton Miller235fd832007-03-21 09:02:37 -0600180$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
David Gibson2f0dfea2007-12-10 14:28:39 +1100181 $(Q)mkdir -p $(dir $@)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 $(call if_changed_dep,bootas)
183
Milton Miller235fd832007-03-21 09:02:37 -0600184$(obj)/wrapper.a: $(obj-wlib) FORCE
185 $(call if_changed,bootar)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
Paul Mackerras97bb63e2010-06-07 14:27:10 +0000187hostprogs-y := addnote hack-coff mktree
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188
Milton Miller235fd832007-03-21 09:02:37 -0600189targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
David Gibsoncd197ff2007-03-05 14:24:52 +1100190extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
Geoff Levandbafdb642007-07-04 09:07:18 +1000191 $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
Paul Mackerras66a45dd2006-01-14 15:04:06 +1100192
Grant Likely25431332008-02-07 05:18:34 +1100193dtstree := $(srctree)/$(src)/dts
194
Paul Mackerras2bf11812006-09-27 22:47:03 +1000195wrapper :=$(srctree)/$(src)/wrapper
David Gibson9fffb552009-04-30 15:25:53 +1000196wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
Milton Miller235fd832007-03-21 09:02:37 -0600197 $(wrapper) FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198
Paul Mackerras2bf11812006-09-27 22:47:03 +1000199#############
200# Bits for building various flavours of zImage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201
Paul Mackerras2bf11812006-09-27 22:47:03 +1000202ifneq ($(CROSS32_COMPILE),)
Michael Ellermandcf90652006-09-30 11:54:09 +1000203CROSSWRAP := -C "$(CROSS32_COMPILE)"
Paul Mackerras2bf11812006-09-27 22:47:03 +1000204else
205ifneq ($(CROSS_COMPILE),)
Michael Ellermandcf90652006-09-30 11:54:09 +1000206CROSSWRAP := -C "$(CROSS_COMPILE)"
Paul Mackerras2bf11812006-09-27 22:47:03 +1000207endif
208endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
Milton Miller9da82a62007-03-21 09:03:23 -0600210# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
Paul Mackerras2bf11812006-09-27 22:47:03 +1000211quiet_cmd_wrap = WRAP $@
Milton Miller9da82a62007-03-21 09:03:23 -0600212 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
213 $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux
Paul Mackerras2bf11812006-09-27 22:47:03 +1000214
Geoff Levand020533e2006-10-07 15:33:53 -0700215image-$(CONFIG_PPC_PSERIES) += zImage.pseries
Benjamin Herrenschmidt55190f82011-09-19 17:44:52 +0000216image-$(CONFIG_PPC_POWERNV) += zImage.pseries
Corey Minyard58706ef2010-01-29 14:18:20 +0000217image-$(CONFIG_PPC_MAPLE) += zImage.maple
Geoff Levand020533e2006-10-07 15:33:53 -0700218image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries
Grant Likely595be942008-02-22 05:57:07 +1100219image-$(CONFIG_PPC_PS3) += dtbImage.ps3
Benjamin Krilldef434c2008-11-27 16:15:44 +0100220image-$(CONFIG_PPC_CELL_QPACE) += zImage.pseries
Geoff Levand020533e2006-10-07 15:33:53 -0700221image-$(CONFIG_PPC_CHRP) += zImage.chrp
Nicolas DET7839af32006-11-17 17:08:37 +0100222image-$(CONFIG_PPC_EFIKA) += zImage.chrp
Geoff Levand020533e2006-10-07 15:33:53 -0700223image-$(CONFIG_PPC_PMAC) += zImage.pmac
Josh Boyer32dde0f2008-09-09 04:00:28 +0000224image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
Scott Woodac18c672007-05-03 04:00:00 +1000225image-$(CONFIG_DEFAULT_UIMAGE) += uImage
David Gibson6c5b59b2011-04-14 18:29:16 +0000226image-$(CONFIG_EPAPR_BOOT) += zImage.epapr
Scott Woodac18c672007-05-03 04:00:00 +1000227
Grant Likely25431332008-02-07 05:18:34 +1100228#
229# Targets which embed a device tree blob
230#
231# Theses are default targets to build images which embed device tree blobs.
232# They are only required on boards which do not have FDT support in firmware.
Nick Andrew2a947392009-01-03 18:59:37 +1100233# Boards with newish u-boot firmware can use the uImage target above
Grant Likely25431332008-02-07 05:18:34 +1100234#
235
236# Board ports in arch/powerpc/platform/40x/Kconfig
Grant Likely595be942008-02-22 05:57:07 +1100237image-$(CONFIG_EP405) += dtbImage.ep405
Solomon Peachy0cdf50a2009-08-20 10:19:47 +0000238image-$(CONFIG_HOTFOOT) += cuImage.hotfoot
Grant Likely25431332008-02-07 05:18:34 +1100239image-$(CONFIG_WALNUT) += treeImage.walnut
Josh Boyer94c73a82008-09-03 21:01:39 -0400240image-$(CONFIG_ACADIA) += cuImage.acadia
Benjamin Herrenschmidt11eab2972011-12-01 19:35:08 +0000241image-$(CONFIG_OBS600) += uImage.obs600
Grant Likely25431332008-02-07 05:18:34 +1100242
243# Board ports in arch/powerpc/platform/44x/Kconfig
David Gibsonf6dfc802007-05-08 14:10:01 +1000244image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
Josh Boyer658e8172007-09-15 04:54:11 +1000245image-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo
Giuseppe Coviellob6014e12008-05-20 01:20:47 +1000246image-$(CONFIG_SAM440EP) += cuImage.sam440ep
Valentine Barshak606d08b2007-08-29 17:38:30 +0400247image-$(CONFIG_SEQUOIA) += cuImage.sequoia
Valentine Barshak295e7422007-10-31 03:56:06 +1100248image-$(CONFIG_RAINIER) += cuImage.rainier
Hugh Blemings6bbc5472007-12-21 15:39:28 +1100249image-$(CONFIG_TAISHAN) += cuImage.taishan
Benjamin Herrenschmidt3de9c9c2007-12-21 15:39:34 +1100250image-$(CONFIG_KATMAI) += cuImage.katmai
Sean MacLennan1e12f3c2008-01-11 17:17:51 +1100251image-$(CONFIG_WARP) += cuImage.warp
Josh Boyerd0a48c92008-03-06 21:15:52 -0600252image-$(CONFIG_YOSEMITE) += cuImage.yosemite
Torez Smithb4e8c8d2010-03-05 10:45:54 +0000253image-$(CONFIG_ISS4xx) += treeImage.iss4xx \
254 treeImage.iss4xx-mpic
Tony Breeds228d5502011-11-30 21:39:24 +0000255image-$(CONFIG_CURRITUCK) += treeImage.currituck
Alistair Popple2a2c74b2014-03-06 14:52:27 +1100256image-$(CONFIG_AKEBONO) += treeImage.akebono
Geoff Levanda24c8482005-08-15 13:59:13 -0700257
Grant Likely25431332008-02-07 05:18:34 +1100258# Board ports in arch/powerpc/platform/8xx/Kconfig
Adrian Bunkefa58fb2008-05-22 03:38:28 +1000259image-$(CONFIG_MPC86XADS) += cuImage.mpc866ads
260image-$(CONFIG_MPC885ADS) += cuImage.mpc885ads
Grant Likely595be942008-02-22 05:57:07 +1100261image-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc
Grant Likely25431332008-02-07 05:18:34 +1100262image-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \
Grant Likely595be942008-02-22 05:57:07 +1100263 dtbImage.adder875-redboot
Grant Likely25431332008-02-07 05:18:34 +1100264
265# Board ports in arch/powerpc/platform/52xx/Kconfig
Grant Likelybfee95b2009-02-04 13:39:17 -0700266image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 lite5200.dtb
267image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b lite5200b.dtb
268image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 media5200.dtb
Grant Likely25431332008-02-07 05:18:34 +1100269
270# Board ports in arch/powerpc/platform/82xx/Kconfig
271image-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads
272image-$(CONFIG_PQ2FADS) += cuImage.pq2fads
Grant Likely595be942008-02-22 05:57:07 +1100273image-$(CONFIG_EP8248E) += dtbImage.ep8248e
Grant Likely25431332008-02-07 05:18:34 +1100274
275# Board ports in arch/powerpc/platform/83xx/Kconfig
276image-$(CONFIG_MPC832x_MDS) += cuImage.mpc832x_mds
277image-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb
278image-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \
279 cuImage.mpc8349emitxgp
280image-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds
281image-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds
Bryan O'Donoghue59d13f92008-05-08 13:47:00 +0100282image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
Grant Likely25431332008-02-07 05:18:34 +1100283
284# Board ports in arch/powerpc/platform/85xx/Kconfig
285image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
286image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads
287image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \
Zhao Chenhui0d4fdd322012-03-06 17:06:44 +0800288 cuImage.mpc8548cds_32b \
Grant Likely25431332008-02-07 05:18:34 +1100289 cuImage.mpc8555cds
290image-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds
291image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \
292 cuImage.mpc8572ds
293image-$(CONFIG_TQM8540) += cuImage.tqm8540
294image-$(CONFIG_TQM8541) += cuImage.tqm8541
Wolfgang Grandegger6dd1b642008-06-06 13:50:04 +0200295image-$(CONFIG_TQM8548) += cuImage.tqm8548
Grant Likely25431332008-02-07 05:18:34 +1100296image-$(CONFIG_TQM8555) += cuImage.tqm8555
297image-$(CONFIG_TQM8560) += cuImage.tqm8560
Paul Gortmakera72a6f52008-03-18 16:13:10 +1100298image-$(CONFIG_SBC8548) += cuImage.sbc8548
Alexandr Smirnovff880112008-03-04 19:34:26 +0300299image-$(CONFIG_KSI8560) += cuImage.ksi8560
Grant Likely25431332008-02-07 05:18:34 +1100300
301# Board ports in arch/powerpc/platform/embedded6xx/Kconfig
302image-$(CONFIG_STORCENTER) += cuImage.storcenter
303image-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2
Remi Machetc6ec08e2008-05-21 06:50:10 +1000304image-$(CONFIG_PPC_C2K) += cuImage.c2k
Albert Herranzb68a24b2009-12-12 06:31:36 +0000305image-$(CONFIG_GAMECUBE) += dtbImage.gamecube
Albert Herranz6cdd24172009-12-12 06:31:45 +0000306image-$(CONFIG_WII) += dtbImage.wii
Stephen Chiversbe201982014-01-09 13:01:22 +1100307image-$(CONFIG_MVME5100) += dtbImage.mvme5100
Scott Woodb09c1642008-01-17 16:31:40 -0600308
Gerhard Pircher8f237352009-02-10 12:26:11 +0000309# Board port in arch/powerpc/platform/amigaone/Kconfig
310image-$(CONFIG_AMIGAONE) += cuImage.amigaone
311
Paul Mackerras9216ad82006-01-15 13:00:08 +1100312# For 32-bit powermacs, build the COFF and miboot images
313# as well as the ELF images.
Paul Mackerras2bf11812006-09-27 22:47:03 +1000314ifeq ($(CONFIG_PPC32),y)
315image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
316endif
Paul Mackerras66a45dd2006-01-14 15:04:06 +1100317
Grant Likelyc356aa42008-07-09 09:41:52 -0600318# Allow extra targets to be added to the defconfig
319image-y += $(subst ",,$(CONFIG_EXTRA_TARGETS))
320
Michal Marek755457f2014-10-02 15:49:15 +0200321initrd- := $(patsubst zImage%, zImage.initrd%, $(image-))
David Gibsonf6dfc802007-05-08 14:10:01 +1000322initrd-y := $(patsubst zImage%, zImage.initrd%, \
Grant Likely595be942008-02-22 05:57:07 +1100323 $(patsubst dtbImage%, dtbImage.initrd%, \
John Linn5d1a0412008-07-01 14:17:18 -0600324 $(patsubst simpleImage%, simpleImage.initrd%, \
325 $(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
Milton Miller9da82a62007-03-21 09:03:23 -0600326initrd-y := $(filter-out $(image-y), $(initrd-y))
Milton Miller235fd832007-03-21 09:02:37 -0600327targets += $(image-y) $(initrd-y)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328
Milton Miller9da82a62007-03-21 09:03:23 -0600329$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
330
331# Don't put the ramdisk on the pattern rule; when its missing make will try
332# the pattern rule with less dependencies that also matches (even with the
333# hard dependency listed).
Grant Likely25431332008-02-07 05:18:34 +1100334$(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
335 $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
Milton Miller9da82a62007-03-21 09:03:23 -0600336
Michal Marek699c6592014-06-11 13:53:48 +0200337$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits)
338 $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
Grant Likely25431332008-02-07 05:18:34 +1100339
Grant Likely595be942008-02-22 05:57:07 +1100340# dtbImage% - a dtbImage is a zImage with an embedded device tree blob
Grant Likelye04018e2008-03-25 09:52:46 +1100341$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
342 $(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
Grant Likely25431332008-02-07 05:18:34 +1100343
Grant Likelye04018e2008-03-25 09:52:46 +1100344$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
345 $(call if_changed,wrap,$*,,$(obj)/$*.dtb)
Milton Miller9da82a62007-03-21 09:03:23 -0600346
Tony Breeds4bb09282007-07-04 14:04:31 +1000347# This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
348# prefix
349$(obj)/vmlinux.strip: vmlinux
350 $(STRIP) -s -R .comment $< -o $@
351
Milton Miller9da82a62007-03-21 09:03:23 -0600352$(obj)/uImage: vmlinux $(wrapperbits)
353 $(call if_changed,wrap,uboot)
354
Benjamin Herrenschmidt11eab2972011-12-01 19:35:08 +0000355$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
356 $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
357
358$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
359 $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
360
Grant Likelya4292d7a2008-10-17 19:12:07 +0000361$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
362 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
363
Grant Likelye04018e2008-03-25 09:52:46 +1100364$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
365 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
Scott Wood0fdd7172007-04-17 09:25:50 +1000366
Grant Likelyd2477b52008-03-19 04:07:43 +1100367$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
368 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
369
370$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
371 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb)
372
Grant Likelye04018e2008-03-25 09:52:46 +1100373$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
374 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
David Gibsonf6dfc802007-05-08 14:10:01 +1000375
Grant Likelye04018e2008-03-25 09:52:46 +1100376$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
377 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
378
379# Rule to build device tree blobs
Stephen Warren7c431852012-01-09 11:38:15 -0700380$(obj)/%.dtb: $(src)/dts/%.dts FORCE
381 $(call if_changed_dep,dtc)
David Gibson6a32d082007-05-15 12:40:23 +1000382
Tony Breeds4bb09282007-07-04 14:04:31 +1000383# If there isn't a platform selected then just strip the vmlinux.
384ifeq (,$(image-y))
385image-y := vmlinux.strip
386endif
387
Paul Mackerras2bf11812006-09-27 22:47:03 +1000388$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
389 @rm -f $@; ln $< $@
390$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
391 @rm -f $@; ln $< $@
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392
Tony Breedsc913e5f2014-08-14 17:05:04 +1000393# Only install the vmlinux
Akinobu Mita928370c2007-04-10 21:05:31 +1000394install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
Tony Breedsc913e5f2014-08-14 17:05:04 +1000395 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)"
396
397# Install the vmlinux and other built boot targets.
398zInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
Grant Likely29f1aff2008-12-19 14:57:20 +0000399 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
Paul Mackerras66a45dd2006-01-14 15:04:06 +1100400
Milton Miller1383a342007-03-28 02:21:04 -0600401# anything not in $(targets)
Kumar Galab58a4572008-05-18 13:23:03 -0500402clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
403 zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
Stephen Rothwell1b041882012-03-15 18:20:13 +0000404 zImage.miboot zImage.pmac zImage.pseries \
Corey Minyard58706ef2010-01-29 14:18:20 +0000405 zImage.maple simpleImage.* otheros.bld *.dtb
Milton Miller1383a342007-03-28 02:21:04 -0600406
407# clean up files cached by wrapper
408clean-kernel := vmlinux.strip vmlinux.bin
409clean-kernel += $(addsuffix .gz,$(clean-kernel))
410# If not absolute clean-files are relative to $(obj).
411clean-files += $(addprefix $(objtree)/, $(clean-kernel))
David Woodhouse773f76b2007-12-03 13:56:58 +1100412
413WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
414WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
415WRAPPER_BINDIR := /usr/sbin
416INSTALL := install
417
418extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
419hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
420wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
Ben Hutchings4d9ef892011-01-08 14:24:01 +0000421dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
David Woodhouse773f76b2007-12-03 13:56:58 +1100422
423all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
424
425quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
426 cmd_mkdir = mkdir -p $@
427
428quiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
429 cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
430
431quiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
432 cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
433
434quiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
435 cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
436
437quiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
438 cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
439 sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
440 -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
441
442
443$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
444 $(call cmd,mkdir)
445
446$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
447 $(call cmd,install)
448
449$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
450 $(call cmd,install_exe)
451
452$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
453 $(call cmd,install_dts)
454
455$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
456 $(call cmd,install_wrapper)
457
458$(obj)/bootwrapper_install: $(all-installed)