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 38*9d4ae9fcSKumar GalaDTS_FLAGS ?= -p 1024 39*9d4ae9fcSKumar 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 442e71cc0dSJosh Boyer$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 45b9e4f176SGrant Likely$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405 4660e41753SJosh Boyer 476bbc5476SHugh Blemings 482bf11819SPaul Mackerraszlib := inffast.c inflate.c inftrees.c 492bf11819SPaul Mackerraszlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h 502bf11819SPaul Mackerraszliblinuxheader := zlib.h zconf.h zutil.h 512bf11819SPaul Mackerras 52d25a9d66SDavid Gibson$(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ 53d25a9d66SDavid Gibson $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 542bf11819SPaul Mackerras 552f0dfeaaSDavid Gibsonsrc-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 56143580ecSKumar Galasrc-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ 572f0dfeaaSDavid Gibson $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ 58ad9d2716SDavid Gibson ns16550.c serial.c simple_alloc.c div64.S util.S \ 592e601613SDavid Gibson gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 60d0f53fafSScott Wood 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ 61bbc6fac3SScott Wood cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \ 62bbc6fac3SScott Wood fsl-soc.c mpc8xx.c pq2.c 633490cba5SJon Loeligersrc-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \ 64bafdb645SGeoff Levand cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ 65606d08bcSValentine Barshak ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ 6625431333SGrant Likely cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \ 6725431333SGrant Likely cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ 68c6ec08e0SRemi Machet fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \ 691e12f3c5SSean MacLennan cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ 70d2477b5cSGrant Likely cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ 71b6014e15SGiuseppe Coviello virtex405-head.S redboot-83xx.c cuboot-sam440ep.c 72cd197ffcSDavid Gibsonsrc-boot := $(src-wlib) $(src-plat) empty.c 732bf11819SPaul Mackerras 742bf11819SPaul Mackerrassrc-boot := $(addprefix $(obj)/, $(src-boot)) 752bf11819SPaul Mackerrasobj-boot := $(addsuffix .o, $(basename $(src-boot))) 762bf11819SPaul Mackerrasobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 772bf11819SPaul Mackerrasobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 782bf11819SPaul Mackerras 7994b212c2SPaul Mackerrasquiet_cmd_copy_zlib = COPY $@ 803ff6eeccSAdrian Bunk cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8194b212c2SPaul Mackerras 8294b212c2SPaul Mackerrasquiet_cmd_copy_zlibheader = COPY $@ 8367ccd2fcSSegher Boessenkool cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8494b212c2SPaul Mackerras# stddef.h for NULL 8594b212c2SPaul Mackerrasquiet_cmd_copy_zliblinuxheader = COPY $@ 8667ccd2fcSSegher Boessenkool cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8794b212c2SPaul Mackerras 8894b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 8994b212c2SPaul Mackerras $(call cmd,copy_zlib) 9094b212c2SPaul Mackerras 9194b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 9294b212c2SPaul Mackerras $(call cmd,copy_zlibheader) 9394b212c2SPaul Mackerras 9494b212c2SPaul Mackerras$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% 9594b212c2SPaul Mackerras $(call cmd,copy_zliblinuxheader) 9694b212c2SPaul Mackerras 972bf11819SPaul Mackerras$(obj)/empty.c: 982bf11819SPaul Mackerras @touch $@ 9994b212c2SPaul Mackerras 100bafdb645SGeoff Levand$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S 1012bf11819SPaul Mackerras @cp $< $@ 1022bf11819SPaul Mackerras 1032bf11819SPaul Mackerrasclean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ 104b58a4575SKumar Gala empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 10594b212c2SPaul Mackerras 10694b212c2SPaul Mackerrasquiet_cmd_bootcc = BOOTCC $@ 10794b212c2SPaul Mackerras cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 10894b212c2SPaul Mackerras 10994b212c2SPaul Mackerrasquiet_cmd_bootas = BOOTAS $@ 11094b212c2SPaul Mackerras cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 11194b212c2SPaul Mackerras 1122bf11819SPaul Mackerrasquiet_cmd_bootar = BOOTAR $@ 113235fd835SMilton Miller cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ 11494b212c2SPaul Mackerras 115235fd835SMilton Miller$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE 1162f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 11794b212c2SPaul Mackerras $(call if_changed_dep,bootcc) 118235fd835SMilton Miller$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE 1192f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 12094b212c2SPaul Mackerras $(call if_changed_dep,bootas) 12194b212c2SPaul Mackerras 122235fd835SMilton Miller$(obj)/wrapper.a: $(obj-wlib) FORCE 123235fd835SMilton Miller $(call if_changed,bootar) 12494b212c2SPaul Mackerras 125e2dc87a1SDavid Gibsonhostprogs-y := addnote addRamDisk hack-coff mktree dtc 12666a45dd3SPaul Mackerras 127235fd835SMilton Millertargets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) 128cd197ffcSDavid Gibsonextra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 129bafdb645SGeoff Levand $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds 13094b212c2SPaul Mackerras 13125431333SGrant Likelydtstree := $(srctree)/$(src)/dts 13225431333SGrant Likely 1332bf11819SPaul Mackerraswrapper :=$(srctree)/$(src)/wrapper 134e2dc87a1SDavid Gibsonwrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ 135235fd835SMilton Miller $(wrapper) FORCE 13694b212c2SPaul Mackerras 1372bf11819SPaul Mackerras############# 138e2dc87a1SDavid Gibson# Bits for building dtc 139e2dc87a1SDavid Gibson# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output 140e2dc87a1SDavid Gibson 141e2dc87a1SDavid Gibsondtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o 142e2dc87a1SDavid Gibsondtc-objs += dtc-lexer.lex.o dtc-parser.tab.o 143e2dc87a1SDavid Gibsondtc-objs := $(addprefix dtc-src/, $(dtc-objs)) 144e2dc87a1SDavid Gibson 145e2dc87a1SDavid Gibson# prerequisites on generated files needs to be explicit 146e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h 147e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h 148e2dc87a1SDavid Gibson 149e2dc87a1SDavid GibsonHOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/ 150e2dc87a1SDavid Gibson 151e2dc87a1SDavid Gibsontargets += dtc-src/dtc-parser.tab.c 152e2dc87a1SDavid Gibsontargets += dtc-src/dtc-lexer.lex.c 153e2dc87a1SDavid Gibson 154e4ccde02SKumar Galaclean-files += dtc-src/dtc-parser.tab.h 155e4ccde02SKumar Gala 156e2dc87a1SDavid Gibsonifdef DTC_GENPARSER 157e2dc87a1SDavid GibsonBISON = bison 158e2dc87a1SDavid GibsonFLEX = flex 159e2dc87a1SDavid Gibson 160e2dc87a1SDavid Gibsonquiet_cmd_bison = BISON $@ 161e2dc87a1SDavid Gibson cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped 162e2dc87a1SDavid Gibsonquiet_cmd_flex = FLEX $@ 163e2dc87a1SDavid Gibson cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped 164e2dc87a1SDavid Gibson 165e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE 166e2dc87a1SDavid Gibson $(call if_changed,bison) 167e2dc87a1SDavid Gibson 168e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c 169e2dc87a1SDavid Gibson 170e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE 171e2dc87a1SDavid Gibson $(call if_changed,flex) 172e2dc87a1SDavid Gibsonendif 173e2dc87a1SDavid Gibson 174e2dc87a1SDavid Gibson############# 1752bf11819SPaul Mackerras# Bits for building various flavours of zImage 17694b212c2SPaul Mackerras 1772bf11819SPaul Mackerrasifneq ($(CROSS32_COMPILE),) 178dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS32_COMPILE)" 1792bf11819SPaul Mackerraselse 1802bf11819SPaul Mackerrasifneq ($(CROSS_COMPILE),) 181dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS_COMPILE)" 1822bf11819SPaul Mackerrasendif 1832bf11819SPaul Mackerrasendif 18494b212c2SPaul Mackerras 1859da82a6dSMilton Miller# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd 1862bf11819SPaul Mackerrasquiet_cmd_wrap = WRAP $@ 1879da82a6dSMilton Miller cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ 1889da82a6dSMilton Miller $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux 1892bf11819SPaul Mackerras 1902bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PSERIES) += zImage.pseries 1912bf11819SPaul Mackerrasimage-$(CONFIG_PPC_MAPLE) += zImage.pseries 192020533efSGeoff Levandimage-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries 193595be948SGrant Likelyimage-$(CONFIG_PPC_PS3) += dtbImage.ps3 194c347b798SIshizaki Kouimage-$(CONFIG_PPC_CELLEB) += zImage.pseries 1952bf11819SPaul Mackerrasimage-$(CONFIG_PPC_CHRP) += zImage.chrp 1967839af33SNicolas DETimage-$(CONFIG_PPC_EFIKA) += zImage.chrp 1972bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.pmac 198b0e80206SMark A. Greerimage-$(CONFIG_PPC_HOLLY) += zImage.holly 199a7e695f6SDale Farnsworthimage-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 2000570d4edSStephen Rothwellimage-$(CONFIG_PPC_ISERIES) += zImage.iseries 201ac18c673SScott Woodimage-$(CONFIG_DEFAULT_UIMAGE) += uImage 202ac18c673SScott Wood 20325431333SGrant Likely# 20425431333SGrant Likely# Targets which embed a device tree blob 20525431333SGrant Likely# 20625431333SGrant Likely# Theses are default targets to build images which embed device tree blobs. 20725431333SGrant Likely# They are only required on boards which do not have FDT support in firmware. 20825431333SGrant Likely# Boards with newish u-boot firmare can use the uImage target above 20925431333SGrant Likely# 21025431333SGrant Likely 21125431333SGrant Likely# Board ports in arch/powerpc/platform/40x/Kconfig 212595be948SGrant Likelyimage-$(CONFIG_EP405) += dtbImage.ep405 21325431333SGrant Likelyimage-$(CONFIG_WALNUT) += treeImage.walnut 21425431333SGrant Likely 21525431333SGrant Likely# Board ports in arch/powerpc/platform/44x/Kconfig 216f6dfc805SDavid Gibsonimage-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 217658e8170SJosh Boyerimage-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo 218b6014e15SGiuseppe Covielloimage-$(CONFIG_SAM440EP) += cuImage.sam440ep 219606d08bcSValentine Barshakimage-$(CONFIG_SEQUOIA) += cuImage.sequoia 220295e7427SValentine Barshakimage-$(CONFIG_RAINIER) += cuImage.rainier 2216bbc5476SHugh Blemingsimage-$(CONFIG_TAISHAN) += cuImage.taishan 2223de9c9cdSBenjamin Herrenschmidtimage-$(CONFIG_KATMAI) += cuImage.katmai 2231e12f3c5SSean MacLennanimage-$(CONFIG_WARP) += cuImage.warp 224d0a48c9fSJosh Boyerimage-$(CONFIG_YOSEMITE) += cuImage.yosemite 22594b212c2SPaul Mackerras 22625431333SGrant Likely# Board ports in arch/powerpc/platform/8xx/Kconfig 227efa58fbfSAdrian Bunkimage-$(CONFIG_MPC86XADS) += cuImage.mpc866ads 228efa58fbfSAdrian Bunkimage-$(CONFIG_MPC885ADS) += cuImage.mpc885ads 229595be948SGrant Likelyimage-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc 23025431333SGrant Likelyimage-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \ 231595be948SGrant Likely dtbImage.adder875-redboot 23225431333SGrant Likely 23325431333SGrant Likely# Board ports in arch/powerpc/platform/52xx/Kconfig 23425431333SGrant Likelyimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 cuImage.lite5200b 23525431333SGrant Likely 23625431333SGrant Likely# Board ports in arch/powerpc/platform/82xx/Kconfig 23725431333SGrant Likelyimage-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads 23825431333SGrant Likelyimage-$(CONFIG_PQ2FADS) += cuImage.pq2fads 239595be948SGrant Likelyimage-$(CONFIG_EP8248E) += dtbImage.ep8248e 24025431333SGrant Likely 24125431333SGrant Likely# Board ports in arch/powerpc/platform/83xx/Kconfig 24225431333SGrant Likelyimage-$(CONFIG_MPC832x_MDS) += cuImage.mpc832x_mds 24325431333SGrant Likelyimage-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb 24425431333SGrant Likelyimage-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \ 24525431333SGrant Likely cuImage.mpc8349emitxgp 24625431333SGrant Likelyimage-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds 24725431333SGrant Likelyimage-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds 24859d13f9dSBryan O'Donoghueimage-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot 24925431333SGrant Likely 25025431333SGrant Likely# Board ports in arch/powerpc/platform/85xx/Kconfig 25125431333SGrant Likelyimage-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads 25225431333SGrant Likelyimage-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads 25325431333SGrant Likelyimage-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ 25425431333SGrant Likely cuImage.mpc8548cds \ 25525431333SGrant Likely cuImage.mpc8555cds 25625431333SGrant Likelyimage-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 25725431333SGrant Likelyimage-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 25825431333SGrant Likely cuImage.mpc8572ds 25925431333SGrant Likelyimage-$(CONFIG_TQM8540) += cuImage.tqm8540 26025431333SGrant Likelyimage-$(CONFIG_TQM8541) += cuImage.tqm8541 2616dd1b64aSWolfgang Grandeggerimage-$(CONFIG_TQM8548) += cuImage.tqm8548 26225431333SGrant Likelyimage-$(CONFIG_TQM8555) += cuImage.tqm8555 26325431333SGrant Likelyimage-$(CONFIG_TQM8560) += cuImage.tqm8560 264a72a6f53SPaul Gortmakerimage-$(CONFIG_SBC8548) += cuImage.sbc8548 265a72a6f53SPaul Gortmakerimage-$(CONFIG_SBC8560) += cuImage.sbc8560 266ff880112SAlexandr Smirnovimage-$(CONFIG_KSI8560) += cuImage.ksi8560 26725431333SGrant Likely 26825431333SGrant Likely# Board ports in arch/powerpc/platform/embedded6xx/Kconfig 26925431333SGrant Likelyimage-$(CONFIG_STORCENTER) += cuImage.storcenter 27025431333SGrant Likelyimage-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2 271c6ec08e0SRemi Machetimage-$(CONFIG_PPC_C2K) += cuImage.c2k 272b09c1644SScott Wood 2739216ad8cSPaul Mackerras# For 32-bit powermacs, build the COFF and miboot images 2749216ad8cSPaul Mackerras# as well as the ELF images. 2752bf11819SPaul Mackerrasifeq ($(CONFIG_PPC32),y) 2762bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot 2772bf11819SPaul Mackerrasendif 27866a45dd3SPaul Mackerras 2795d7960ffSMilton Millerinitrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-)) 280f6dfc805SDavid Gibsoninitrd-y := $(patsubst zImage%, zImage.initrd%, \ 281595be948SGrant Likely $(patsubst dtbImage%, dtbImage.initrd%, \ 282595be948SGrant Likely $(patsubst treeImage%, treeImage.initrd%, $(image-y)))) 2839da82a6dSMilton Millerinitrd-y := $(filter-out $(image-y), $(initrd-y)) 284235fd835SMilton Millertargets += $(image-y) $(initrd-y) 28594b212c2SPaul Mackerras 2869da82a6dSMilton Miller$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz 2879da82a6dSMilton Miller 2889da82a6dSMilton Miller# Don't put the ramdisk on the pattern rule; when its missing make will try 2899da82a6dSMilton Miller# the pattern rule with less dependencies that also matches (even with the 2909da82a6dSMilton Miller# hard dependency listed). 29125431333SGrant Likely$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) 29225431333SGrant Likely $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) 2939da82a6dSMilton Miller 29425431333SGrant Likely$(obj)/zImage.%: vmlinux $(wrapperbits) 29525431333SGrant Likely $(call if_changed,wrap,$*) 29625431333SGrant Likely 297595be948SGrant Likely# dtbImage% - a dtbImage is a zImage with an embedded device tree blob 298e04018e8SGrant Likely$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb 299e04018e8SGrant Likely $(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 30025431333SGrant Likely 301e04018e8SGrant Likely$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb 302e04018e8SGrant Likely $(call if_changed,wrap,$*,,$(obj)/$*.dtb) 3039da82a6dSMilton Miller 3044bb09281STony Breeds# This cannot be in the root of $(src) as the zImage rule always adds a $(obj) 3054bb09281STony Breeds# prefix 3064bb09281STony Breeds$(obj)/vmlinux.strip: vmlinux 3074bb09281STony Breeds $(STRIP) -s -R .comment $< -o $@ 3084bb09281STony Breeds 3090570d4edSStephen Rothwell$(obj)/zImage.iseries: vmlinux 3100570d4edSStephen Rothwell $(STRIP) -s -R .comment $< -o $@ 3110570d4edSStephen Rothwell 3129da82a6dSMilton Miller$(obj)/uImage: vmlinux $(wrapperbits) 3139da82a6dSMilton Miller $(call if_changed,wrap,uboot) 3149da82a6dSMilton Miller 315e04018e8SGrant Likely$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 316e04018e8SGrant Likely $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb) 3170fdd717eSScott Wood 318d2477b5cSGrant Likely$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 319d2477b5cSGrant Likely $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 320d2477b5cSGrant Likely 321d2477b5cSGrant Likely$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 322d2477b5cSGrant Likely $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb) 323d2477b5cSGrant Likely 324e04018e8SGrant Likely$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) 325e04018e8SGrant Likely $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 326f6dfc805SDavid Gibson 327e04018e8SGrant Likely$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 328e04018e8SGrant Likely $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) 329e04018e8SGrant Likely 330e04018e8SGrant Likely# Rule to build device tree blobs 331e04018e8SGrant Likely$(obj)/%.dtb: $(dtstree)/%.dts $(obj)/dtc 332e04018e8SGrant Likely $(obj)/dtc -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts 3336a32d085SDavid Gibson 3344bb09281STony Breeds# If there isn't a platform selected then just strip the vmlinux. 3354bb09281STony Breedsifeq (,$(image-y)) 3364bb09281STony Breedsimage-y := vmlinux.strip 3374bb09281STony Breedsendif 3384bb09281STony Breeds 3392bf11819SPaul Mackerras$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 3402bf11819SPaul Mackerras @rm -f $@; ln $< $@ 3412bf11819SPaul Mackerras$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) 3422bf11819SPaul Mackerras @rm -f $@; ln $< $@ 34394b212c2SPaul Mackerras 344928370c6SAkinobu Mitainstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) 3452bf11819SPaul Mackerras sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< 34666a45dd3SPaul Mackerras 3471383a34fSMilton Miller# anything not in $(targets) 348b58a4575SKumar Galaclean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \ 349b58a4575SKumar Gala zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ 350b58a4575SKumar Gala zImage.iseries zImage.miboot zImage.pmac zImage.pseries \ 351e04018e8SGrant Likely otheros.bld *.dtb 3521383a34fSMilton Miller 3531383a34fSMilton Miller# clean up files cached by wrapper 3541383a34fSMilton Millerclean-kernel := vmlinux.strip vmlinux.bin 3551383a34fSMilton Millerclean-kernel += $(addsuffix .gz,$(clean-kernel)) 3561383a34fSMilton Miller# If not absolute clean-files are relative to $(obj). 3571383a34fSMilton Millerclean-files += $(addprefix $(objtree)/, $(clean-kernel)) 358773f76b1SDavid Woodhouse 359773f76b1SDavid WoodhouseWRAPPER_OBJDIR := /usr/lib/kernel-wrapper 360773f76b1SDavid WoodhouseWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts 361773f76b1SDavid WoodhouseWRAPPER_BINDIR := /usr/sbin 362773f76b1SDavid WoodhouseINSTALL := install 363773f76b1SDavid Woodhouse 364773f76b1SDavid Woodhouseextra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) 365773f76b1SDavid Woodhousehostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y)) 366773f76b1SDavid Woodhousewrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper 367773f76b1SDavid Woodhousedts-installed := $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts)) 368773f76b1SDavid Woodhouse 369773f76b1SDavid Woodhouseall-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) 370773f76b1SDavid Woodhouse 371773f76b1SDavid Woodhousequiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 372773f76b1SDavid Woodhouse cmd_mkdir = mkdir -p $@ 373773f76b1SDavid Woodhouse 374773f76b1SDavid Woodhousequiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@) 375773f76b1SDavid Woodhouse cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ 376773f76b1SDavid Woodhouse 377773f76b1SDavid Woodhousequiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@) 378773f76b1SDavid Woodhouse cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ 379773f76b1SDavid Woodhouse 380773f76b1SDavid Woodhousequiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 381773f76b1SDavid Woodhouse cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ 382773f76b1SDavid Woodhouse 383773f76b1SDavid Woodhousequiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 384773f76b1SDavid Woodhouse cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\ 385773f76b1SDavid Woodhouse sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \ 386773f76b1SDavid Woodhouse -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \ 387773f76b1SDavid Woodhouse 388773f76b1SDavid Woodhouse 389773f76b1SDavid Woodhouse$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR): 390773f76b1SDavid Woodhouse $(call cmd,mkdir) 391773f76b1SDavid Woodhouse 392773f76b1SDavid Woodhouse$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR) 393773f76b1SDavid Woodhouse $(call cmd,install) 394773f76b1SDavid Woodhouse 395773f76b1SDavid Woodhouse$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR) 396773f76b1SDavid Woodhouse $(call cmd,install_exe) 397773f76b1SDavid Woodhouse 398773f76b1SDavid Woodhouse$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR) 399773f76b1SDavid Woodhouse $(call cmd,install_dts) 400773f76b1SDavid Woodhouse 401773f76b1SDavid Woodhouse$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR) 402773f76b1SDavid Woodhouse $(call cmd,install_wrapper) 403773f76b1SDavid Woodhouse 404773f76b1SDavid Woodhouse$(obj)/bootwrapper_install: $(all-installed) 405773f76b1SDavid Woodhouse 406