194b212c2SPaul Mackerras# Makefile for making ELF bootable images for booting on CHRP 294b212c2SPaul Mackerras# using Open Firmware. 394b212c2SPaul Mackerras# 494b212c2SPaul Mackerras# Geert Uytterhoeven September 1997 594b212c2SPaul Mackerras# 694b212c2SPaul Mackerras# Based on coffboot by Paul Mackerras 794b212c2SPaul Mackerras# Simplified for ppc64 by Todd Inglett 894b212c2SPaul Mackerras# 994b212c2SPaul Mackerras# NOTE: this code is built for 32 bit in ELF32 format even though 1094b212c2SPaul Mackerras# it packages a 64 bit kernel. We do this to simplify the 1194b212c2SPaul Mackerras# bootloader and increase compatibility with OpenFirmware. 1294b212c2SPaul Mackerras# 1394b212c2SPaul Mackerras# To this end we need to define BOOTCC, etc, as the tools 14b610b978SDavid Gibson# needed to build the 32 bit image. That's normally the same 15b610b978SDavid Gibson# compiler for the rest of the kernel, with the -m32 flag added. 1694b212c2SPaul Mackerras# To make it easier to setup a cross compiler, 1794b212c2SPaul Mackerras# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE 1894b212c2SPaul Mackerras# in the toplevel makefile. 1994b212c2SPaul Mackerras 202bf11819SPaul Mackerrasall: $(obj)/zImage 2194b212c2SPaul Mackerras 22b610b978SDavid GibsonBOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 23b610b978SDavid Gibson -fno-strict-aliasing -Os -msoft-float -pipe \ 24b610b978SDavid Gibson -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 25b610b978SDavid Gibson -isystem $(shell $(CROSS32CC) -print-file-name=include) 2694b212c2SPaul MackerrasBOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 2794b212c2SPaul Mackerras 28105c13ddSGrant Likelyifdef CONFIG_DEBUG_INFO 29105c13ddSGrant LikelyBOOTCFLAGS += -g 30105c13ddSGrant Likelyendif 31105c13ddSGrant Likely 32fda7ffd2SNiels Kristian Bech Jensenifeq ($(call cc-option-yn, -fstack-protector),y) 33fda7ffd2SNiels Kristian Bech JensenBOOTCFLAGS += -fno-stack-protector 34fda7ffd2SNiels Kristian Bech Jensenendif 35fda7ffd2SNiels Kristian Bech Jensen 362f0dfeaaSDavid GibsonBOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt 3794b212c2SPaul Mackerras 389d4ae9fcSKumar GalaDTS_FLAGS ?= -p 1024 399d4ae9fcSKumar Gala 40bf2e70acSJosh Boyer$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 41bf2e70acSJosh Boyer$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 42bf2e70acSJosh Boyer$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 43bf2e70acSJosh Boyer$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 449f3eefc4SJosh Boyer$(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 452e71cc0dSJosh Boyer$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 46b9e4f176SGrant Likely$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405 4760e41753SJosh Boyer 486bbc5476SHugh Blemings 492bf11819SPaul Mackerraszlib := inffast.c inflate.c inftrees.c 502bf11819SPaul Mackerraszlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h 512bf11819SPaul Mackerraszliblinuxheader := zlib.h zconf.h zutil.h 522bf11819SPaul Mackerras 534ff23fa9SHugh Dickins$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o prpmc2800.o): \ 54d25a9d66SDavid Gibson $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 552bf11819SPaul Mackerras 562f0dfeaaSDavid Gibsonsrc-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 57143580ecSKumar Galasrc-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ 582f0dfeaaSDavid Gibson $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ 59ad9d2716SDavid Gibson ns16550.c serial.c simple_alloc.c div64.S util.S \ 602e601613SDavid Gibson gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 61d0f53fafSScott Wood 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ 62bbc6fac3SScott Wood cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \ 63bbc6fac3SScott Wood fsl-soc.c mpc8xx.c pq2.c 643490cba5SJon Loeligersrc-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \ 65bafdb645SGeoff Levand cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ 66606d08bcSValentine Barshak ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ 6725431333SGrant Likely cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \ 6825431333SGrant Likely cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ 69c6ec08e0SRemi Machet fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \ 701e12f3c5SSean MacLennan cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ 71d2477b5cSGrant Likely cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ 7294c73a8fSJosh Boyer virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ 7394c73a8fSJosh Boyer cuboot-acadia.c 74cd197ffcSDavid Gibsonsrc-boot := $(src-wlib) $(src-plat) empty.c 752bf11819SPaul Mackerras 762bf11819SPaul Mackerrassrc-boot := $(addprefix $(obj)/, $(src-boot)) 772bf11819SPaul Mackerrasobj-boot := $(addsuffix .o, $(basename $(src-boot))) 782bf11819SPaul Mackerrasobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 792bf11819SPaul Mackerrasobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 802bf11819SPaul Mackerras 8194b212c2SPaul Mackerrasquiet_cmd_copy_zlib = COPY $@ 823ff6eeccSAdrian Bunk cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8394b212c2SPaul Mackerras 8494b212c2SPaul Mackerrasquiet_cmd_copy_zlibheader = COPY $@ 8567ccd2fcSSegher Boessenkool cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8694b212c2SPaul Mackerras# stddef.h for NULL 8794b212c2SPaul Mackerrasquiet_cmd_copy_zliblinuxheader = COPY $@ 8867ccd2fcSSegher Boessenkool cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8994b212c2SPaul Mackerras 9094b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 9194b212c2SPaul Mackerras $(call cmd,copy_zlib) 9294b212c2SPaul Mackerras 9394b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 9494b212c2SPaul Mackerras $(call cmd,copy_zlibheader) 9594b212c2SPaul Mackerras 9694b212c2SPaul Mackerras$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% 9794b212c2SPaul Mackerras $(call cmd,copy_zliblinuxheader) 9894b212c2SPaul Mackerras 992bf11819SPaul Mackerras$(obj)/empty.c: 1002bf11819SPaul Mackerras @touch $@ 10194b212c2SPaul Mackerras 102bafdb645SGeoff Levand$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S 1032bf11819SPaul Mackerras @cp $< $@ 1042bf11819SPaul Mackerras 1052bf11819SPaul Mackerrasclean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ 106b58a4575SKumar Gala empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 10794b212c2SPaul Mackerras 10894b212c2SPaul Mackerrasquiet_cmd_bootcc = BOOTCC $@ 10994b212c2SPaul Mackerras cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 11094b212c2SPaul Mackerras 11194b212c2SPaul Mackerrasquiet_cmd_bootas = BOOTAS $@ 11294b212c2SPaul Mackerras cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 11394b212c2SPaul Mackerras 1142bf11819SPaul Mackerrasquiet_cmd_bootar = BOOTAR $@ 115235fd835SMilton Miller cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ 11694b212c2SPaul Mackerras 117235fd835SMilton Miller$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE 1182f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 11994b212c2SPaul Mackerras $(call if_changed_dep,bootcc) 120235fd835SMilton Miller$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE 1212f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 12294b212c2SPaul Mackerras $(call if_changed_dep,bootas) 12394b212c2SPaul Mackerras 124235fd835SMilton Miller$(obj)/wrapper.a: $(obj-wlib) FORCE 125235fd835SMilton Miller $(call if_changed,bootar) 12694b212c2SPaul Mackerras 127e2dc87a1SDavid Gibsonhostprogs-y := addnote addRamDisk hack-coff mktree dtc 12866a45dd3SPaul Mackerras 129235fd835SMilton Millertargets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) 130cd197ffcSDavid Gibsonextra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 131bafdb645SGeoff Levand $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds 13294b212c2SPaul Mackerras 13325431333SGrant Likelydtstree := $(srctree)/$(src)/dts 13425431333SGrant Likely 1352bf11819SPaul Mackerraswrapper :=$(srctree)/$(src)/wrapper 136e2dc87a1SDavid Gibsonwrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ 137235fd835SMilton Miller $(wrapper) FORCE 13894b212c2SPaul Mackerras 1392bf11819SPaul Mackerras############# 140e2dc87a1SDavid Gibson# Bits for building dtc 141e2dc87a1SDavid Gibson# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output 142e2dc87a1SDavid Gibson 143e2dc87a1SDavid Gibsondtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o 144e2dc87a1SDavid Gibsondtc-objs += dtc-lexer.lex.o dtc-parser.tab.o 145e2dc87a1SDavid Gibsondtc-objs := $(addprefix dtc-src/, $(dtc-objs)) 146e2dc87a1SDavid Gibson 147e2dc87a1SDavid Gibson# prerequisites on generated files needs to be explicit 148e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h 149e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h 150e2dc87a1SDavid Gibson 151e2dc87a1SDavid GibsonHOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/ 152e2dc87a1SDavid Gibson 153e2dc87a1SDavid Gibsontargets += dtc-src/dtc-parser.tab.c 154e2dc87a1SDavid Gibsontargets += dtc-src/dtc-lexer.lex.c 155e2dc87a1SDavid Gibson 156e4ccde02SKumar Galaclean-files += dtc-src/dtc-parser.tab.h 157e4ccde02SKumar Gala 158e2dc87a1SDavid Gibsonifdef DTC_GENPARSER 159e2dc87a1SDavid GibsonBISON = bison 160e2dc87a1SDavid GibsonFLEX = flex 161e2dc87a1SDavid Gibson 162e2dc87a1SDavid Gibsonquiet_cmd_bison = BISON $@ 163e2dc87a1SDavid Gibson cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped 164e2dc87a1SDavid Gibsonquiet_cmd_flex = FLEX $@ 165e2dc87a1SDavid Gibson cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped 166e2dc87a1SDavid Gibson 167e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE 168e2dc87a1SDavid Gibson $(call if_changed,bison) 169e2dc87a1SDavid Gibson 170e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c 171e2dc87a1SDavid Gibson 172e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE 173e2dc87a1SDavid Gibson $(call if_changed,flex) 174e2dc87a1SDavid Gibsonendif 175e2dc87a1SDavid Gibson 176e2dc87a1SDavid Gibson############# 1772bf11819SPaul Mackerras# Bits for building various flavours of zImage 17894b212c2SPaul Mackerras 1792bf11819SPaul Mackerrasifneq ($(CROSS32_COMPILE),) 180dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS32_COMPILE)" 1812bf11819SPaul Mackerraselse 1822bf11819SPaul Mackerrasifneq ($(CROSS_COMPILE),) 183dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS_COMPILE)" 1842bf11819SPaul Mackerrasendif 1852bf11819SPaul Mackerrasendif 18694b212c2SPaul Mackerras 1879da82a6dSMilton Miller# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd 1882bf11819SPaul Mackerrasquiet_cmd_wrap = WRAP $@ 1899da82a6dSMilton Miller cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ 1909da82a6dSMilton Miller $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux 1912bf11819SPaul Mackerras 1922bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PSERIES) += zImage.pseries 1932bf11819SPaul Mackerrasimage-$(CONFIG_PPC_MAPLE) += zImage.pseries 194020533efSGeoff Levandimage-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries 195595be948SGrant Likelyimage-$(CONFIG_PPC_PS3) += dtbImage.ps3 196c347b798SIshizaki Kouimage-$(CONFIG_PPC_CELLEB) += zImage.pseries 197def434c2SBenjamin Krillimage-$(CONFIG_PPC_CELL_QPACE) += zImage.pseries 1982bf11819SPaul Mackerrasimage-$(CONFIG_PPC_CHRP) += zImage.chrp 1997839af33SNicolas DETimage-$(CONFIG_PPC_EFIKA) += zImage.chrp 2002bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.pmac 20132dde0f9SJosh Boyerimage-$(CONFIG_PPC_HOLLY) += dtbImage.holly 202a7e695f6SDale Farnsworthimage-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 2030570d4edSStephen Rothwellimage-$(CONFIG_PPC_ISERIES) += zImage.iseries 204ac18c673SScott Woodimage-$(CONFIG_DEFAULT_UIMAGE) += uImage 205ac18c673SScott Wood 20625431333SGrant Likely# 20725431333SGrant Likely# Targets which embed a device tree blob 20825431333SGrant Likely# 20925431333SGrant Likely# Theses are default targets to build images which embed device tree blobs. 21025431333SGrant Likely# They are only required on boards which do not have FDT support in firmware. 211*2a94739cSNick Andrew# Boards with newish u-boot firmware can use the uImage target above 21225431333SGrant Likely# 21325431333SGrant Likely 21425431333SGrant Likely# Board ports in arch/powerpc/platform/40x/Kconfig 215595be948SGrant Likelyimage-$(CONFIG_EP405) += dtbImage.ep405 21625431333SGrant Likelyimage-$(CONFIG_WALNUT) += treeImage.walnut 21794c73a8fSJosh Boyerimage-$(CONFIG_ACADIA) += cuImage.acadia 21825431333SGrant Likely 21925431333SGrant Likely# Board ports in arch/powerpc/platform/44x/Kconfig 220f6dfc805SDavid Gibsonimage-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 221658e8170SJosh Boyerimage-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo 222b6014e15SGiuseppe Covielloimage-$(CONFIG_SAM440EP) += cuImage.sam440ep 223606d08bcSValentine Barshakimage-$(CONFIG_SEQUOIA) += cuImage.sequoia 224295e7427SValentine Barshakimage-$(CONFIG_RAINIER) += cuImage.rainier 2256bbc5476SHugh Blemingsimage-$(CONFIG_TAISHAN) += cuImage.taishan 2263de9c9cdSBenjamin Herrenschmidtimage-$(CONFIG_KATMAI) += cuImage.katmai 2271e12f3c5SSean MacLennanimage-$(CONFIG_WARP) += cuImage.warp 228d0a48c9fSJosh Boyerimage-$(CONFIG_YOSEMITE) += cuImage.yosemite 22994b212c2SPaul Mackerras 23025431333SGrant Likely# Board ports in arch/powerpc/platform/8xx/Kconfig 231efa58fbfSAdrian Bunkimage-$(CONFIG_MPC86XADS) += cuImage.mpc866ads 232efa58fbfSAdrian Bunkimage-$(CONFIG_MPC885ADS) += cuImage.mpc885ads 233595be948SGrant Likelyimage-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc 23425431333SGrant Likelyimage-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \ 235595be948SGrant Likely dtbImage.adder875-redboot 23625431333SGrant Likely 23725431333SGrant Likely# Board ports in arch/powerpc/platform/52xx/Kconfig 23825431333SGrant Likelyimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 cuImage.lite5200b 23925431333SGrant Likely 24025431333SGrant Likely# Board ports in arch/powerpc/platform/82xx/Kconfig 24125431333SGrant Likelyimage-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads 24225431333SGrant Likelyimage-$(CONFIG_PQ2FADS) += cuImage.pq2fads 243595be948SGrant Likelyimage-$(CONFIG_EP8248E) += dtbImage.ep8248e 24425431333SGrant Likely 24525431333SGrant Likely# Board ports in arch/powerpc/platform/83xx/Kconfig 24625431333SGrant Likelyimage-$(CONFIG_MPC832x_MDS) += cuImage.mpc832x_mds 24725431333SGrant Likelyimage-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb 24825431333SGrant Likelyimage-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \ 24925431333SGrant Likely cuImage.mpc8349emitxgp 25025431333SGrant Likelyimage-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds 25125431333SGrant Likelyimage-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds 25259d13f9dSBryan O'Donoghueimage-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot 25325431333SGrant Likely 25425431333SGrant Likely# Board ports in arch/powerpc/platform/85xx/Kconfig 25525431333SGrant Likelyimage-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads 25625431333SGrant Likelyimage-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads 25725431333SGrant Likelyimage-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ 25825431333SGrant Likely cuImage.mpc8548cds \ 25925431333SGrant Likely cuImage.mpc8555cds 26025431333SGrant Likelyimage-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 26125431333SGrant Likelyimage-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 26225431333SGrant Likely cuImage.mpc8572ds 26325431333SGrant Likelyimage-$(CONFIG_TQM8540) += cuImage.tqm8540 26425431333SGrant Likelyimage-$(CONFIG_TQM8541) += cuImage.tqm8541 2656dd1b64aSWolfgang Grandeggerimage-$(CONFIG_TQM8548) += cuImage.tqm8548 26625431333SGrant Likelyimage-$(CONFIG_TQM8555) += cuImage.tqm8555 26725431333SGrant Likelyimage-$(CONFIG_TQM8560) += cuImage.tqm8560 268a72a6f53SPaul Gortmakerimage-$(CONFIG_SBC8548) += cuImage.sbc8548 269a72a6f53SPaul Gortmakerimage-$(CONFIG_SBC8560) += cuImage.sbc8560 270ff880112SAlexandr Smirnovimage-$(CONFIG_KSI8560) += cuImage.ksi8560 27125431333SGrant Likely 27225431333SGrant Likely# Board ports in arch/powerpc/platform/embedded6xx/Kconfig 27325431333SGrant Likelyimage-$(CONFIG_STORCENTER) += cuImage.storcenter 27425431333SGrant Likelyimage-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2 275c6ec08e0SRemi Machetimage-$(CONFIG_PPC_C2K) += cuImage.c2k 276b09c1644SScott Wood 2779216ad8cSPaul Mackerras# For 32-bit powermacs, build the COFF and miboot images 2789216ad8cSPaul Mackerras# as well as the ELF images. 2792bf11819SPaul Mackerrasifeq ($(CONFIG_PPC32),y) 2802bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot 2812bf11819SPaul Mackerrasendif 28266a45dd3SPaul Mackerras 283c356aa45SGrant Likely# Allow extra targets to be added to the defconfig 284c356aa45SGrant Likelyimage-y += $(subst ",,$(CONFIG_EXTRA_TARGETS)) 285c356aa45SGrant Likely 2865d7960ffSMilton Millerinitrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-)) 287f6dfc805SDavid Gibsoninitrd-y := $(patsubst zImage%, zImage.initrd%, \ 288595be948SGrant Likely $(patsubst dtbImage%, dtbImage.initrd%, \ 2895d1a0411SJohn Linn $(patsubst simpleImage%, simpleImage.initrd%, \ 2905d1a0411SJohn Linn $(patsubst treeImage%, treeImage.initrd%, $(image-y))))) 2919da82a6dSMilton Millerinitrd-y := $(filter-out $(image-y), $(initrd-y)) 292235fd835SMilton Millertargets += $(image-y) $(initrd-y) 29394b212c2SPaul Mackerras 2949da82a6dSMilton Miller$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz 2959da82a6dSMilton Miller 2969da82a6dSMilton Miller# Don't put the ramdisk on the pattern rule; when its missing make will try 2979da82a6dSMilton Miller# the pattern rule with less dependencies that also matches (even with the 2989da82a6dSMilton Miller# hard dependency listed). 29925431333SGrant Likely$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) 30025431333SGrant Likely $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) 3019da82a6dSMilton Miller 30225431333SGrant Likely$(obj)/zImage.%: vmlinux $(wrapperbits) 30325431333SGrant Likely $(call if_changed,wrap,$*) 30425431333SGrant Likely 305595be948SGrant Likely# dtbImage% - a dtbImage is a zImage with an embedded device tree blob 306e04018e8SGrant Likely$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb 307e04018e8SGrant Likely $(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 30825431333SGrant Likely 309e04018e8SGrant Likely$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb 310e04018e8SGrant Likely $(call if_changed,wrap,$*,,$(obj)/$*.dtb) 3119da82a6dSMilton Miller 3124bb09281STony Breeds# This cannot be in the root of $(src) as the zImage rule always adds a $(obj) 3134bb09281STony Breeds# prefix 3144bb09281STony Breeds$(obj)/vmlinux.strip: vmlinux 3154bb09281STony Breeds $(STRIP) -s -R .comment $< -o $@ 3164bb09281STony Breeds 317549e8152SPaul Mackerras# The iseries hypervisor won't take an ET_DYN executable, so this 318549e8152SPaul Mackerras# changes the type (byte 17) in the file to ET_EXEC (2). 3190570d4edSStephen Rothwell$(obj)/zImage.iseries: vmlinux 3200570d4edSStephen Rothwell $(STRIP) -s -R .comment $< -o $@ 321549e8152SPaul Mackerras printf "\x02" | dd of=$@ conv=notrunc bs=1 seek=17 3220570d4edSStephen Rothwell 3239da82a6dSMilton Miller$(obj)/uImage: vmlinux $(wrapperbits) 3249da82a6dSMilton Miller $(call if_changed,wrap,uboot) 3259da82a6dSMilton Miller 326a4292d7aSGrant Likely$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 327a4292d7aSGrant Likely $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 328a4292d7aSGrant Likely 329e04018e8SGrant Likely$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 330e04018e8SGrant Likely $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb) 3310fdd717eSScott Wood 332d2477b5cSGrant Likely$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 333d2477b5cSGrant Likely $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 334d2477b5cSGrant Likely 335d2477b5cSGrant Likely$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 336d2477b5cSGrant Likely $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb) 337d2477b5cSGrant Likely 338e04018e8SGrant Likely$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 339e04018e8SGrant Likely $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 340f6dfc805SDavid Gibson 341e04018e8SGrant Likely$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 342e04018e8SGrant Likely $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) 343e04018e8SGrant Likely 344e04018e8SGrant Likely# Rule to build device tree blobs 345e04018e8SGrant Likely$(obj)/%.dtb: $(dtstree)/%.dts $(obj)/dtc 346e04018e8SGrant Likely $(obj)/dtc -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts 3476a32d085SDavid Gibson 3484bb09281STony Breeds# If there isn't a platform selected then just strip the vmlinux. 3494bb09281STony Breedsifeq (,$(image-y)) 3504bb09281STony Breedsimage-y := vmlinux.strip 3514bb09281STony Breedsendif 3524bb09281STony Breeds 3532bf11819SPaul Mackerras$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 3542bf11819SPaul Mackerras @rm -f $@; ln $< $@ 3552bf11819SPaul Mackerras$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) 3562bf11819SPaul Mackerras @rm -f $@; ln $< $@ 35794b212c2SPaul Mackerras 358928370c6SAkinobu Mitainstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) 3592bf11819SPaul Mackerras sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< 36066a45dd3SPaul Mackerras 3611383a34fSMilton Miller# anything not in $(targets) 362b58a4575SKumar Galaclean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \ 363b58a4575SKumar Gala zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ 364b58a4575SKumar Gala zImage.iseries zImage.miboot zImage.pmac zImage.pseries \ 365e04018e8SGrant Likely otheros.bld *.dtb 3661383a34fSMilton Miller 3671383a34fSMilton Miller# clean up files cached by wrapper 3681383a34fSMilton Millerclean-kernel := vmlinux.strip vmlinux.bin 3691383a34fSMilton Millerclean-kernel += $(addsuffix .gz,$(clean-kernel)) 3701383a34fSMilton Miller# If not absolute clean-files are relative to $(obj). 3711383a34fSMilton Millerclean-files += $(addprefix $(objtree)/, $(clean-kernel)) 372773f76b1SDavid Woodhouse 373773f76b1SDavid WoodhouseWRAPPER_OBJDIR := /usr/lib/kernel-wrapper 374773f76b1SDavid WoodhouseWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts 375773f76b1SDavid WoodhouseWRAPPER_BINDIR := /usr/sbin 376773f76b1SDavid WoodhouseINSTALL := install 377773f76b1SDavid Woodhouse 378773f76b1SDavid Woodhouseextra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) 379773f76b1SDavid Woodhousehostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y)) 380773f76b1SDavid Woodhousewrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper 381773f76b1SDavid Woodhousedts-installed := $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts)) 382773f76b1SDavid Woodhouse 383773f76b1SDavid Woodhouseall-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) 384773f76b1SDavid Woodhouse 385773f76b1SDavid Woodhousequiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 386773f76b1SDavid Woodhouse cmd_mkdir = mkdir -p $@ 387773f76b1SDavid Woodhouse 388773f76b1SDavid Woodhousequiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@) 389773f76b1SDavid Woodhouse cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ 390773f76b1SDavid Woodhouse 391773f76b1SDavid Woodhousequiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@) 392773f76b1SDavid Woodhouse cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ 393773f76b1SDavid Woodhouse 394773f76b1SDavid Woodhousequiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 395773f76b1SDavid Woodhouse cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ 396773f76b1SDavid Woodhouse 397773f76b1SDavid Woodhousequiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 398773f76b1SDavid Woodhouse cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\ 399773f76b1SDavid Woodhouse sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \ 400773f76b1SDavid Woodhouse -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \ 401773f76b1SDavid Woodhouse 402773f76b1SDavid Woodhouse 403773f76b1SDavid Woodhouse$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR): 404773f76b1SDavid Woodhouse $(call cmd,mkdir) 405773f76b1SDavid Woodhouse 406773f76b1SDavid Woodhouse$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR) 407773f76b1SDavid Woodhouse $(call cmd,install) 408773f76b1SDavid Woodhouse 409773f76b1SDavid Woodhouse$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR) 410773f76b1SDavid Woodhouse $(call cmd,install_exe) 411773f76b1SDavid Woodhouse 412773f76b1SDavid Woodhouse$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR) 413773f76b1SDavid Woodhouse $(call cmd,install_dts) 414773f76b1SDavid Woodhouse 415773f76b1SDavid Woodhouse$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR) 416773f76b1SDavid Woodhouse $(call cmd,install_wrapper) 417773f76b1SDavid Woodhouse 418773f76b1SDavid Woodhouse$(obj)/bootwrapper_install: $(all-installed) 419773f76b1SDavid Woodhouse 420