1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun# Makefile for making ELF bootable images for booting on CHRP 3*4882a593Smuzhiyun# using Open Firmware. 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun# Geert Uytterhoeven September 1997 6*4882a593Smuzhiyun# 7*4882a593Smuzhiyun# Based on coffboot by Paul Mackerras 8*4882a593Smuzhiyun# Simplified for ppc64 by Todd Inglett 9*4882a593Smuzhiyun# 10*4882a593Smuzhiyun# NOTE: this code may be built for 32 bit in ELF32 format even though 11*4882a593Smuzhiyun# it packages a 64 bit kernel. We do this to simplify the 12*4882a593Smuzhiyun# bootloader and increase compatibility with OpenFirmware. 13*4882a593Smuzhiyun# 14*4882a593Smuzhiyun# To this end we need to define BOOTCC, etc, as the tools 15*4882a593Smuzhiyun# needed to build the 32 bit image. That's normally the same 16*4882a593Smuzhiyun# compiler for the rest of the kernel, with the -m32 flag added. 17*4882a593Smuzhiyun# To make it easier to setup a cross compiler, 18*4882a593Smuzhiyun# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE 19*4882a593Smuzhiyun# in the toplevel makefile. 20*4882a593Smuzhiyun 21*4882a593Smuzhiyunall: $(obj)/zImage 22*4882a593Smuzhiyun 23*4882a593Smuzhiyunifdef CROSS32_COMPILE 24*4882a593Smuzhiyun BOOTCC := $(CROSS32_COMPILE)gcc 25*4882a593Smuzhiyun BOOTAR := $(CROSS32_COMPILE)ar 26*4882a593Smuzhiyunelse 27*4882a593Smuzhiyun BOOTCC := $(CC) 28*4882a593Smuzhiyun BOOTAR := $(AR) 29*4882a593Smuzhiyunendif 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunBOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 32*4882a593Smuzhiyun -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ 33*4882a593Smuzhiyun $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ 34*4882a593Smuzhiyun -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 35*4882a593Smuzhiyun $(LINUXINCLUDE) 36*4882a593Smuzhiyun 37*4882a593Smuzhiyunifdef CONFIG_PPC64_BOOT_WRAPPER 38*4882a593SmuzhiyunBOOTCFLAGS += -m64 39*4882a593Smuzhiyunelse 40*4882a593SmuzhiyunBOOTCFLAGS += -m32 41*4882a593Smuzhiyunendif 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunBOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) 44*4882a593Smuzhiyun 45*4882a593Smuzhiyunifdef CONFIG_CPU_BIG_ENDIAN 46*4882a593SmuzhiyunBOOTCFLAGS += -mbig-endian 47*4882a593Smuzhiyunelse 48*4882a593SmuzhiyunBOOTCFLAGS += -mlittle-endian 49*4882a593SmuzhiyunBOOTCFLAGS += $(call cc-option,-mabi=elfv2) 50*4882a593Smuzhiyunendif 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunBOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunBOOTARFLAGS := -crD 55*4882a593Smuzhiyun 56*4882a593Smuzhiyunifdef CONFIG_CC_IS_CLANG 57*4882a593SmuzhiyunBOOTCFLAGS += $(CLANG_FLAGS) 58*4882a593SmuzhiyunBOOTAFLAGS += $(CLANG_FLAGS) 59*4882a593Smuzhiyunendif 60*4882a593Smuzhiyun 61*4882a593Smuzhiyunifdef CONFIG_DEBUG_INFO 62*4882a593SmuzhiyunBOOTCFLAGS += -g 63*4882a593Smuzhiyunendif 64*4882a593Smuzhiyun 65*4882a593Smuzhiyunifeq ($(call cc-option-yn, -fstack-protector),y) 66*4882a593SmuzhiyunBOOTCFLAGS += -fno-stack-protector 67*4882a593Smuzhiyunendif 68*4882a593Smuzhiyun 69*4882a593SmuzhiyunBOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunDTC_FLAGS ?= -p 1024 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 74*4882a593Smuzhiyun$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 75*4882a593Smuzhiyun$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405 76*4882a593Smuzhiyun$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 77*4882a593Smuzhiyun$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 78*4882a593Smuzhiyun$(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 79*4882a593Smuzhiyun$(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 80*4882a593Smuzhiyun$(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405 81*4882a593Smuzhiyun$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun# The pre-boot decompressors pull in a lot of kernel headers and other source 84*4882a593Smuzhiyun# files. This creates a bit of a dependency headache since we need to copy 85*4882a593Smuzhiyun# these files into the build dir, fix up any includes and ensure that dependent 86*4882a593Smuzhiyun# files are copied in the right order. 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun# these need to be seperate variables because they are copied out of different 89*4882a593Smuzhiyun# directories in the kernel tree. Sure you COULd merge them, but it's a 90*4882a593Smuzhiyun# cure-is-worse-than-disease situation. 91*4882a593Smuzhiyunzlib-decomp-$(CONFIG_KERNEL_GZIP) := decompress_inflate.c 92*4882a593Smuzhiyunzlib-$(CONFIG_KERNEL_GZIP) := inffast.c inflate.c inftrees.c 93*4882a593Smuzhiyunzlibheader-$(CONFIG_KERNEL_GZIP) := inffast.h inffixed.h inflate.h inftrees.h infutil.h 94*4882a593Smuzhiyunzliblinuxheader-$(CONFIG_KERNEL_GZIP) := zlib.h zconf.h zutil.h 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun$(addprefix $(obj)/, decompress.o): \ 97*4882a593Smuzhiyun $(addprefix $(obj)/,$(zlib-decomp-y)) 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun$(addprefix $(obj)/, $(zlib-decomp-y)): \ 100*4882a593Smuzhiyun $(addprefix $(obj)/,$(zliblinuxheader-y)) \ 101*4882a593Smuzhiyun $(addprefix $(obj)/,$(zlibheader-y)) \ 102*4882a593Smuzhiyun $(addprefix $(obj)/,$(zlib-y)) 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun$(addprefix $(obj)/,$(zlib-y)): \ 105*4882a593Smuzhiyun $(addprefix $(obj)/,$(zliblinuxheader-y)) \ 106*4882a593Smuzhiyun $(addprefix $(obj)/,$(zlibheader-y)) 107*4882a593Smuzhiyun 108*4882a593Smuzhiyunlibfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 109*4882a593Smuzhiyunlibfdtheader := fdt.h libfdt.h libfdt_internal.h 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o \ 112*4882a593Smuzhiyun treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o): \ 113*4882a593Smuzhiyun $(addprefix $(obj)/,$(libfdtheader)) 114*4882a593Smuzhiyun 115*4882a593Smuzhiyunsrc-wlib-y := string.S crt0.S stdio.c decompress.c main.c \ 116*4882a593Smuzhiyun $(libfdt) libfdt-wrapper.c \ 117*4882a593Smuzhiyun ns16550.c serial.c simple_alloc.c div64.S util.S \ 118*4882a593Smuzhiyun elf_util.c $(zlib-y) devtree.c stdlib.c \ 119*4882a593Smuzhiyun oflib.c ofconsole.c cuboot.c 120*4882a593Smuzhiyun 121*4882a593Smuzhiyunsrc-wlib-$(CONFIG_PPC_MPC52xx) += mpc52xx-psc.c 122*4882a593Smuzhiyunsrc-wlib-$(CONFIG_PPC64_BOOT_WRAPPER) += opal-calls.S opal.c 123*4882a593Smuzhiyunifndef CONFIG_PPC64_BOOT_WRAPPER 124*4882a593Smuzhiyunsrc-wlib-y += crtsavres.S 125*4882a593Smuzhiyunendif 126*4882a593Smuzhiyunsrc-wlib-$(CONFIG_40x) += 4xx.c planetcore.c 127*4882a593Smuzhiyunsrc-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c 128*4882a593Smuzhiyunsrc-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c 129*4882a593Smuzhiyunsrc-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c 130*4882a593Smuzhiyunsrc-wlib-$(CONFIG_EMBEDDED6xx) += ugecon.c fsl-soc.c 131*4882a593Smuzhiyunsrc-wlib-$(CONFIG_CPM) += cpm-serial.c 132*4882a593Smuzhiyun 133*4882a593Smuzhiyunsrc-plat-y := of.c epapr.c 134*4882a593Smuzhiyunsrc-plat-$(CONFIG_40x) += fixed-head.S cuboot-hotfoot.c \ 135*4882a593Smuzhiyun cuboot-acadia.c \ 136*4882a593Smuzhiyun cuboot-kilauea.c simpleboot.c 137*4882a593Smuzhiyunsrc-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ 138*4882a593Smuzhiyun cuboot-bamboo.c cuboot-sam440ep.c \ 139*4882a593Smuzhiyun cuboot-sequoia.c cuboot-rainier.c \ 140*4882a593Smuzhiyun cuboot-taishan.c cuboot-katmai.c \ 141*4882a593Smuzhiyun cuboot-warp.c cuboot-yosemite.c \ 142*4882a593Smuzhiyun treeboot-iss4xx.c treeboot-currituck.c \ 143*4882a593Smuzhiyun treeboot-akebono.c \ 144*4882a593Smuzhiyun simpleboot.c fixed-head.S 145*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c 146*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c 147*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c 148*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c 149*4882a593Smuzhiyunsrc-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c 150*4882a593Smuzhiyunsrc-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \ 151*4882a593Smuzhiyun gamecube-head.S gamecube.c \ 152*4882a593Smuzhiyun wii-head.S wii.c holly.c \ 153*4882a593Smuzhiyun fixed-head.S mvme5100.c 154*4882a593Smuzhiyunsrc-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c 155*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c 156*4882a593Smuzhiyunsrc-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c 157*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_PSERIES) += pseries-head.S 158*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S 159*4882a593Smuzhiyunsrc-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S 160*4882a593Smuzhiyunsrc-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c 161*4882a593Smuzhiyun 162*4882a593Smuzhiyunsrc-wlib := $(sort $(src-wlib-y)) 163*4882a593Smuzhiyunsrc-plat := $(sort $(src-plat-y)) 164*4882a593Smuzhiyunsrc-boot := $(src-wlib) $(src-plat) empty.c 165*4882a593Smuzhiyun 166*4882a593Smuzhiyunsrc-boot := $(addprefix $(obj)/, $(src-boot)) 167*4882a593Smuzhiyunobj-boot := $(addsuffix .o, $(basename $(src-boot))) 168*4882a593Smuzhiyunobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 169*4882a593Smuzhiyunobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 170*4882a593Smuzhiyunobj-plat: $(libfdt) 171*4882a593Smuzhiyun 172*4882a593Smuzhiyunquiet_cmd_copy_kern_src = COPY $@ 173*4882a593Smuzhiyun cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@ 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun$(addprefix $(obj)/,$(zlib-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 176*4882a593Smuzhiyun $(call cmd,copy_kern_src) 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun$(addprefix $(obj)/,$(zlibheader-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 179*4882a593Smuzhiyun $(call cmd,copy_kern_src) 180*4882a593Smuzhiyun 181*4882a593Smuzhiyun$(addprefix $(obj)/,$(zliblinuxheader-y)): $(obj)/%: $(srctree)/include/linux/% 182*4882a593Smuzhiyun $(call cmd,copy_kern_src) 183*4882a593Smuzhiyun 184*4882a593Smuzhiyun$(addprefix $(obj)/,$(zlib-decomp-y)): $(obj)/%: $(srctree)/lib/% 185*4882a593Smuzhiyun $(call cmd,copy_kern_src) 186*4882a593Smuzhiyun 187*4882a593Smuzhiyunquiet_cmd_copy_libfdt = COPY $@ 188*4882a593Smuzhiyun cmd_copy_libfdt = cp $< $@ 189*4882a593Smuzhiyun 190*4882a593Smuzhiyun$(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% 191*4882a593Smuzhiyun $(call cmd,copy_libfdt) 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun$(obj)/empty.c: 194*4882a593Smuzhiyun $(Q)touch $@ 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun$(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S 197*4882a593Smuzhiyun $(Q)cp $< $@ 198*4882a593Smuzhiyun 199*4882a593Smuzhiyunclean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \ 200*4882a593Smuzhiyun $(zlib-decomp-) $(libfdt) $(libfdtheader) \ 201*4882a593Smuzhiyun empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 202*4882a593Smuzhiyun 203*4882a593Smuzhiyunquiet_cmd_bootcc = BOOTCC $@ 204*4882a593Smuzhiyun cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 205*4882a593Smuzhiyun 206*4882a593Smuzhiyunquiet_cmd_bootas = BOOTAS $@ 207*4882a593Smuzhiyun cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 208*4882a593Smuzhiyun 209*4882a593Smuzhiyunquiet_cmd_bootar = BOOTAR $@ 210*4882a593Smuzhiyun cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@ 211*4882a593Smuzhiyun 212*4882a593Smuzhiyun$(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE 213*4882a593Smuzhiyun $(call if_changed_dep,bootcc) 214*4882a593Smuzhiyun$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE 215*4882a593Smuzhiyun $(Q)mkdir -p $(dir $@) 216*4882a593Smuzhiyun $(call if_changed_dep,bootcc) 217*4882a593Smuzhiyun$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE 218*4882a593Smuzhiyun $(Q)mkdir -p $(dir $@) 219*4882a593Smuzhiyun $(call if_changed_dep,bootas) 220*4882a593Smuzhiyun 221*4882a593Smuzhiyun$(obj)/wrapper.a: $(obj-wlib) FORCE 222*4882a593Smuzhiyun $(call if_changed,bootar) 223*4882a593Smuzhiyun 224*4882a593Smuzhiyunhostprogs := addnote hack-coff mktree 225*4882a593Smuzhiyun 226*4882a593Smuzhiyuntargets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) 227*4882a593Smuzhiyunextra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 228*4882a593Smuzhiyun $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds 229*4882a593Smuzhiyun 230*4882a593Smuzhiyundtstree := $(srctree)/$(src)/dts 231*4882a593Smuzhiyun 232*4882a593Smuzhiyunwrapper :=$(srctree)/$(src)/wrapper 233*4882a593Smuzhiyunwrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ 234*4882a593Smuzhiyun $(wrapper) FORCE 235*4882a593Smuzhiyun 236*4882a593Smuzhiyun############# 237*4882a593Smuzhiyun# Bits for building various flavours of zImage 238*4882a593Smuzhiyun 239*4882a593Smuzhiyunifneq ($(CROSS32_COMPILE),) 240*4882a593SmuzhiyunCROSSWRAP := -C "$(CROSS32_COMPILE)" 241*4882a593Smuzhiyunelse 242*4882a593Smuzhiyunifneq ($(CROSS_COMPILE),) 243*4882a593SmuzhiyunCROSSWRAP := -C "$(CROSS_COMPILE)" 244*4882a593Smuzhiyunendif 245*4882a593Smuzhiyunendif 246*4882a593Smuzhiyun 247*4882a593Smuzhiyuncompressor-$(CONFIG_KERNEL_GZIP) := gz 248*4882a593Smuzhiyuncompressor-$(CONFIG_KERNEL_XZ) := xz 249*4882a593Smuzhiyuncompressor-$(CONFIG_KERNEL_LZMA) := lzma 250*4882a593Smuzhiyuncompressor-$(CONFIG_KERNEL_LZO) := lzo 251*4882a593Smuzhiyun 252*4882a593Smuzhiyun# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd 253*4882a593Smuzhiyunquiet_cmd_wrap = WRAP $@ 254*4882a593Smuzhiyun cmd_wrap =$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \ 255*4882a593Smuzhiyun $(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \ 256*4882a593Smuzhiyun vmlinux 257*4882a593Smuzhiyun 258*4882a593Smuzhiyunimage-$(CONFIG_PPC_PSERIES) += zImage.pseries 259*4882a593Smuzhiyunimage-$(CONFIG_PPC_POWERNV) += zImage.pseries 260*4882a593Smuzhiyunimage-$(CONFIG_PPC_MAPLE) += zImage.maple 261*4882a593Smuzhiyunimage-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries 262*4882a593Smuzhiyunimage-$(CONFIG_PPC_PS3) += dtbImage.ps3 263*4882a593Smuzhiyunimage-$(CONFIG_PPC_CHRP) += zImage.chrp 264*4882a593Smuzhiyunimage-$(CONFIG_PPC_EFIKA) += zImage.chrp 265*4882a593Smuzhiyunimage-$(CONFIG_PPC_PMAC) += zImage.pmac 266*4882a593Smuzhiyunimage-$(CONFIG_PPC_HOLLY) += dtbImage.holly 267*4882a593Smuzhiyunimage-$(CONFIG_DEFAULT_UIMAGE) += uImage 268*4882a593Smuzhiyunimage-$(CONFIG_EPAPR_BOOT) += zImage.epapr 269*4882a593Smuzhiyun 270*4882a593Smuzhiyun# 271*4882a593Smuzhiyun# Targets which embed a device tree blob 272*4882a593Smuzhiyun# 273*4882a593Smuzhiyun# Theses are default targets to build images which embed device tree blobs. 274*4882a593Smuzhiyun# They are only required on boards which do not have FDT support in firmware. 275*4882a593Smuzhiyun# Boards with newish u-boot firmware can use the uImage target above 276*4882a593Smuzhiyun# 277*4882a593Smuzhiyun 278*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/40x/Kconfig 279*4882a593Smuzhiyunimage-$(CONFIG_HOTFOOT) += cuImage.hotfoot 280*4882a593Smuzhiyunimage-$(CONFIG_ACADIA) += cuImage.acadia 281*4882a593Smuzhiyunimage-$(CONFIG_OBS600) += uImage.obs600 282*4882a593Smuzhiyun 283*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/44x/Kconfig 284*4882a593Smuzhiyunimage-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 285*4882a593Smuzhiyunimage-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo 286*4882a593Smuzhiyunimage-$(CONFIG_SAM440EP) += cuImage.sam440ep 287*4882a593Smuzhiyunimage-$(CONFIG_SEQUOIA) += cuImage.sequoia 288*4882a593Smuzhiyunimage-$(CONFIG_RAINIER) += cuImage.rainier 289*4882a593Smuzhiyunimage-$(CONFIG_TAISHAN) += cuImage.taishan 290*4882a593Smuzhiyunimage-$(CONFIG_KATMAI) += cuImage.katmai 291*4882a593Smuzhiyunimage-$(CONFIG_WARP) += cuImage.warp 292*4882a593Smuzhiyunimage-$(CONFIG_YOSEMITE) += cuImage.yosemite 293*4882a593Smuzhiyunimage-$(CONFIG_ISS4xx) += treeImage.iss4xx \ 294*4882a593Smuzhiyun treeImage.iss4xx-mpic 295*4882a593Smuzhiyunimage-$(CONFIG_CURRITUCK) += treeImage.currituck 296*4882a593Smuzhiyunimage-$(CONFIG_AKEBONO) += treeImage.akebono 297*4882a593Smuzhiyun 298*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/8xx/Kconfig 299*4882a593Smuzhiyunimage-$(CONFIG_MPC86XADS) += cuImage.mpc866ads 300*4882a593Smuzhiyunimage-$(CONFIG_MPC885ADS) += cuImage.mpc885ads 301*4882a593Smuzhiyunimage-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc 302*4882a593Smuzhiyunimage-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \ 303*4882a593Smuzhiyun dtbImage.adder875-redboot 304*4882a593Smuzhiyun 305*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/52xx/Kconfig 306*4882a593Smuzhiyunimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 307*4882a593Smuzhiyunimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b 308*4882a593Smuzhiyunimage-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 309*4882a593Smuzhiyun 310*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/82xx/Kconfig 311*4882a593Smuzhiyunimage-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads 312*4882a593Smuzhiyunimage-$(CONFIG_PQ2FADS) += cuImage.pq2fads 313*4882a593Smuzhiyunimage-$(CONFIG_EP8248E) += dtbImage.ep8248e 314*4882a593Smuzhiyun 315*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/83xx/Kconfig 316*4882a593Smuzhiyunimage-$(CONFIG_MPC832x_MDS) += cuImage.mpc832x_mds 317*4882a593Smuzhiyunimage-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb 318*4882a593Smuzhiyunimage-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \ 319*4882a593Smuzhiyun cuImage.mpc8349emitxgp 320*4882a593Smuzhiyunimage-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds 321*4882a593Smuzhiyunimage-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds 322*4882a593Smuzhiyunimage-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot 323*4882a593Smuzhiyun 324*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/85xx/Kconfig 325*4882a593Smuzhiyunimage-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads 326*4882a593Smuzhiyunimage-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads 327*4882a593Smuzhiyunimage-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \ 328*4882a593Smuzhiyun cuImage.mpc8548cds_32b \ 329*4882a593Smuzhiyun cuImage.mpc8555cds 330*4882a593Smuzhiyunimage-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 331*4882a593Smuzhiyunimage-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 332*4882a593Smuzhiyun cuImage.mpc8572ds 333*4882a593Smuzhiyunimage-$(CONFIG_TQM8540) += cuImage.tqm8540 334*4882a593Smuzhiyunimage-$(CONFIG_TQM8541) += cuImage.tqm8541 335*4882a593Smuzhiyunimage-$(CONFIG_TQM8548) += cuImage.tqm8548 336*4882a593Smuzhiyunimage-$(CONFIG_TQM8555) += cuImage.tqm8555 337*4882a593Smuzhiyunimage-$(CONFIG_TQM8560) += cuImage.tqm8560 338*4882a593Smuzhiyunimage-$(CONFIG_SBC8548) += cuImage.sbc8548 339*4882a593Smuzhiyunimage-$(CONFIG_KSI8560) += cuImage.ksi8560 340*4882a593Smuzhiyun 341*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/86xx/Kconfig 342*4882a593Smuzhiyunimage-$(CONFIG_MVME7100) += dtbImage.mvme7100 343*4882a593Smuzhiyun 344*4882a593Smuzhiyun# Board ports in arch/powerpc/platform/embedded6xx/Kconfig 345*4882a593Smuzhiyunimage-$(CONFIG_STORCENTER) += cuImage.storcenter 346*4882a593Smuzhiyunimage-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2 347*4882a593Smuzhiyunimage-$(CONFIG_GAMECUBE) += dtbImage.gamecube 348*4882a593Smuzhiyunimage-$(CONFIG_WII) += dtbImage.wii 349*4882a593Smuzhiyunimage-$(CONFIG_MVME5100) += dtbImage.mvme5100 350*4882a593Smuzhiyun 351*4882a593Smuzhiyun# Board port in arch/powerpc/platform/amigaone/Kconfig 352*4882a593Smuzhiyunimage-$(CONFIG_AMIGAONE) += cuImage.amigaone 353*4882a593Smuzhiyun 354*4882a593Smuzhiyun# For 32-bit powermacs, build the COFF and miboot images 355*4882a593Smuzhiyun# as well as the ELF images. 356*4882a593Smuzhiyunifdef CONFIG_PPC32 357*4882a593Smuzhiyunimage-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot 358*4882a593Smuzhiyunendif 359*4882a593Smuzhiyun 360*4882a593Smuzhiyun# Allow extra targets to be added to the defconfig 361*4882a593Smuzhiyunimage-y += $(subst ",,$(CONFIG_EXTRA_TARGETS)) 362*4882a593Smuzhiyun 363*4882a593Smuzhiyuninitrd- := $(patsubst zImage%, zImage.initrd%, $(image-)) 364*4882a593Smuzhiyuninitrd-y := $(patsubst zImage%, zImage.initrd%, \ 365*4882a593Smuzhiyun $(patsubst dtbImage%, dtbImage.initrd%, \ 366*4882a593Smuzhiyun $(patsubst simpleImage%, simpleImage.initrd%, \ 367*4882a593Smuzhiyun $(patsubst treeImage%, treeImage.initrd%, $(image-y))))) 368*4882a593Smuzhiyuninitrd-y := $(filter-out $(image-y), $(initrd-y)) 369*4882a593Smuzhiyuntargets += $(image-y) $(initrd-y) 370*4882a593Smuzhiyuntargets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ 371*4882a593Smuzhiyun $(patsubst $(x).%, dts/%.dtb, $(filter $(x).%, $(image-y)))) 372*4882a593Smuzhiyuntargets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ 373*4882a593Smuzhiyun $(patsubst $(x).%, dts/fsl/%.dtb, $(filter $(x).%, $(image-y)))) 374*4882a593Smuzhiyun 375*4882a593Smuzhiyun$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz 376*4882a593Smuzhiyun 377*4882a593Smuzhiyun# Don't put the ramdisk on the pattern rule; when its missing make will try 378*4882a593Smuzhiyun# the pattern rule with less dependencies that also matches (even with the 379*4882a593Smuzhiyun# hard dependency listed). 380*4882a593Smuzhiyun$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) FORCE 381*4882a593Smuzhiyun $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) 382*4882a593Smuzhiyun 383*4882a593Smuzhiyun$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits) FORCE 384*4882a593Smuzhiyun $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@)) 385*4882a593Smuzhiyun 386*4882a593Smuzhiyun# dtbImage% - a dtbImage is a zImage with an embedded device tree blob 387*4882a593Smuzhiyun$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE 388*4882a593Smuzhiyun $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 389*4882a593Smuzhiyun 390*4882a593Smuzhiyun$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE 391*4882a593Smuzhiyun $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb) 392*4882a593Smuzhiyun 393*4882a593Smuzhiyun# This cannot be in the root of $(src) as the zImage rule always adds a $(obj) 394*4882a593Smuzhiyun# prefix 395*4882a593Smuzhiyun$(obj)/vmlinux.strip: vmlinux 396*4882a593Smuzhiyun $(STRIP) -s -R .comment $< -o $@ 397*4882a593Smuzhiyun 398*4882a593Smuzhiyun$(obj)/uImage: vmlinux $(wrapperbits) FORCE 399*4882a593Smuzhiyun $(call if_changed,wrap,uboot) 400*4882a593Smuzhiyun 401*4882a593Smuzhiyun$(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 402*4882a593Smuzhiyun $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 403*4882a593Smuzhiyun 404*4882a593Smuzhiyun$(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 405*4882a593Smuzhiyun $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb) 406*4882a593Smuzhiyun 407*4882a593Smuzhiyun$(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 408*4882a593Smuzhiyun $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 409*4882a593Smuzhiyun 410*4882a593Smuzhiyun$(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 411*4882a593Smuzhiyun $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb) 412*4882a593Smuzhiyun 413*4882a593Smuzhiyun$(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 414*4882a593Smuzhiyun $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 415*4882a593Smuzhiyun 416*4882a593Smuzhiyun$(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 417*4882a593Smuzhiyun $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb) 418*4882a593Smuzhiyun 419*4882a593Smuzhiyun$(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 420*4882a593Smuzhiyun $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 421*4882a593Smuzhiyun 422*4882a593Smuzhiyun$(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 423*4882a593Smuzhiyun $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb) 424*4882a593Smuzhiyun 425*4882a593Smuzhiyun# Needed for the above targets to work with dts/fsl/ files 426*4882a593Smuzhiyun$(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb 427*4882a593Smuzhiyun @cp $< $@ 428*4882a593Smuzhiyun 429*4882a593Smuzhiyun# If there isn't a platform selected then just strip the vmlinux. 430*4882a593Smuzhiyunifeq (,$(image-y)) 431*4882a593Smuzhiyunimage-y := vmlinux.strip 432*4882a593Smuzhiyunendif 433*4882a593Smuzhiyun 434*4882a593Smuzhiyun$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 435*4882a593Smuzhiyun $(Q)rm -f $@; ln $< $@ 436*4882a593Smuzhiyun$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) 437*4882a593Smuzhiyun $(Q)rm -f $@; ln $< $@ 438*4882a593Smuzhiyun 439*4882a593Smuzhiyun# Only install the vmlinux 440*4882a593Smuzhiyuninstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) 441*4882a593Smuzhiyun sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" 442*4882a593Smuzhiyun 443*4882a593Smuzhiyun# Install the vmlinux and other built boot targets. 444*4882a593SmuzhiyunzInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) 445*4882a593Smuzhiyun sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^ 446*4882a593Smuzhiyun 447*4882a593SmuzhiyunPHONY += install zInstall 448*4882a593Smuzhiyun 449*4882a593Smuzhiyun# anything not in $(targets) 450*4882a593Smuzhiyunclean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \ 451*4882a593Smuzhiyun zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ 452*4882a593Smuzhiyun zImage.miboot zImage.pmac zImage.pseries \ 453*4882a593Smuzhiyun zImage.maple simpleImage.* otheros.bld 454*4882a593Smuzhiyun 455*4882a593Smuzhiyun# clean up files cached by wrapper 456*4882a593Smuzhiyunclean-kernel-base := vmlinux.strip vmlinux.bin 457*4882a593Smuzhiyunclean-kernel := $(addsuffix .gz,$(clean-kernel-base)) 458*4882a593Smuzhiyunclean-kernel += $(addsuffix .xz,$(clean-kernel-base)) 459*4882a593Smuzhiyun# If not absolute clean-files are relative to $(obj). 460*4882a593Smuzhiyunclean-files += $(addprefix $(objtree)/, $(clean-kernel)) 461*4882a593Smuzhiyun 462*4882a593SmuzhiyunWRAPPER_OBJDIR := /usr/lib/kernel-wrapper 463*4882a593SmuzhiyunWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts 464*4882a593SmuzhiyunWRAPPER_BINDIR := /usr/sbin 465*4882a593SmuzhiyunINSTALL := install 466*4882a593Smuzhiyun 467*4882a593Smuzhiyunextra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) 468*4882a593Smuzhiyunhostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs)) 469*4882a593Smuzhiyunwrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper 470*4882a593Smuzhiyundts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts)) 471*4882a593Smuzhiyun 472*4882a593Smuzhiyunall-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) 473*4882a593Smuzhiyun 474*4882a593Smuzhiyunquiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 475*4882a593Smuzhiyun cmd_mkdir = mkdir -p $@ 476*4882a593Smuzhiyun 477*4882a593Smuzhiyunquiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@) 478*4882a593Smuzhiyun cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ 479*4882a593Smuzhiyun 480*4882a593Smuzhiyunquiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@) 481*4882a593Smuzhiyun cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ 482*4882a593Smuzhiyun 483*4882a593Smuzhiyunquiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 484*4882a593Smuzhiyun cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ 485*4882a593Smuzhiyun 486*4882a593Smuzhiyunquiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 487*4882a593Smuzhiyun cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\ 488*4882a593Smuzhiyun sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \ 489*4882a593Smuzhiyun -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \ 490*4882a593Smuzhiyun 491*4882a593Smuzhiyun 492*4882a593Smuzhiyun$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR): 493*4882a593Smuzhiyun $(call cmd,mkdir) 494*4882a593Smuzhiyun 495*4882a593Smuzhiyun$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR) 496*4882a593Smuzhiyun $(call cmd,install) 497*4882a593Smuzhiyun 498*4882a593Smuzhiyun$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR) 499*4882a593Smuzhiyun $(call cmd,install_exe) 500*4882a593Smuzhiyun 501*4882a593Smuzhiyun$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR) 502*4882a593Smuzhiyun $(call cmd,install_dts) 503*4882a593Smuzhiyun 504*4882a593Smuzhiyun$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR) 505*4882a593Smuzhiyun $(call cmd,install_wrapper) 506*4882a593Smuzhiyun 507*4882a593Smuzhiyun$(obj)/bootwrapper_install: $(all-installed) 508