blob: 90e9d95486603281684c9a06bdbb5029e06b0843 [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 \
Ian Munsied72b0802013-09-23 12:05:11 +100025 -isystem $(shell $(CROSS32CC) -print-file-name=include) \
26 -mbig-endian
Olaf Heringdecd3002005-08-08 13:24:38 +100027BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Grant Likely105c13d2007-10-04 14:05:01 +100029ifdef CONFIG_DEBUG_INFO
30BOOTCFLAGS += -g
31endif
32
Niels Kristian Bech Jensenfda7ffd2006-07-02 13:02:27 +020033ifeq ($(call cc-option-yn, -fstack-protector),y)
34BOOTCFLAGS += -fno-stack-protector
35endif
36
David Gibson9fffb552009-04-30 15:25:53 +100037BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
Olaf Hering70540362005-10-28 17:46:38 -070038
Dirk Brandewie63849342010-12-22 11:57:28 -080039DTC_FLAGS ?= -p 1024
Kumar Gala9d4ae9f2008-06-26 18:58:11 +100040
Josh Boyerbf2e70a2008-02-19 13:52:48 +110041$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
42$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
Solomon Peachy0cdf50a2009-08-20 10:19:47 +000043$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
Josh Boyerbf2e70a2008-02-19 13:52:48 +110044$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
45$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
Josh Boyer9f3eefc2008-11-25 06:33:35 +000046$(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
Josh Boyer2e71cc02007-09-24 07:32:15 -050047$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
Torez Smithb4e8c8d2010-03-05 10:45:54 +000048$(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
Tony Breeds228d5502011-11-30 21:39:24 +000049$(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
Grant Likelyb9e4f172008-04-25 03:33:44 +100050$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
Josh Boyer60e41752007-05-17 04:51:37 +100051
Hugh Blemings6bbc5472007-12-21 15:39:28 +110052
Paul Mackerras2bf11812006-09-27 22:47:03 +100053zlib := inffast.c inflate.c inftrees.c
54zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
55zliblinuxheader := zlib.h zconf.h zutil.h
56
Hugh Dickins4ff23fa2008-09-07 00:35:48 +010057$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o prpmc2800.o): \
David Gibsond25a9d62007-05-04 17:14:13 +100058 $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
Paul Mackerras2bf11812006-09-27 22:47:03 +100059
David Gibson9fffb552009-04-30 15:25:53 +100060libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
61libfdtheader := fdt.h libfdt.h libfdt_internal.h
62
Matthew McClintock73927692011-07-19 06:22:44 +000063$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o): \
David Gibson9fffb552009-04-30 15:25:53 +100064 $(addprefix $(obj)/,$(libfdtheader))
65
Tony Breedsb81f18e2012-04-03 15:00:39 +000066src-wlib-y := string.S crt0.S crtsavres.S stdio.c main.c \
David Gibson9fffb552009-04-30 15:25:53 +100067 $(libfdt) libfdt-wrapper.c \
David Gibsonad9d2712007-03-05 14:24:52 +110068 ns16550.c serial.c simple_alloc.c div64.S util.S \
Tony Breedsb81f18e2012-04-03 15:00:39 +000069 gunzip_util.c elf_util.c $(zlib) devtree.c stdlib.c \
70 oflib.c ofconsole.c cuboot.c mpsc.c cpm-serial.c \
71 uartlite.c mpc52xx-psc.c
72src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
73src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
Paul Gortmaker78f3d052014-01-09 15:33:35 -050074src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c fsl-soc.c
Tony Breedsb81f18e2012-04-03 15:00:39 +000075src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
Paul Gortmaker78f3d052014-01-09 15:33:35 -050076src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c
Tony Breedsb81f18e2012-04-03 15:00:39 +000077
Benjamin Herrenschmidt0c9fa292013-09-24 16:10:38 +100078src-plat-y := of.c epapr.c
Tony Breedsb81f18e2012-04-03 15:00:39 +000079src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
80 treeboot-walnut.c cuboot-acadia.c \
81 cuboot-kilauea.c simpleboot.c \
82 virtex405-head.S virtex.c
83src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
84 cuboot-bamboo.c cuboot-sam440ep.c \
85 cuboot-sequoia.c cuboot-rainier.c \
86 cuboot-taishan.c cuboot-katmai.c \
87 cuboot-warp.c cuboot-yosemite.c \
88 treeboot-iss4xx.c treeboot-currituck.c \
89 simpleboot.c fixed-head.S virtex.c
90src-plat-$(CONFIG_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
91src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
92src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
93src-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c
94src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
95src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
96 cuboot-c2k.c gamecube-head.S \
97 gamecube.c wii-head.S wii.c holly.c \
Stephen Chiversbe201982014-01-09 13:01:22 +110098 prpmc2800.c fixed-head.S mvme5100.c
Tony Breedsb81f18e2012-04-03 15:00:39 +000099src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
100src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
Benjamin Herrenschmidt0c9fa292013-09-24 16:10:38 +1000101src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
Tony Breedsb81f18e2012-04-03 15:00:39 +0000102
103src-wlib := $(sort $(src-wlib-y))
104src-plat := $(sort $(src-plat-y))
David Gibsoncd197ff2007-03-05 14:24:52 +1100105src-boot := $(src-wlib) $(src-plat) empty.c
Paul Mackerras2bf11812006-09-27 22:47:03 +1000106
107src-boot := $(addprefix $(obj)/, $(src-boot))
108obj-boot := $(addsuffix .o, $(basename $(src-boot)))
109obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
110obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
Matthew McClintock0090e022012-09-06 08:48:54 +0000111obj-plat: $(libfdt)
Paul Mackerras2bf11812006-09-27 22:47:03 +1000112
Olaf Hering70540362005-10-28 17:46:38 -0700113quiet_cmd_copy_zlib = COPY $@
Adrian Bunk3ff6eec2008-01-24 22:16:20 +0100114 cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
Olaf Hering70540362005-10-28 17:46:38 -0700115
116quiet_cmd_copy_zlibheader = COPY $@
Segher Boessenkool67ccd2f2007-05-16 22:49:22 +1000117 cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
Olaf Hering70540362005-10-28 17:46:38 -0700118# stddef.h for NULL
119quiet_cmd_copy_zliblinuxheader = COPY $@
Segher Boessenkool67ccd2f2007-05-16 22:49:22 +1000120 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 -0700121
122$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
123 $(call cmd,copy_zlib)
124
125$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
126 $(call cmd,copy_zlibheader)
127
128$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
129 $(call cmd,copy_zliblinuxheader)
130
David Gibson9fffb552009-04-30 15:25:53 +1000131quiet_cmd_copy_libfdt = COPY $@
132 cmd_copy_libfdt = cp $< $@
133
134$(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
135 $(call cmd,copy_libfdt)
136
Paul Mackerras2bf11812006-09-27 22:47:03 +1000137$(obj)/empty.c:
138 @touch $@
Olaf Hering70540362005-10-28 17:46:38 -0700139
Geoff Levandbafdb642007-07-04 09:07:18 +1000140$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S
Paul Mackerras2bf11812006-09-27 22:47:03 +1000141 @cp $< $@
142
143clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
David Gibson9fffb552009-04-30 15:25:53 +1000144 $(libfdt) $(libfdtheader) \
Kumar Galab58a4572008-05-18 13:23:03 -0500145 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
Olaf Hering70540362005-10-28 17:46:38 -0700146
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147quiet_cmd_bootcc = BOOTCC $@
148 cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
149
150quiet_cmd_bootas = BOOTAS $@
151 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
152
Paul Mackerras2bf11812006-09-27 22:47:03 +1000153quiet_cmd_bootar = BOOTAR $@
Michal Marek31355402011-05-05 05:22:55 +0000154 cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
Geoff Levanda24c8482005-08-15 13:59:13 -0700155
David Gibson9fffb552009-04-30 15:25:53 +1000156$(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
157 $(call if_changed_dep,bootcc)
Milton Miller235fd832007-03-21 09:02:37 -0600158$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
David Gibson2f0dfea2007-12-10 14:28:39 +1100159 $(Q)mkdir -p $(dir $@)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 $(call if_changed_dep,bootcc)
Milton Miller235fd832007-03-21 09:02:37 -0600161$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
David Gibson2f0dfea2007-12-10 14:28:39 +1100162 $(Q)mkdir -p $(dir $@)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 $(call if_changed_dep,bootas)
164
Milton Miller235fd832007-03-21 09:02:37 -0600165$(obj)/wrapper.a: $(obj-wlib) FORCE
166 $(call if_changed,bootar)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167
Paul Mackerras97bb63e2010-06-07 14:27:10 +0000168hostprogs-y := addnote hack-coff mktree
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
Milton Miller235fd832007-03-21 09:02:37 -0600170targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
David Gibsoncd197ff2007-03-05 14:24:52 +1100171extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
Geoff Levandbafdb642007-07-04 09:07:18 +1000172 $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
Paul Mackerras66a45dd2006-01-14 15:04:06 +1100173
Grant Likely25431332008-02-07 05:18:34 +1100174dtstree := $(srctree)/$(src)/dts
175
Paul Mackerras2bf11812006-09-27 22:47:03 +1000176wrapper :=$(srctree)/$(src)/wrapper
David Gibson9fffb552009-04-30 15:25:53 +1000177wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
Milton Miller235fd832007-03-21 09:02:37 -0600178 $(wrapper) FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179
Paul Mackerras2bf11812006-09-27 22:47:03 +1000180#############
181# Bits for building various flavours of zImage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
Paul Mackerras2bf11812006-09-27 22:47:03 +1000183ifneq ($(CROSS32_COMPILE),)
Michael Ellermandcf906512006-09-30 11:54:09 +1000184CROSSWRAP := -C "$(CROSS32_COMPILE)"
Paul Mackerras2bf11812006-09-27 22:47:03 +1000185else
186ifneq ($(CROSS_COMPILE),)
Michael Ellermandcf906512006-09-30 11:54:09 +1000187CROSSWRAP := -C "$(CROSS_COMPILE)"
Paul Mackerras2bf11812006-09-27 22:47:03 +1000188endif
189endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
Milton Miller9da82a62007-03-21 09:03:23 -0600191# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
Paul Mackerras2bf11812006-09-27 22:47:03 +1000192quiet_cmd_wrap = WRAP $@
Milton Miller9da82a62007-03-21 09:03:23 -0600193 cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
194 $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux
Paul Mackerras2bf11812006-09-27 22:47:03 +1000195
Geoff Levand020533e2006-10-07 15:33:53 -0700196image-$(CONFIG_PPC_PSERIES) += zImage.pseries
Benjamin Herrenschmidt55190f82011-09-19 17:44:52 +0000197image-$(CONFIG_PPC_POWERNV) += zImage.pseries
Corey Minyard58706ef2010-01-29 14:18:20 +0000198image-$(CONFIG_PPC_MAPLE) += zImage.maple
Geoff Levand020533e2006-10-07 15:33:53 -0700199image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries
Grant Likely595be942008-02-22 05:57:07 +1100200image-$(CONFIG_PPC_PS3) += dtbImage.ps3
Ishizaki Kouc347b792007-02-02 16:47:17 +0900201image-$(CONFIG_PPC_CELLEB) += zImage.pseries
Benjamin Krilldef434c2008-11-27 16:15:44 +0100202image-$(CONFIG_PPC_CELL_QPACE) += zImage.pseries
Geoff Levand020533e2006-10-07 15:33:53 -0700203image-$(CONFIG_PPC_CHRP) += zImage.chrp
Nicolas DET7839af32006-11-17 17:08:37 +0100204image-$(CONFIG_PPC_EFIKA) += zImage.chrp
Geoff Levand020533e2006-10-07 15:33:53 -0700205image-$(CONFIG_PPC_PMAC) += zImage.pmac
Josh Boyer32dde0f2008-09-09 04:00:28 +0000206image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
Dale Farnswortha7e695f2008-04-08 08:13:10 +1000207image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800
Scott Woodac18c672007-05-03 04:00:00 +1000208image-$(CONFIG_DEFAULT_UIMAGE) += uImage
David Gibson6c5b59b2011-04-14 18:29:16 +0000209image-$(CONFIG_EPAPR_BOOT) += zImage.epapr
Scott Woodac18c672007-05-03 04:00:00 +1000210
Grant Likely25431332008-02-07 05:18:34 +1100211#
212# Targets which embed a device tree blob
213#
214# Theses are default targets to build images which embed device tree blobs.
215# They are only required on boards which do not have FDT support in firmware.
Nick Andrew2a947392009-01-03 18:59:37 +1100216# Boards with newish u-boot firmware can use the uImage target above
Grant Likely25431332008-02-07 05:18:34 +1100217#
218
219# Board ports in arch/powerpc/platform/40x/Kconfig
Grant Likely595be942008-02-22 05:57:07 +1100220image-$(CONFIG_EP405) += dtbImage.ep405
Solomon Peachy0cdf50a2009-08-20 10:19:47 +0000221image-$(CONFIG_HOTFOOT) += cuImage.hotfoot
Grant Likely25431332008-02-07 05:18:34 +1100222image-$(CONFIG_WALNUT) += treeImage.walnut
Josh Boyer94c73a82008-09-03 21:01:39 -0400223image-$(CONFIG_ACADIA) += cuImage.acadia
Benjamin Herrenschmidt11eab2972011-12-01 19:35:08 +0000224image-$(CONFIG_OBS600) += uImage.obs600
Grant Likely25431332008-02-07 05:18:34 +1100225
226# Board ports in arch/powerpc/platform/44x/Kconfig
David Gibsonf6dfc802007-05-08 14:10:01 +1000227image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
Josh Boyer658e8172007-09-15 04:54:11 +1000228image-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo
Giuseppe Coviellob6014e12008-05-20 01:20:47 +1000229image-$(CONFIG_SAM440EP) += cuImage.sam440ep
Valentine Barshak606d08b2007-08-29 17:38:30 +0400230image-$(CONFIG_SEQUOIA) += cuImage.sequoia
Valentine Barshak295e7422007-10-31 03:56:06 +1100231image-$(CONFIG_RAINIER) += cuImage.rainier
Hugh Blemings6bbc5472007-12-21 15:39:28 +1100232image-$(CONFIG_TAISHAN) += cuImage.taishan
Benjamin Herrenschmidt3de9c9c2007-12-21 15:39:34 +1100233image-$(CONFIG_KATMAI) += cuImage.katmai
Sean MacLennan1e12f3c2008-01-11 17:17:51 +1100234image-$(CONFIG_WARP) += cuImage.warp
Josh Boyerd0a48c92008-03-06 21:15:52 -0600235image-$(CONFIG_YOSEMITE) += cuImage.yosemite
Torez Smithb4e8c8d2010-03-05 10:45:54 +0000236image-$(CONFIG_ISS4xx) += treeImage.iss4xx \
237 treeImage.iss4xx-mpic
Tony Breeds228d5502011-11-30 21:39:24 +0000238image-$(CONFIG_CURRITUCK) += treeImage.currituck
Geoff Levanda24c8482005-08-15 13:59:13 -0700239
Grant Likely25431332008-02-07 05:18:34 +1100240# Board ports in arch/powerpc/platform/8xx/Kconfig
Adrian Bunkefa58fb2008-05-22 03:38:28 +1000241image-$(CONFIG_MPC86XADS) += cuImage.mpc866ads
242image-$(CONFIG_MPC885ADS) += cuImage.mpc885ads
Grant Likely595be942008-02-22 05:57:07 +1100243image-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc
Grant Likely25431332008-02-07 05:18:34 +1100244image-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \
Grant Likely595be942008-02-22 05:57:07 +1100245 dtbImage.adder875-redboot
Grant Likely25431332008-02-07 05:18:34 +1100246
247# Board ports in arch/powerpc/platform/52xx/Kconfig
Grant Likelybfee95b2009-02-04 13:39:17 -0700248image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 lite5200.dtb
249image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b lite5200b.dtb
250image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 media5200.dtb
Grant Likely25431332008-02-07 05:18:34 +1100251
252# Board ports in arch/powerpc/platform/82xx/Kconfig
253image-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads
254image-$(CONFIG_PQ2FADS) += cuImage.pq2fads
Grant Likely595be942008-02-22 05:57:07 +1100255image-$(CONFIG_EP8248E) += dtbImage.ep8248e
Grant Likely25431332008-02-07 05:18:34 +1100256
257# Board ports in arch/powerpc/platform/83xx/Kconfig
258image-$(CONFIG_MPC832x_MDS) += cuImage.mpc832x_mds
259image-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb
260image-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \
261 cuImage.mpc8349emitxgp
262image-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds
263image-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds
Bryan O'Donoghue59d13f92008-05-08 13:47:00 +0100264image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
Grant Likely25431332008-02-07 05:18:34 +1100265
266# Board ports in arch/powerpc/platform/85xx/Kconfig
267image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
268image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads
269image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \
Zhao Chenhui0d4fdd32012-03-06 17:06:44 +0800270 cuImage.mpc8548cds_32b \
Grant Likely25431332008-02-07 05:18:34 +1100271 cuImage.mpc8555cds
272image-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds
273image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \
274 cuImage.mpc8572ds
275image-$(CONFIG_TQM8540) += cuImage.tqm8540
276image-$(CONFIG_TQM8541) += cuImage.tqm8541
Wolfgang Grandegger6dd1b642008-06-06 13:50:04 +0200277image-$(CONFIG_TQM8548) += cuImage.tqm8548
Grant Likely25431332008-02-07 05:18:34 +1100278image-$(CONFIG_TQM8555) += cuImage.tqm8555
279image-$(CONFIG_TQM8560) += cuImage.tqm8560
Paul Gortmakera72a6f52008-03-18 16:13:10 +1100280image-$(CONFIG_SBC8548) += cuImage.sbc8548
Alexandr Smirnovff880112008-03-04 19:34:26 +0300281image-$(CONFIG_KSI8560) += cuImage.ksi8560
Grant Likely25431332008-02-07 05:18:34 +1100282
283# Board ports in arch/powerpc/platform/embedded6xx/Kconfig
284image-$(CONFIG_STORCENTER) += cuImage.storcenter
285image-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2
Remi Machetc6ec08e2008-05-21 06:50:10 +1000286image-$(CONFIG_PPC_C2K) += cuImage.c2k
Albert Herranzb68a24b2009-12-12 06:31:36 +0000287image-$(CONFIG_GAMECUBE) += dtbImage.gamecube
Albert Herranz6cdd24172009-12-12 06:31:45 +0000288image-$(CONFIG_WII) += dtbImage.wii
Stephen Chiversbe201982014-01-09 13:01:22 +1100289image-$(CONFIG_MVME5100) += dtbImage.mvme5100
Scott Woodb09c1642008-01-17 16:31:40 -0600290
Gerhard Pircher8f237352009-02-10 12:26:11 +0000291# Board port in arch/powerpc/platform/amigaone/Kconfig
292image-$(CONFIG_AMIGAONE) += cuImage.amigaone
293
Paul Mackerras9216ad82006-01-15 13:00:08 +1100294# For 32-bit powermacs, build the COFF and miboot images
295# as well as the ELF images.
Paul Mackerras2bf11812006-09-27 22:47:03 +1000296ifeq ($(CONFIG_PPC32),y)
297image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
298endif
Paul Mackerras66a45dd2006-01-14 15:04:06 +1100299
Grant Likelyc356aa42008-07-09 09:41:52 -0600300# Allow extra targets to be added to the defconfig
301image-y += $(subst ",,$(CONFIG_EXTRA_TARGETS))
302
Milton Miller5d7960f2007-03-21 09:03:10 -0600303initrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
David Gibsonf6dfc802007-05-08 14:10:01 +1000304initrd-y := $(patsubst zImage%, zImage.initrd%, \
Grant Likely595be942008-02-22 05:57:07 +1100305 $(patsubst dtbImage%, dtbImage.initrd%, \
John Linn5d1a0412008-07-01 14:17:18 -0600306 $(patsubst simpleImage%, simpleImage.initrd%, \
307 $(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
Milton Miller9da82a62007-03-21 09:03:23 -0600308initrd-y := $(filter-out $(image-y), $(initrd-y))
Milton Miller235fd832007-03-21 09:02:37 -0600309targets += $(image-y) $(initrd-y)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310
Milton Miller9da82a62007-03-21 09:03:23 -0600311$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
312
313# Don't put the ramdisk on the pattern rule; when its missing make will try
314# the pattern rule with less dependencies that also matches (even with the
315# hard dependency listed).
Grant Likely25431332008-02-07 05:18:34 +1100316$(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
317 $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
Milton Miller9da82a62007-03-21 09:03:23 -0600318
Grant Likely25431332008-02-07 05:18:34 +1100319$(obj)/zImage.%: vmlinux $(wrapperbits)
320 $(call if_changed,wrap,$*)
321
Grant Likely595be942008-02-22 05:57:07 +1100322# dtbImage% - a dtbImage is a zImage with an embedded device tree blob
Grant Likelye04018e2008-03-25 09:52:46 +1100323$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
324 $(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
Grant Likely25431332008-02-07 05:18:34 +1100325
Grant Likelye04018e2008-03-25 09:52:46 +1100326$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
327 $(call if_changed,wrap,$*,,$(obj)/$*.dtb)
Milton Miller9da82a62007-03-21 09:03:23 -0600328
Tony Breeds4bb09282007-07-04 14:04:31 +1000329# This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
330# prefix
331$(obj)/vmlinux.strip: vmlinux
332 $(STRIP) -s -R .comment $< -o $@
333
Milton Miller9da82a62007-03-21 09:03:23 -0600334$(obj)/uImage: vmlinux $(wrapperbits)
335 $(call if_changed,wrap,uboot)
336
Benjamin Herrenschmidt11eab2972011-12-01 19:35:08 +0000337$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
338 $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
339
340$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
341 $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
342
Grant Likelya4292d7a2008-10-17 19:12:07 +0000343$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
344 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
345
Grant Likelye04018e2008-03-25 09:52:46 +1100346$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
347 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
Scott Wood0fdd7172007-04-17 09:25:50 +1000348
Grant Likelyd2477b52008-03-19 04:07:43 +1100349$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
350 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
351
352$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
353 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb)
354
Grant Likelye04018e2008-03-25 09:52:46 +1100355$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
356 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
David Gibsonf6dfc802007-05-08 14:10:01 +1000357
Grant Likelye04018e2008-03-25 09:52:46 +1100358$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
359 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
360
361# Rule to build device tree blobs
Stephen Warren7c431852012-01-09 11:38:15 -0700362$(obj)/%.dtb: $(src)/dts/%.dts FORCE
363 $(call if_changed_dep,dtc)
David Gibson6a32d082007-05-15 12:40:23 +1000364
Tony Breeds4bb09282007-07-04 14:04:31 +1000365# If there isn't a platform selected then just strip the vmlinux.
366ifeq (,$(image-y))
367image-y := vmlinux.strip
368endif
369
Paul Mackerras2bf11812006-09-27 22:47:03 +1000370$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
371 @rm -f $@; ln $< $@
372$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
373 @rm -f $@; ln $< $@
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374
Akinobu Mita928370c2007-04-10 21:05:31 +1000375install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
Grant Likely29f1aff2008-12-19 14:57:20 +0000376 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
Paul Mackerras66a45dd2006-01-14 15:04:06 +1100377
Milton Miller1383a342007-03-28 02:21:04 -0600378# anything not in $(targets)
Kumar Galab58a4572008-05-18 13:23:03 -0500379clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
380 zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
Stephen Rothwell1b041882012-03-15 18:20:13 +0000381 zImage.miboot zImage.pmac zImage.pseries \
Corey Minyard58706ef2010-01-29 14:18:20 +0000382 zImage.maple simpleImage.* otheros.bld *.dtb
Milton Miller1383a342007-03-28 02:21:04 -0600383
384# clean up files cached by wrapper
385clean-kernel := vmlinux.strip vmlinux.bin
386clean-kernel += $(addsuffix .gz,$(clean-kernel))
387# If not absolute clean-files are relative to $(obj).
388clean-files += $(addprefix $(objtree)/, $(clean-kernel))
David Woodhouse773f76b2007-12-03 13:56:58 +1100389
390WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
391WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
392WRAPPER_BINDIR := /usr/sbin
393INSTALL := install
394
395extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
396hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
397wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
Ben Hutchings4d9ef892011-01-08 14:24:01 +0000398dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
David Woodhouse773f76b2007-12-03 13:56:58 +1100399
400all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
401
402quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
403 cmd_mkdir = mkdir -p $@
404
405quiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
406 cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
407
408quiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
409 cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
410
411quiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
412 cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
413
414quiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
415 cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
416 sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
417 -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
418
419
420$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
421 $(call cmd,mkdir)
422
423$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
424 $(call cmd,install)
425
426$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
427 $(call cmd,install_exe)
428
429$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
430 $(call cmd,install_dts)
431
432$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
433 $(call cmd,install_wrapper)
434
435$(obj)/bootwrapper_install: $(all-installed)