1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 294b212c2SPaul Mackerras# Makefile for making ELF bootable images for booting on CHRP 394b212c2SPaul Mackerras# using Open Firmware. 494b212c2SPaul Mackerras# 594b212c2SPaul Mackerras# Geert Uytterhoeven September 1997 694b212c2SPaul Mackerras# 794b212c2SPaul Mackerras# Based on coffboot by Paul Mackerras 894b212c2SPaul Mackerras# Simplified for ppc64 by Todd Inglett 994b212c2SPaul Mackerras# 10364b236aSJordan Niethe# NOTE: this code may be built for 32 bit in ELF32 format even though 1194b212c2SPaul Mackerras# it packages a 64 bit kernel. We do this to simplify the 1294b212c2SPaul Mackerras# bootloader and increase compatibility with OpenFirmware. 1394b212c2SPaul Mackerras# 1494b212c2SPaul Mackerras# To this end we need to define BOOTCC, etc, as the tools 15b610b978SDavid Gibson# needed to build the 32 bit image. That's normally the same 16b610b978SDavid Gibson# compiler for the rest of the kernel, with the -m32 flag added. 1794b212c2SPaul Mackerras# To make it easier to setup a cross compiler, 1894b212c2SPaul Mackerras# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE 1994b212c2SPaul Mackerras# in the toplevel makefile. 2094b212c2SPaul Mackerras 212bf11819SPaul Mackerrasall: $(obj)/zImage 2294b212c2SPaul Mackerras 23af3901cbSNicholas Pigginifdef CROSS32_COMPILE 24215fadfeSBill Wendlingifdef CONFIG_CC_IS_CLANG 25215fadfeSBill Wendling BOOTCC := $(CROSS32_COMPILE)clang 26215fadfeSBill Wendlingelse 27af3901cbSNicholas Piggin BOOTCC := $(CROSS32_COMPILE)gcc 28215fadfeSBill Wendlingendif 29af3901cbSNicholas Piggin BOOTAR := $(CROSS32_COMPILE)ar 30af3901cbSNicholas Pigginelse 31af3901cbSNicholas Piggin BOOTCC := $(CC) 32af3901cbSNicholas Piggin BOOTAR := $(AR) 33af3901cbSNicholas Pigginendif 34af3901cbSNicholas Piggin 35147c0516SCédric Le Goaterifdef CONFIG_PPC64_BOOT_WRAPPER 36689d592eSNicholas PigginBOOTTARGETFLAGS += -m64 37689d592eSNicholas PigginBOOTTARGETFLAGS += -mabi=elfv2 38d1c5accaSNathan Chancellorifdef CONFIG_PPC64_ELF_ABI_V2 39689d592eSNicholas PigginBOOTTARGETFLAGS += $(call cc-option,-mabi=elfv2) 40d1c5accaSNathan Chancellorendif 4165c5ec11SMichael Ellermanelse 42689d592eSNicholas PigginBOOTTARGETFLAGS := -m32 4340a75584SJoel Stanleyendif 44ff7c76f6SPali Rohár 45ff7c76f6SPali Rohárifdef CONFIG_TARGET_CPU_BOOL 46689d592eSNicholas PigginBOOTTARGETFLAGS += -mcpu=$(CONFIG_TARGET_CPU) 47ff7c76f6SPali Rohárelse ifdef CONFIG_PPC64_BOOT_WRAPPER 48ff7c76f6SPali Rohárifdef CONFIG_CPU_LITTLE_ENDIAN 49689d592eSNicholas PigginBOOTTARGETFLAGS += -mcpu=powerpc64le 5040a75584SJoel Stanleyelse 51689d592eSNicholas PigginBOOTTARGETFLAGS += -mcpu=powerpc64 52ff7c76f6SPali Rohárendif 5365c5ec11SMichael Ellermanendif 5465c5ec11SMichael Ellerman 55689d592eSNicholas Piggin$(obj)/4xx.o: BOOTTARGETFLAGS += -mcpu=405 56689d592eSNicholas Piggin$(obj)/ebony.o: BOOTTARGETFLAGS += -mcpu=440 57689d592eSNicholas Piggin$(obj)/cuboot-taishan.o: BOOTTARGETFLAGS += -mcpu=440 58689d592eSNicholas Piggin$(obj)/cuboot-katmai.o: BOOTTARGETFLAGS += -mcpu=440 59689d592eSNicholas Piggin$(obj)/treeboot-iss4xx.o: BOOTTARGETFLAGS += -mcpu=405 60689d592eSNicholas Piggin$(obj)/treeboot-currituck.o: BOOTTARGETFLAGS += -mcpu=405 61689d592eSNicholas Piggin$(obj)/treeboot-akebono.o: BOOTTARGETFLAGS += -mcpu=405 62689d592eSNicholas Piggin 63147c0516SCédric Le Goaterifdef CONFIG_CPU_BIG_ENDIAN 64689d592eSNicholas PigginBOOTTARGETFLAGS += -mbig-endian 65655471f5SBenjamin Herrenschmidtelse 66689d592eSNicholas PigginBOOTTARGETFLAGS += -mlittle-endian 67661aa880SChristophe Leroyendif 68147c0516SCédric Le Goater 698bce81dbSNicholas PigginBOOTCPPFLAGS := -nostdinc $(LINUXINCLUDE) 708bce81dbSNicholas PigginBOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) 718bce81dbSNicholas Piggin 72f5df87b8SNicholas PigginBOOTCFLAGS := $(BOOTTARGETFLAGS) \ 738bce81dbSNicholas Piggin -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 748bce81dbSNicholas Piggin -fno-strict-aliasing -O2 \ 758bce81dbSNicholas Piggin -msoft-float -mno-altivec -mno-vsx \ 768bce81dbSNicholas Piggin $(call cc-option,-mno-prefixed) \ 778bce81dbSNicholas Piggin $(call cc-option,-mno-pcrel) \ 788bce81dbSNicholas Piggin $(call cc-option,-mno-mma) \ 798bce81dbSNicholas Piggin $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ 808bce81dbSNicholas Piggin -fomit-frame-pointer -fno-builtin -fPIC 818bce81dbSNicholas Piggin 82f5df87b8SNicholas PigginBOOTAFLAGS := $(BOOTTARGETFLAGS) -D__ASSEMBLY__ 8394b212c2SPaul Mackerras 8413dc8c02SMasahiro YamadaBOOTARFLAGS := -crD 85af3901cbSNicholas Piggin 86813af51fSJoel Stanleyifdef CONFIG_CC_IS_CLANG 87813af51fSJoel StanleyBOOTCFLAGS += $(CLANG_FLAGS) 88813af51fSJoel StanleyBOOTAFLAGS += $(CLANG_FLAGS) 89813af51fSJoel Stanleyendif 90813af51fSJoel Stanley 91105c13ddSGrant Likelyifdef CONFIG_DEBUG_INFO 92105c13ddSGrant LikelyBOOTCFLAGS += -g 93105c13ddSGrant Likelyendif 94105c13ddSGrant Likely 95fda7ffd2SNiels Kristian Bech Jensenifeq ($(call cc-option-yn, -fstack-protector),y) 96fda7ffd2SNiels Kristian Bech JensenBOOTCFLAGS += -fno-stack-protector 97fda7ffd2SNiels Kristian Bech Jensenendif 98fda7ffd2SNiels Kristian Bech Jensen 991619b69eSMichael EllermanBOOTCFLAGS += -include $(srctree)/include/linux/compiler_attributes.h 10058ab5e0cSArnd BergmannBOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) 10194b212c2SPaul Mackerras 10263849340SDirk BrandewieDTC_FLAGS ?= -p 1024 1039d4ae9fcSKumar Gala 1041b7898eeSOliver O'Halloran# The pre-boot decompressors pull in a lot of kernel headers and other source 1051b7898eeSOliver O'Halloran# files. This creates a bit of a dependency headache since we need to copy 1061b7898eeSOliver O'Halloran# these files into the build dir, fix up any includes and ensure that dependent 1071b7898eeSOliver O'Halloran# files are copied in the right order. 1081b7898eeSOliver O'Halloran 1090ddbbb89SBjorn Helgaas# these need to be separate variables because they are copied out of different 1100ddbbb89SBjorn Helgaas# directories in the kernel tree. Sure you COULD merge them, but it's a 1111b7898eeSOliver O'Halloran# cure-is-worse-than-disease situation. 1121b7898eeSOliver O'Halloranzlib-decomp-$(CONFIG_KERNEL_GZIP) := decompress_inflate.c 11322750d98SOliver O'Halloranzlib-$(CONFIG_KERNEL_GZIP) := inffast.c inflate.c inftrees.c 11422750d98SOliver O'Halloranzlibheader-$(CONFIG_KERNEL_GZIP) := inffast.h inffixed.h inflate.h inftrees.h infutil.h 11522750d98SOliver O'Halloranzliblinuxheader-$(CONFIG_KERNEL_GZIP) := zlib.h zconf.h zutil.h 1166bbc5476SHugh Blemings 1171b7898eeSOliver O'Halloran$(addprefix $(obj)/, decompress.o): \ 1181b7898eeSOliver O'Halloran $(addprefix $(obj)/,$(zlib-decomp-y)) 1191b7898eeSOliver O'Halloran 1201b7898eeSOliver O'Halloran$(addprefix $(obj)/, $(zlib-decomp-y)): \ 1211b7898eeSOliver O'Halloran $(addprefix $(obj)/,$(zliblinuxheader-y)) \ 1221b7898eeSOliver O'Halloran $(addprefix $(obj)/,$(zlibheader-y)) \ 1231b7898eeSOliver O'Halloran $(addprefix $(obj)/,$(zlib-y)) 1241b7898eeSOliver O'Halloran 1251b7898eeSOliver O'Halloran$(addprefix $(obj)/,$(zlib-y)): \ 12622750d98SOliver O'Halloran $(addprefix $(obj)/,$(zliblinuxheader-y)) \ 12722750d98SOliver O'Halloran $(addprefix $(obj)/,$(zlibheader-y)) 1282bf11819SPaul Mackerras 1299fffb55fSDavid Gibsonlibfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 1309fffb55fSDavid Gibsonlibfdtheader := fdt.h libfdt.h libfdt_internal.h 1319fffb55fSDavid Gibson 13264c3f648SGuenter Roeck$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o \ 13364c3f648SGuenter Roeck treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o): \ 1349fffb55fSDavid Gibson $(addprefix $(obj)/,$(libfdtheader)) 1359fffb55fSDavid Gibson 1367c868b66SNicholas Pigginsrc-wlib-y := string.S crt0.S stdio.c decompress.c main.c \ 1379fffb55fSDavid Gibson $(libfdt) libfdt-wrapper.c \ 138ad9d2716SDavid Gibson ns16550.c serial.c simple_alloc.c div64.S util.S \ 1391b7898eeSOliver O'Halloran elf_util.c $(zlib-y) devtree.c stdlib.c \ 140c3bb690dSMichael Ellerman oflib.c ofconsole.c cuboot.c 141f8e8e69cSMichael Ellerman 142e5eff896SMichael Ellermansrc-wlib-$(CONFIG_PPC_MPC52xx) += mpc52xx-psc.c 1436ffeb56eSCédric Le Goatersrc-wlib-$(CONFIG_PPC_POWERNV) += opal-calls.S opal.c 1447c868b66SNicholas Pigginifndef CONFIG_PPC64_BOOT_WRAPPER 1457c868b66SNicholas Pigginsrc-wlib-y += crtsavres.S 1467c868b66SNicholas Pigginendif 147b81f18e5STony Breedssrc-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c 148968159c0SChristophe Leroysrc-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c 149b81f18e5STony Breedssrc-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c 150297f8314SMark Greersrc-wlib-$(CONFIG_EMBEDDED6xx) += ugecon.c fsl-soc.c 151c3bb690dSMichael Ellermansrc-wlib-$(CONFIG_CPM) += cpm-serial.c 152b81f18e5STony Breeds 1530c9fa291SBenjamin Herrenschmidtsrc-plat-y := of.c epapr.c 154b81f18e5STony Breedssrc-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ 155b81f18e5STony Breeds cuboot-bamboo.c cuboot-sam440ep.c \ 156b81f18e5STony Breeds cuboot-sequoia.c cuboot-rainier.c \ 157b81f18e5STony Breeds cuboot-taishan.c cuboot-katmai.c \ 158b81f18e5STony Breeds cuboot-warp.c cuboot-yosemite.c \ 159b81f18e5STony Breeds treeboot-iss4xx.c treeboot-currituck.c \ 1602a2c74b2SAlistair Popple treeboot-akebono.c \ 1617ade8495SMichal Simek simpleboot.c fixed-head.S 162968159c0SChristophe Leroysrc-plat-$(CONFIG_PPC_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c 163b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c 164b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c 165b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c 166b81f18e5STony Breedssrc-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c 167f03425a5SPaul Gortmakersrc-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c \ 16892c8c16fSMark Greer gamecube-head.S gamecube.c \ 16992c8c16fSMark Greer wii-head.S wii.c holly.c \ 1703c8464a9SPaul Gortmaker fixed-head.S mvme5100.c 171b81f18e5STony Breedssrc-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c 172b81f18e5STony Breedssrc-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c 1730c9fa291SBenjamin Herrenschmidtsrc-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c 1742d9afb36SCédric Le Goatersrc-plat-$(CONFIG_PPC_PSERIES) += pseries-head.S 1752d9afb36SCédric Le Goatersrc-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S 17697493e2eSAlessio Igor Boganisrc-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c 177b81f18e5STony Breeds 1784a21192eSJoel Stanleysrc-plat-$(CONFIG_PPC_MICROWATT) += fixed-head.S microwatt.c 1794a21192eSJoel Stanley 180b81f18e5STony Breedssrc-wlib := $(sort $(src-wlib-y)) 181b81f18e5STony Breedssrc-plat := $(sort $(src-plat-y)) 182cd197ffcSDavid Gibsonsrc-boot := $(src-wlib) $(src-plat) empty.c 1832bf11819SPaul Mackerras 1842bf11819SPaul Mackerrassrc-boot := $(addprefix $(obj)/, $(src-boot)) 1852bf11819SPaul Mackerrasobj-boot := $(addsuffix .o, $(basename $(src-boot))) 1862bf11819SPaul Mackerrasobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 1872bf11819SPaul Mackerrasobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 1880090e02bSMatthew McClintockobj-plat: $(libfdt) 1892bf11819SPaul Mackerras 1901a13de6dSOliver O'Halloranquiet_cmd_copy_kern_src = COPY $@ 1911a13de6dSOliver O'Halloran cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@ 19294b212c2SPaul Mackerras 19322750d98SOliver O'Halloran$(addprefix $(obj)/,$(zlib-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 1941a13de6dSOliver O'Halloran $(call cmd,copy_kern_src) 19594b212c2SPaul Mackerras 19622750d98SOliver O'Halloran$(addprefix $(obj)/,$(zlibheader-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 1971a13de6dSOliver O'Halloran $(call cmd,copy_kern_src) 19894b212c2SPaul Mackerras 19922750d98SOliver O'Halloran$(addprefix $(obj)/,$(zliblinuxheader-y)): $(obj)/%: $(srctree)/include/linux/% 2001a13de6dSOliver O'Halloran $(call cmd,copy_kern_src) 20194b212c2SPaul Mackerras 2021b7898eeSOliver O'Halloran$(addprefix $(obj)/,$(zlib-decomp-y)): $(obj)/%: $(srctree)/lib/% 2031b7898eeSOliver O'Halloran $(call cmd,copy_kern_src) 2041b7898eeSOliver O'Halloran 2059fffb55fSDavid Gibsonquiet_cmd_copy_libfdt = COPY $@ 2069fffb55fSDavid Gibson cmd_copy_libfdt = cp $< $@ 2079fffb55fSDavid Gibson 2089fffb55fSDavid Gibson$(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% 2099fffb55fSDavid Gibson $(call cmd,copy_libfdt) 2109fffb55fSDavid Gibson 2112bf11819SPaul Mackerras$(obj)/empty.c: 2126abe248eSMichael Ellerman $(Q)touch $@ 21394b212c2SPaul Mackerras 214b1992c37SMasahiro Yamada$(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(src)/%.S 2156abe248eSMichael Ellerman $(Q)cp $< $@ 2162bf11819SPaul Mackerras 21722750d98SOliver O'Halloranclean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \ 2181b7898eeSOliver O'Halloran $(zlib-decomp-) $(libfdt) $(libfdtheader) \ 2194ba7f80fSMasahiro Yamada empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 22094b212c2SPaul Mackerras 22194b212c2SPaul Mackerrasquiet_cmd_bootcc = BOOTCC $@ 222d1b7d40dSNicholas Piggin cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTCFLAGS) -c -o $@ $< 22394b212c2SPaul Mackerras 22494b212c2SPaul Mackerrasquiet_cmd_bootas = BOOTAS $@ 225d1b7d40dSNicholas Piggin cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTAFLAGS) -c -o $@ $< 22694b212c2SPaul Mackerras 2272bf11819SPaul Mackerrasquiet_cmd_bootar = BOOTAR $@ 228afa974b7SMasahiro Yamada cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@ 22994b212c2SPaul Mackerras 2309fffb55fSDavid Gibson$(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE 2319fffb55fSDavid Gibson $(call if_changed_dep,bootcc) 232235fd835SMilton Miller$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE 2332f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 23494b212c2SPaul Mackerras $(call if_changed_dep,bootcc) 235235fd835SMilton Miller$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE 2362f0dfeaaSDavid Gibson $(Q)mkdir -p $(dir $@) 23794b212c2SPaul Mackerras $(call if_changed_dep,bootas) 23894b212c2SPaul Mackerras 239235fd835SMilton Miller$(obj)/wrapper.a: $(obj-wlib) FORCE 240235fd835SMilton Miller $(call if_changed,bootar) 24194b212c2SPaul Mackerras 2425f2fb52fSMasahiro Yamadahostprogs := addnote hack-coff mktree 24366a45dd3SPaul Mackerras 244710e6822SNicholas Piggintargets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) zImage.lds 245cd197ffcSDavid Gibsonextra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 246bafdb645SGeoff Levand $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds 24794b212c2SPaul Mackerras 248b1992c37SMasahiro Yamadadtstree := $(src)/dts 24925431333SGrant Likely 250b1992c37SMasahiro Yamadawrapper := $(src)/wrapper 2519fffb55fSDavid Gibsonwrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ 252235fd835SMilton Miller $(wrapper) FORCE 25394b212c2SPaul Mackerras 2542bf11819SPaul Mackerras############# 2552bf11819SPaul Mackerras# Bits for building various flavours of zImage 25694b212c2SPaul Mackerras 2572bf11819SPaul Mackerrasifneq ($(CROSS32_COMPILE),) 258dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS32_COMPILE)" 2592bf11819SPaul Mackerraselse 2602bf11819SPaul Mackerrasifneq ($(CROSS_COMPILE),) 261dcf90651SMichael EllermanCROSSWRAP := -C "$(CROSS_COMPILE)" 2622bf11819SPaul Mackerrasendif 2632bf11819SPaul Mackerrasendif 26494b212c2SPaul Mackerras 265f1e510bbSOliver O'Hallorancompressor-$(CONFIG_KERNEL_GZIP) := gz 266c762c69eSOliver O'Hallorancompressor-$(CONFIG_KERNEL_XZ) := xz 2671cc9a21bSChristophe Leroycompressor-$(CONFIG_KERNEL_LZMA) := lzma 268264bffadSChristophe Leroycompressor-$(CONFIG_KERNEL_LZO) := lzo 269f1e510bbSOliver O'Halloran 2709da82a6dSMilton Miller# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd 2712bf11819SPaul Mackerrasquiet_cmd_wrap = WRAP $@ 272f1e510bbSOliver O'Halloran cmd_wrap =$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \ 273f1e510bbSOliver O'Halloran $(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \ 274f1e510bbSOliver O'Halloran vmlinux 2752bf11819SPaul Mackerras 2762bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PSERIES) += zImage.pseries 27755190f88SBenjamin Herrenschmidtimage-$(CONFIG_PPC_POWERNV) += zImage.pseries 278595be948SGrant Likelyimage-$(CONFIG_PPC_PS3) += dtbImage.ps3 2792bf11819SPaul Mackerrasimage-$(CONFIG_PPC_CHRP) += zImage.chrp 2807839af33SNicolas DETimage-$(CONFIG_PPC_EFIKA) += zImage.chrp 2812bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.pmac 28232dde0f9SJosh Boyerimage-$(CONFIG_PPC_HOLLY) += dtbImage.holly 283ac18c673SScott Woodimage-$(CONFIG_DEFAULT_UIMAGE) += uImage 2846c5b59b9SDavid Gibsonimage-$(CONFIG_EPAPR_BOOT) += zImage.epapr 285ac18c673SScott Wood 28625431333SGrant Likely# 28725431333SGrant Likely# Targets which embed a device tree blob 28825431333SGrant Likely# 28925431333SGrant Likely# Theses are default targets to build images which embed device tree blobs. 29025431333SGrant Likely# They are only required on boards which do not have FDT support in firmware. 2912a94739cSNick Andrew# Boards with newish u-boot firmware can use the uImage target above 29225431333SGrant Likely# 29325431333SGrant Likely 29425431333SGrant Likely# Board ports in arch/powerpc/platform/44x/Kconfig 295f6dfc805SDavid Gibsonimage-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 296658e8170SJosh Boyerimage-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo 297b6014e15SGiuseppe Covielloimage-$(CONFIG_SAM440EP) += cuImage.sam440ep 298606d08bcSValentine Barshakimage-$(CONFIG_SEQUOIA) += cuImage.sequoia 299295e7427SValentine Barshakimage-$(CONFIG_RAINIER) += cuImage.rainier 3006bbc5476SHugh Blemingsimage-$(CONFIG_TAISHAN) += cuImage.taishan 3013de9c9cdSBenjamin Herrenschmidtimage-$(CONFIG_KATMAI) += cuImage.katmai 3021e12f3c5SSean MacLennanimage-$(CONFIG_WARP) += cuImage.warp 303d0a48c9fSJosh Boyerimage-$(CONFIG_YOSEMITE) += cuImage.yosemite 304b4e8c8ddSTorez Smithimage-$(CONFIG_ISS4xx) += treeImage.iss4xx \ 305b4e8c8ddSTorez Smith treeImage.iss4xx-mpic 306228d5505STony Breedsimage-$(CONFIG_CURRITUCK) += treeImage.currituck 3072a2c74b2SAlistair Poppleimage-$(CONFIG_AKEBONO) += treeImage.akebono 30894b212c2SPaul Mackerras 30925431333SGrant Likely# Board ports in arch/powerpc/platform/8xx/Kconfig 310efa58fbfSAdrian Bunkimage-$(CONFIG_MPC86XADS) += cuImage.mpc866ads 311efa58fbfSAdrian Bunkimage-$(CONFIG_MPC885ADS) += cuImage.mpc885ads 312595be948SGrant Likelyimage-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc 31325431333SGrant Likelyimage-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \ 314595be948SGrant Likely dtbImage.adder875-redboot 31525431333SGrant Likely 31625431333SGrant Likely# Board ports in arch/powerpc/platform/52xx/Kconfig 3171acf1cf8SRob Herringimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 3181acf1cf8SRob Herringimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b 3191acf1cf8SRob Herringimage-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 32025431333SGrant Likely 32125431333SGrant Likely# Board ports in arch/powerpc/platform/82xx/Kconfig 322595be948SGrant Likelyimage-$(CONFIG_EP8248E) += dtbImage.ep8248e 32325431333SGrant Likely 32425431333SGrant Likely# Board ports in arch/powerpc/platform/83xx/Kconfig 32525431333SGrant Likelyimage-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb 32625431333SGrant Likelyimage-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \ 32725431333SGrant Likely cuImage.mpc8349emitxgp 32859d13f9dSBryan O'Donoghueimage-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot 32925431333SGrant Likely 33025431333SGrant Likely# Board ports in arch/powerpc/platform/85xx/Kconfig 33125431333SGrant Likelyimage-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 33225431333SGrant Likelyimage-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 33325431333SGrant Likely cuImage.mpc8572ds 33425431333SGrant Likelyimage-$(CONFIG_TQM8540) += cuImage.tqm8540 33525431333SGrant Likelyimage-$(CONFIG_TQM8541) += cuImage.tqm8541 3366dd1b64aSWolfgang Grandeggerimage-$(CONFIG_TQM8548) += cuImage.tqm8548 33725431333SGrant Likelyimage-$(CONFIG_TQM8555) += cuImage.tqm8555 33825431333SGrant Likelyimage-$(CONFIG_TQM8560) += cuImage.tqm8560 339ff880112SAlexandr Smirnovimage-$(CONFIG_KSI8560) += cuImage.ksi8560 34025431333SGrant Likely 34197493e2eSAlessio Igor Bogani# Board ports in arch/powerpc/platform/86xx/Kconfig 34297493e2eSAlessio Igor Boganiimage-$(CONFIG_MVME7100) += dtbImage.mvme7100 34397493e2eSAlessio Igor Bogani 34425431333SGrant Likely# Board ports in arch/powerpc/platform/embedded6xx/Kconfig 34525431333SGrant Likelyimage-$(CONFIG_STORCENTER) += cuImage.storcenter 346b68a24bcSAlbert Herranzimage-$(CONFIG_GAMECUBE) += dtbImage.gamecube 3476cdd2417SAlbert Herranzimage-$(CONFIG_WII) += dtbImage.wii 348be201981SStephen Chiversimage-$(CONFIG_MVME5100) += dtbImage.mvme5100 349b09c1644SScott Wood 3508f23735dSGerhard Pircher# Board port in arch/powerpc/platform/amigaone/Kconfig 3518f23735dSGerhard Pircherimage-$(CONFIG_AMIGAONE) += cuImage.amigaone 3528f23735dSGerhard Pircher 3534a21192eSJoel Stanleyimage-$(CONFIG_PPC_MICROWATT) += dtbImage.microwatt 3544a21192eSJoel Stanley 3559216ad8cSPaul Mackerras# For 32-bit powermacs, build the COFF and miboot images 3569216ad8cSPaul Mackerras# as well as the ELF images. 357badf436fSRodrigo R. Galvaoifdef CONFIG_PPC32 3582bf11819SPaul Mackerrasimage-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot 3592bf11819SPaul Mackerrasendif 36066a45dd3SPaul Mackerras 361c356aa45SGrant Likely# Allow extra targets to be added to the defconfig 362129ab0d2SMasahiro Yamadaimage-y += $(CONFIG_EXTRA_TARGETS) 363c356aa45SGrant Likely 364755457f9SMichal Marekinitrd- := $(patsubst zImage%, zImage.initrd%, $(image-)) 365f6dfc805SDavid Gibsoninitrd-y := $(patsubst zImage%, zImage.initrd%, \ 366595be948SGrant Likely $(patsubst dtbImage%, dtbImage.initrd%, \ 3675d1a0411SJohn Linn $(patsubst simpleImage%, simpleImage.initrd%, \ 3685d1a0411SJohn Linn $(patsubst treeImage%, treeImage.initrd%, $(image-y))))) 3699da82a6dSMilton Millerinitrd-y := $(filter-out $(image-y), $(initrd-y)) 370235fd835SMilton Millertargets += $(image-y) $(initrd-y) 3711bca5440SMasahiro Yamadatargets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ 3721bca5440SMasahiro Yamada $(patsubst $(x).%, dts/%.dtb, $(filter $(x).%, $(image-y)))) 373b36f835bSMichael Ellermantargets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ 374b36f835bSMichael Ellerman $(patsubst $(x).%, dts/fsl/%.dtb, $(filter $(x).%, $(image-y)))) 37594b212c2SPaul Mackerras 3769da82a6dSMilton Miller$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz 3779da82a6dSMilton Miller 3789da82a6dSMilton Miller# Don't put the ramdisk on the pattern rule; when its missing make will try 3799da82a6dSMilton Miller# the pattern rule with less dependencies that also matches (even with the 3809da82a6dSMilton Miller# hard dependency listed). 38142d0c932SMichael Ellerman$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) FORCE 38225431333SGrant Likely $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) 3839da82a6dSMilton Miller 38442d0c932SMichael Ellerman$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits) FORCE 385699c659bSMichal Marek $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@)) 38625431333SGrant Likely 387595be948SGrant Likely# dtbImage% - a dtbImage is a zImage with an embedded device tree blob 3881acf1cf8SRob Herring$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE 3891acf1cf8SRob Herring $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 39025431333SGrant Likely 3911acf1cf8SRob Herring$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE 3921acf1cf8SRob Herring $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb) 3939da82a6dSMilton Miller 3944bb09281STony Breeds# This cannot be in the root of $(src) as the zImage rule always adds a $(obj) 3954bb09281STony Breeds# prefix 3964bb09281STony Breeds$(obj)/vmlinux.strip: vmlinux 3974bb09281STony Breeds $(STRIP) -s -R .comment $< -o $@ 3984bb09281STony Breeds 39942d0c932SMichael Ellerman$(obj)/uImage: vmlinux $(wrapperbits) FORCE 4009da82a6dSMilton Miller $(call if_changed,wrap,uboot) 4019da82a6dSMilton Miller 4021acf1cf8SRob Herring$(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4031acf1cf8SRob Herring $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 40411eab297SBenjamin Herrenschmidt 4051acf1cf8SRob Herring$(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4061acf1cf8SRob Herring $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb) 40711eab297SBenjamin Herrenschmidt 4081acf1cf8SRob Herring$(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4091acf1cf8SRob Herring $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 410a4292d7aSGrant Likely 4111acf1cf8SRob Herring$(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4121acf1cf8SRob Herring $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb) 4130fdd717eSScott Wood 4141acf1cf8SRob Herring$(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4151acf1cf8SRob Herring $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 416d2477b5cSGrant Likely 4171acf1cf8SRob Herring$(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4181acf1cf8SRob Herring $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb) 419d2477b5cSGrant Likely 4201acf1cf8SRob Herring$(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4211acf1cf8SRob Herring $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 422f6dfc805SDavid Gibson 4231acf1cf8SRob Herring$(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 4241acf1cf8SRob Herring $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb) 425e04018e8SGrant Likely 4261acf1cf8SRob Herring# Needed for the above targets to work with dts/fsl/ files 4271acf1cf8SRob Herring$(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb 4281acf1cf8SRob Herring @cp $< $@ 4294680c9d5SAlessio Igor Bogani 4304bb09281STony Breeds# If there isn't a platform selected then just strip the vmlinux. 4314bb09281STony Breedsifeq (,$(image-y)) 4324bb09281STony Breedsimage-y := vmlinux.strip 4334bb09281STony Breedsendif 4344bb09281STony Breeds 4352bf11819SPaul Mackerras$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 4366abe248eSMichael Ellerman $(Q)rm -f $@; ln $< $@ 4372bf11819SPaul Mackerras$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) 4386abe248eSMichael Ellerman $(Q)rm -f $@; ln $< $@ 43994b212c2SPaul Mackerras 4401383a34fSMilton Miller# anything not in $(targets) 441b58a4575SKumar Galaclean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \ 442b58a4575SKumar Gala zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ 4431b041885SStephen Rothwell zImage.miboot zImage.pmac zImage.pseries \ 444*62f8f307SMichael Ellerman simpleImage.* otheros.bld 4451383a34fSMilton Miller 4461383a34fSMilton Miller# clean up files cached by wrapper 4471b7898eeSOliver O'Halloranclean-kernel-base := vmlinux.strip vmlinux.bin 4481b7898eeSOliver O'Halloranclean-kernel := $(addsuffix .gz,$(clean-kernel-base)) 449c762c69eSOliver O'Halloranclean-kernel += $(addsuffix .xz,$(clean-kernel-base)) 4508d613a1dSMasahiro Yamada# clean-files are relative to $(obj). 4518d613a1dSMasahiro Yamadaclean-files += $(addprefix ../../../, $(clean-kernel)) 452773f76b1SDavid Woodhouse 453773f76b1SDavid WoodhouseWRAPPER_OBJDIR := /usr/lib/kernel-wrapper 454773f76b1SDavid WoodhouseWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts 455773f76b1SDavid WoodhouseWRAPPER_BINDIR := /usr/sbin 456773f76b1SDavid WoodhouseINSTALL := install 457773f76b1SDavid Woodhouse 458773f76b1SDavid Woodhouseextra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) 4595f2fb52fSMasahiro Yamadahostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs)) 460773f76b1SDavid Woodhousewrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper 4614d9ef89dSBen Hutchingsdts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts)) 462773f76b1SDavid Woodhouse 463773f76b1SDavid Woodhouseall-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) 464773f76b1SDavid Woodhouse 465773f76b1SDavid Woodhousequiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 466773f76b1SDavid Woodhouse cmd_mkdir = mkdir -p $@ 467773f76b1SDavid Woodhouse 468773f76b1SDavid Woodhousequiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@) 469773f76b1SDavid Woodhouse cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ 470773f76b1SDavid Woodhouse 471773f76b1SDavid Woodhousequiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@) 472773f76b1SDavid Woodhouse cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ 473773f76b1SDavid Woodhouse 474773f76b1SDavid Woodhousequiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 475773f76b1SDavid Woodhouse cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ 476773f76b1SDavid Woodhouse 477773f76b1SDavid Woodhousequiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 478773f76b1SDavid Woodhouse cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\ 479773f76b1SDavid Woodhouse sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \ 480773f76b1SDavid Woodhouse -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \ 481773f76b1SDavid Woodhouse 482773f76b1SDavid Woodhouse 483773f76b1SDavid Woodhouse$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR): 484773f76b1SDavid Woodhouse $(call cmd,mkdir) 485773f76b1SDavid Woodhouse 486773f76b1SDavid Woodhouse$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR) 487773f76b1SDavid Woodhouse $(call cmd,install) 488773f76b1SDavid Woodhouse 489773f76b1SDavid Woodhouse$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR) 490773f76b1SDavid Woodhouse $(call cmd,install_exe) 491773f76b1SDavid Woodhouse 492773f76b1SDavid Woodhouse$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR) 493773f76b1SDavid Woodhouse $(call cmd,install_dts) 494773f76b1SDavid Woodhouse 495773f76b1SDavid Woodhouse$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR) 496773f76b1SDavid Woodhouse $(call cmd,install_wrapper) 497773f76b1SDavid Woodhouse 498773f76b1SDavid Woodhouse$(obj)/bootwrapper_install: $(all-installed) 499