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 38bf2e70acSJosh Boyer$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 39bf2e70acSJosh Boyer$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 40bf2e70acSJosh Boyer$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 41bf2e70acSJosh Boyer$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 422e71cc0dSJosh Boyer$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 4360e41753SJosh Boyer 446bbc5476SHugh Blemings 452bf11819SPaul Mackerraszlib := inffast.c inflate.c inftrees.c 462bf11819SPaul Mackerraszlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h 472bf11819SPaul Mackerraszliblinuxheader := zlib.h zconf.h zutil.h 482bf11819SPaul Mackerras 49d25a9d66SDavid Gibson$(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ 50d25a9d66SDavid Gibson $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 512bf11819SPaul Mackerras 522f0dfeaaSDavid Gibsonsrc-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 53430b01e8SDavid Gibsonsrc-wlib := string.S crt0.S stdio.c main.c \ 542f0dfeaaSDavid Gibson $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ 55ad9d2716SDavid Gibson ns16550.c serial.c simple_alloc.c div64.S util.S \ 562e601613SDavid Gibson gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 57d0f53fafSScott Wood 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ 58bbc6fac3SScott Wood cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \ 59bbc6fac3SScott Wood fsl-soc.c mpc8xx.c pq2.c 603490cba5SJon Loeligersrc-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \ 61bafdb645SGeoff Levand cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ 62606d08bcSValentine Barshak ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ 6325431333SGrant Likely cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \ 6425431333SGrant Likely cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ 6525431333SGrant Likely fixed-head.S ep88xc.c ep405.c \ 661e12f3c5SSean MacLennan cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ 67*d0a48c9fSJosh Boyer cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c 68cd197ffcSDavid Gibsonsrc-boot := $(src-wlib) $(src-plat) empty.c 692bf11819SPaul Mackerras 702bf11819SPaul Mackerrassrc-boot := $(addprefix $(obj)/, $(src-boot)) 712bf11819SPaul Mackerrasobj-boot := $(addsuffix .o, $(basename $(src-boot))) 722bf11819SPaul Mackerrasobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 732bf11819SPaul Mackerrasobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 742bf11819SPaul Mackerras 7594b212c2SPaul Mackerrasquiet_cmd_copy_zlib = COPY $@ 763ff6eeccSAdrian Bunk cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 7794b212c2SPaul Mackerras 7894b212c2SPaul Mackerrasquiet_cmd_copy_zlibheader = COPY $@ 7967ccd2fcSSegher Boessenkool cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8094b212c2SPaul Mackerras# stddef.h for NULL 8194b212c2SPaul Mackerrasquiet_cmd_copy_zliblinuxheader = COPY $@ 8267ccd2fcSSegher Boessenkool cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 8394b212c2SPaul Mackerras 8494b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 8594b212c2SPaul Mackerras $(call cmd,copy_zlib) 8694b212c2SPaul Mackerras 8794b212c2SPaul Mackerras$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 8894b212c2SPaul Mackerras $(call cmd,copy_zlibheader) 8994b212c2SPaul Mackerras 9094b212c2SPaul Mackerras$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% 9194b212c2SPaul Mackerras $(call cmd,copy_zliblinuxheader) 9294b212c2SPaul Mackerras 932bf11819SPaul Mackerras$(obj)/empty.c: 942bf11819SPaul Mackerras @touch $@ 9594b212c2SPaul Mackerras 96bafdb645SGeoff Levand$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srctree)/$(src)/%.S 972bf11819SPaul Mackerras @cp $< $@ 982bf11819SPaul Mackerras 992bf11819SPaul Mackerrasclean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ 100bafdb645SGeoff Levand empty.c zImage zImage.coff.lds zImage.ps3.lds zImage.lds 10194b212c2SPaul Mackerras 10294b212c2SPaul Mackerrasquiet_cmd_bootcc = BOOTCC $@ 10394b212c2SPaul Mackerras cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 10494b212c2SPaul Mackerras 10594b212c2SPaul Mackerrasquiet_cmd_bootas = BOOTAS $@ 10694b212c2SPaul Mackerras cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 10794b212c2SPaul Mackerras 1082bf11819SPaul Mackerrasquiet_cmd_bootar = BOOTAR $@ 109235fd835SMilton Miller cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ 11094b212c2SPaul Mackerras 111235fd835SMilton Miller$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE 1122f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 11394b212c2SPaul Mackerras $(call if_changed_dep,bootcc) 114235fd835SMilton Miller$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE 1152f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 11694b212c2SPaul Mackerras $(call if_changed_dep,bootas) 11794b212c2SPaul Mackerras 118235fd835SMilton Miller$(obj)/wrapper.a: $(obj-wlib) FORCE 119235fd835SMilton Miller $(call if_changed,bootar) 12094b212c2SPaul Mackerras 121e2dc87a1SDavid Gibsonhostprogs-y := addnote addRamDisk hack-coff mktree dtc 12266a45dd3SPaul Mackerras 123235fd835SMilton Millertargets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) 124cd197ffcSDavid Gibsonextra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 125bafdb645SGeoff Levand $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds 12694b212c2SPaul Mackerras 12725431333SGrant Likelydtstree := $(srctree)/$(src)/dts 12825431333SGrant Likely 1292bf11819SPaul Mackerraswrapper :=$(srctree)/$(src)/wrapper 130e2dc87a1SDavid Gibsonwrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ 131235fd835SMilton Miller $(wrapper) FORCE 13294b212c2SPaul Mackerras 1332bf11819SPaul Mackerras############# 134e2dc87a1SDavid Gibson# Bits for building dtc 135e2dc87a1SDavid Gibson# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output 136e2dc87a1SDavid Gibson 137e2dc87a1SDavid Gibsondtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o 138e2dc87a1SDavid Gibsondtc-objs += dtc-lexer.lex.o dtc-parser.tab.o 139e2dc87a1SDavid Gibsondtc-objs := $(addprefix dtc-src/, $(dtc-objs)) 140e2dc87a1SDavid Gibson 141e2dc87a1SDavid Gibson# prerequisites on generated files needs to be explicit 142e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h 143e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h 144e2dc87a1SDavid Gibson 145e2dc87a1SDavid GibsonHOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/ 146e2dc87a1SDavid Gibson 147e2dc87a1SDavid Gibsontargets += dtc-src/dtc-parser.tab.c 148e2dc87a1SDavid Gibsontargets += dtc-src/dtc-lexer.lex.c 149e2dc87a1SDavid Gibson 150e4ccde02SKumar Galaclean-files += dtc-src/dtc-parser.tab.h 151e4ccde02SKumar Gala 152e2dc87a1SDavid Gibsonifdef DTC_GENPARSER 153e2dc87a1SDavid GibsonBISON = bison 154e2dc87a1SDavid GibsonFLEX = flex 155e2dc87a1SDavid Gibson 156e2dc87a1SDavid Gibsonquiet_cmd_bison = BISON $@ 157e2dc87a1SDavid Gibson cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped 158e2dc87a1SDavid Gibsonquiet_cmd_flex = FLEX $@ 159e2dc87a1SDavid Gibson cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped 160e2dc87a1SDavid Gibson 161e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE 162e2dc87a1SDavid Gibson $(call if_changed,bison) 163e2dc87a1SDavid Gibson 164e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c 165e2dc87a1SDavid Gibson 166e2dc87a1SDavid Gibson$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE 167e2dc87a1SDavid Gibson $(call if_changed,flex) 168e2dc87a1SDavid Gibsonendif 169e2dc87a1SDavid Gibson 170e2dc87a1SDavid Gibson############# 1712bf11819SPaul Mackerras# Bits for building various flavours of zImage 17294b212c2SPaul Mackerras 1732bf11819SPaul Mackerrasifneq ($(CROSS32_COMPILE),) 174dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS32_COMPILE)" 1752bf11819SPaul Mackerraselse 1762bf11819SPaul Mackerrasifneq ($(CROSS_COMPILE),) 177dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS_COMPILE)" 1782bf11819SPaul Mackerrasendif 1792bf11819SPaul Mackerrasendif 18094b212c2SPaul Mackerras 1819da82a6dSMilton Miller# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd 1822bf11819SPaul Mackerrasquiet_cmd_wrap = WRAP $@ 1839da82a6dSMilton Miller cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ 1849da82a6dSMilton Miller $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux 1852bf11819SPaul Mackerras 1862bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PSERIES) += zImage.pseries 1872bf11819SPaul Mackerrasimage-$(CONFIG_PPC_MAPLE) += zImage.pseries 188020533efSGeoff Levandimage-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries 189595be948SGrant Likelyimage-$(CONFIG_PPC_PS3) += dtbImage.ps3 190c347b798SIshizaki Kouimage-$(CONFIG_PPC_CELLEB) += zImage.pseries 1912bf11819SPaul Mackerrasimage-$(CONFIG_PPC_CHRP) += zImage.chrp 1927839af33SNicolas DETimage-$(CONFIG_PPC_EFIKA) += zImage.chrp 1932bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.pmac 194b0e80206SMark A. Greerimage-$(CONFIG_PPC_HOLLY) += zImage.holly 195c368d921SMark A. Greerimage-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800 1960570d4edSStephen Rothwellimage-$(CONFIG_PPC_ISERIES) += zImage.iseries 197ac18c673SScott Woodimage-$(CONFIG_DEFAULT_UIMAGE) += uImage 198ac18c673SScott Wood 19925431333SGrant Likely# 20025431333SGrant Likely# Targets which embed a device tree blob 20125431333SGrant Likely# 20225431333SGrant Likely# Theses are default targets to build images which embed device tree blobs. 20325431333SGrant Likely# They are only required on boards which do not have FDT support in firmware. 20425431333SGrant Likely# Boards with newish u-boot firmare can use the uImage target above 20525431333SGrant Likely# 20625431333SGrant Likely 20725431333SGrant Likely# Board ports in arch/powerpc/platform/40x/Kconfig 208595be948SGrant Likelyimage-$(CONFIG_EP405) += dtbImage.ep405 20925431333SGrant Likelyimage-$(CONFIG_WALNUT) += treeImage.walnut 21025431333SGrant Likely 21125431333SGrant Likely# Board ports in arch/powerpc/platform/44x/Kconfig 212f6dfc805SDavid Gibsonimage-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 213658e8170SJosh Boyerimage-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo 214606d08bcSValentine Barshakimage-$(CONFIG_SEQUOIA) += cuImage.sequoia 215295e7427SValentine Barshakimage-$(CONFIG_RAINIER) += cuImage.rainier 2166bbc5476SHugh Blemingsimage-$(CONFIG_TAISHAN) += cuImage.taishan 2173de9c9cdSBenjamin Herrenschmidtimage-$(CONFIG_KATMAI) += cuImage.katmai 2181e12f3c5SSean MacLennanimage-$(CONFIG_WARP) += cuImage.warp 219*d0a48c9fSJosh Boyerimage-$(CONFIG_YOSEMITE) += cuImage.yosemite 22094b212c2SPaul Mackerras 22125431333SGrant Likely# Board ports in arch/powerpc/platform/8xx/Kconfig 22225431333SGrant Likelyimage-$(CONFIG_PPC_MPC86XADS) += cuImage.mpc866ads 22325431333SGrant Likelyimage-$(CONFIG_PPC_MPC885ADS) += cuImage.mpc885ads 224595be948SGrant Likelyimage-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc 22525431333SGrant Likelyimage-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \ 226595be948SGrant Likely dtbImage.adder875-redboot 22725431333SGrant Likely 22825431333SGrant Likely# Board ports in arch/powerpc/platform/52xx/Kconfig 22925431333SGrant Likelyimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 cuImage.lite5200b 23025431333SGrant Likely 23125431333SGrant Likely# Board ports in arch/powerpc/platform/82xx/Kconfig 23225431333SGrant Likelyimage-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads 23325431333SGrant Likelyimage-$(CONFIG_PQ2FADS) += cuImage.pq2fads 234595be948SGrant Likelyimage-$(CONFIG_EP8248E) += dtbImage.ep8248e 23525431333SGrant Likely 23625431333SGrant Likely# Board ports in arch/powerpc/platform/83xx/Kconfig 23725431333SGrant Likelyimage-$(CONFIG_MPC832x_MDS) += cuImage.mpc832x_mds 23825431333SGrant Likelyimage-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb 23925431333SGrant Likelyimage-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \ 24025431333SGrant Likely cuImage.mpc8349emitxgp 24125431333SGrant Likelyimage-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds 24225431333SGrant Likelyimage-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds 24325431333SGrant Likely 24425431333SGrant Likely# Board ports in arch/powerpc/platform/85xx/Kconfig 24525431333SGrant Likelyimage-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads 24625431333SGrant Likelyimage-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads 24725431333SGrant Likelyimage-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ 24825431333SGrant Likely cuImage.mpc8548cds \ 24925431333SGrant Likely cuImage.mpc8555cds 25025431333SGrant Likelyimage-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 25125431333SGrant Likelyimage-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 25225431333SGrant Likely cuImage.mpc8572ds 25325431333SGrant Likelyimage-$(CONFIG_TQM8540) += cuImage.tqm8540 25425431333SGrant Likelyimage-$(CONFIG_TQM8541) += cuImage.tqm8541 25525431333SGrant Likelyimage-$(CONFIG_TQM8555) += cuImage.tqm8555 25625431333SGrant Likelyimage-$(CONFIG_TQM8560) += cuImage.tqm8560 257a72a6f53SPaul Gortmakerimage-$(CONFIG_SBC8548) += cuImage.sbc8548 258a72a6f53SPaul Gortmakerimage-$(CONFIG_SBC8560) += cuImage.sbc8560 25925431333SGrant Likely 26025431333SGrant Likely# Board ports in arch/powerpc/platform/embedded6xx/Kconfig 26125431333SGrant Likelyimage-$(CONFIG_STORCENTER) += cuImage.storcenter 26225431333SGrant Likelyimage-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2 263b09c1644SScott Wood 2649216ad8cSPaul Mackerras# For 32-bit powermacs, build the COFF and miboot images 2659216ad8cSPaul Mackerras# as well as the ELF images. 2662bf11819SPaul Mackerrasifeq ($(CONFIG_PPC32),y) 2672bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot 2682bf11819SPaul Mackerrasendif 26966a45dd3SPaul Mackerras 2705d7960ffSMilton Millerinitrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-)) 271f6dfc805SDavid Gibsoninitrd-y := $(patsubst zImage%, zImage.initrd%, \ 272595be948SGrant Likely $(patsubst dtbImage%, dtbImage.initrd%, \ 273595be948SGrant Likely $(patsubst treeImage%, treeImage.initrd%, $(image-y)))) 2749da82a6dSMilton Millerinitrd-y := $(filter-out $(image-y), $(initrd-y)) 275235fd835SMilton Millertargets += $(image-y) $(initrd-y) 27694b212c2SPaul Mackerras 2779da82a6dSMilton Miller$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz 2789da82a6dSMilton Miller 2799da82a6dSMilton Miller# Don't put the ramdisk on the pattern rule; when its missing make will try 2809da82a6dSMilton Miller# the pattern rule with less dependencies that also matches (even with the 2819da82a6dSMilton Miller# hard dependency listed). 28225431333SGrant Likely$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) 28325431333SGrant Likely $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) 2849da82a6dSMilton Miller 28525431333SGrant Likely$(obj)/zImage.%: vmlinux $(wrapperbits) 28625431333SGrant Likely $(call if_changed,wrap,$*) 28725431333SGrant Likely 288595be948SGrant Likely# dtbImage% - a dtbImage is a zImage with an embedded device tree blob 289595be948SGrant Likely$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(dtstree)/%.dts 29025431333SGrant Likely $(call if_changed,wrap,$*,$(dtstree)/$*.dts,,$(obj)/ramdisk.image.gz) 29125431333SGrant Likely 292595be948SGrant Likely$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(dtstree)/%.dts 29325431333SGrant Likely $(call if_changed,wrap,$*,$(dtstree)/$*.dts) 2949da82a6dSMilton Miller 2954bb09281STony Breeds# This cannot be in the root of $(src) as the zImage rule always adds a $(obj) 2964bb09281STony Breeds# prefix 2974bb09281STony Breeds$(obj)/vmlinux.strip: vmlinux 2984bb09281STony Breeds $(STRIP) -s -R .comment $< -o $@ 2994bb09281STony Breeds 3000570d4edSStephen Rothwell$(obj)/zImage.iseries: vmlinux 3010570d4edSStephen Rothwell $(STRIP) -s -R .comment $< -o $@ 3020570d4edSStephen Rothwell 3039da82a6dSMilton Miller$(obj)/uImage: vmlinux $(wrapperbits) 3049da82a6dSMilton Miller $(call if_changed,wrap,uboot) 3059da82a6dSMilton Miller 30625431333SGrant Likely$(obj)/cuImage.%: vmlinux $(dtstree)/%.dts $(wrapperbits) 30725431333SGrant Likely $(call if_changed,wrap,cuboot-$*,$(dtstree)/$*.dts) 3080fdd717eSScott Wood 30925431333SGrant Likely$(obj)/treeImage.initrd.%: vmlinux $(dtstree)/%.dts $(wrapperbits) 31025431333SGrant Likely $(call if_changed,wrap,treeboot-$*,$(dtstree)/$*.dts,,$(obj)/ramdisk.image.gz) 311f6dfc805SDavid Gibson 31225431333SGrant Likely$(obj)/treeImage.%: vmlinux $(dtstree)/%.dts $(wrapperbits) 31325431333SGrant Likely $(call if_changed,wrap,treeboot-$*,$(dtstree)/$*.dts) 3146a32d085SDavid Gibson 3154bb09281STony Breeds# If there isn't a platform selected then just strip the vmlinux. 3164bb09281STony Breedsifeq (,$(image-y)) 3174bb09281STony Breedsimage-y := vmlinux.strip 3184bb09281STony Breedsendif 3194bb09281STony Breeds 3202bf11819SPaul Mackerras$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 3212bf11819SPaul Mackerras @rm -f $@; ln $< $@ 3222bf11819SPaul Mackerras$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) 3232bf11819SPaul Mackerras @rm -f $@; ln $< $@ 32494b212c2SPaul Mackerras 325928370c6SAkinobu Mitainstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) 3262bf11819SPaul Mackerras sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< 32766a45dd3SPaul Mackerras 3281383a34fSMilton Miller# anything not in $(targets) 329bafdb645SGeoff Levandclean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* \ 330bafdb645SGeoff Levand otheros.bld 3311383a34fSMilton Miller 3321383a34fSMilton Miller# clean up files cached by wrapper 3331383a34fSMilton Millerclean-kernel := vmlinux.strip vmlinux.bin 3341383a34fSMilton Millerclean-kernel += $(addsuffix .gz,$(clean-kernel)) 3351383a34fSMilton Miller# If not absolute clean-files are relative to $(obj). 3361383a34fSMilton Millerclean-files += $(addprefix $(objtree)/, $(clean-kernel)) 337773f76b1SDavid Woodhouse 338773f76b1SDavid WoodhouseWRAPPER_OBJDIR := /usr/lib/kernel-wrapper 339773f76b1SDavid WoodhouseWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts 340773f76b1SDavid WoodhouseWRAPPER_BINDIR := /usr/sbin 341773f76b1SDavid WoodhouseINSTALL := install 342773f76b1SDavid Woodhouse 343773f76b1SDavid Woodhouseextra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) 344773f76b1SDavid Woodhousehostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y)) 345773f76b1SDavid Woodhousewrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper 346773f76b1SDavid Woodhousedts-installed := $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts)) 347773f76b1SDavid Woodhouse 348773f76b1SDavid Woodhouseall-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) 349773f76b1SDavid Woodhouse 350773f76b1SDavid Woodhousequiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 351773f76b1SDavid Woodhouse cmd_mkdir = mkdir -p $@ 352773f76b1SDavid Woodhouse 353773f76b1SDavid Woodhousequiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@) 354773f76b1SDavid Woodhouse cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ 355773f76b1SDavid Woodhouse 356773f76b1SDavid Woodhousequiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@) 357773f76b1SDavid Woodhouse cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ 358773f76b1SDavid Woodhouse 359773f76b1SDavid Woodhousequiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 360773f76b1SDavid Woodhouse cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ 361773f76b1SDavid Woodhouse 362773f76b1SDavid Woodhousequiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 363773f76b1SDavid Woodhouse cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\ 364773f76b1SDavid Woodhouse sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \ 365773f76b1SDavid Woodhouse -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \ 366773f76b1SDavid Woodhouse 367773f76b1SDavid Woodhouse 368773f76b1SDavid Woodhouse$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR): 369773f76b1SDavid Woodhouse $(call cmd,mkdir) 370773f76b1SDavid Woodhouse 371773f76b1SDavid Woodhouse$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR) 372773f76b1SDavid Woodhouse $(call cmd,install) 373773f76b1SDavid Woodhouse 374773f76b1SDavid Woodhouse$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR) 375773f76b1SDavid Woodhouse $(call cmd,install_exe) 376773f76b1SDavid Woodhouse 377773f76b1SDavid Woodhouse$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR) 378773f76b1SDavid Woodhouse $(call cmd,install_dts) 379773f76b1SDavid Woodhouse 380773f76b1SDavid Woodhouse$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR) 381773f76b1SDavid Woodhouse $(call cmd,install_wrapper) 382773f76b1SDavid Woodhouse 383773f76b1SDavid Woodhouse$(obj)/bootwrapper_install: $(all-installed) 384773f76b1SDavid Woodhouse 385