162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci# Makefile for making ELF bootable images for booting on CHRP 362306a36Sopenharmony_ci# using Open Firmware. 462306a36Sopenharmony_ci# 562306a36Sopenharmony_ci# Geert Uytterhoeven September 1997 662306a36Sopenharmony_ci# 762306a36Sopenharmony_ci# Based on coffboot by Paul Mackerras 862306a36Sopenharmony_ci# Simplified for ppc64 by Todd Inglett 962306a36Sopenharmony_ci# 1062306a36Sopenharmony_ci# NOTE: this code may be built for 32 bit in ELF32 format even though 1162306a36Sopenharmony_ci# it packages a 64 bit kernel. We do this to simplify the 1262306a36Sopenharmony_ci# bootloader and increase compatibility with OpenFirmware. 1362306a36Sopenharmony_ci# 1462306a36Sopenharmony_ci# To this end we need to define BOOTCC, etc, as the tools 1562306a36Sopenharmony_ci# needed to build the 32 bit image. That's normally the same 1662306a36Sopenharmony_ci# compiler for the rest of the kernel, with the -m32 flag added. 1762306a36Sopenharmony_ci# To make it easier to setup a cross compiler, 1862306a36Sopenharmony_ci# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE 1962306a36Sopenharmony_ci# in the toplevel makefile. 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ciall: $(obj)/zImage 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciifdef CROSS32_COMPILE 2462306a36Sopenharmony_ciifdef CONFIG_CC_IS_CLANG 2562306a36Sopenharmony_ci BOOTCC := $(CROSS32_COMPILE)clang 2662306a36Sopenharmony_cielse 2762306a36Sopenharmony_ci BOOTCC := $(CROSS32_COMPILE)gcc 2862306a36Sopenharmony_ciendif 2962306a36Sopenharmony_ci BOOTAR := $(CROSS32_COMPILE)ar 3062306a36Sopenharmony_cielse 3162306a36Sopenharmony_ci BOOTCC := $(CC) 3262306a36Sopenharmony_ci BOOTAR := $(AR) 3362306a36Sopenharmony_ciendif 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciifdef CONFIG_PPC64_BOOT_WRAPPER 3662306a36Sopenharmony_ciBOOTTARGETFLAGS += -m64 3762306a36Sopenharmony_ciBOOTTARGETFLAGS += -mabi=elfv2 3862306a36Sopenharmony_ciifdef CONFIG_PPC64_ELF_ABI_V2 3962306a36Sopenharmony_ciBOOTTARGETFLAGS += $(call cc-option,-mabi=elfv2) 4062306a36Sopenharmony_ciendif 4162306a36Sopenharmony_cielse 4262306a36Sopenharmony_ciBOOTTARGETFLAGS := -m32 4362306a36Sopenharmony_ciendif 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ciifdef CONFIG_TARGET_CPU_BOOL 4662306a36Sopenharmony_ciBOOTTARGETFLAGS += -mcpu=$(CONFIG_TARGET_CPU) 4762306a36Sopenharmony_cielse ifdef CONFIG_PPC64_BOOT_WRAPPER 4862306a36Sopenharmony_ciifdef CONFIG_CPU_LITTLE_ENDIAN 4962306a36Sopenharmony_ciBOOTTARGETFLAGS += -mcpu=powerpc64le 5062306a36Sopenharmony_cielse 5162306a36Sopenharmony_ciBOOTTARGETFLAGS += -mcpu=powerpc64 5262306a36Sopenharmony_ciendif 5362306a36Sopenharmony_ciendif 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci$(obj)/4xx.o: BOOTTARGETFLAGS += -mcpu=405 5662306a36Sopenharmony_ci$(obj)/ebony.o: BOOTTARGETFLAGS += -mcpu=440 5762306a36Sopenharmony_ci$(obj)/cuboot-hotfoot.o: BOOTTARGETFLAGS += -mcpu=405 5862306a36Sopenharmony_ci$(obj)/cuboot-taishan.o: BOOTTARGETFLAGS += -mcpu=440 5962306a36Sopenharmony_ci$(obj)/cuboot-katmai.o: BOOTTARGETFLAGS += -mcpu=440 6062306a36Sopenharmony_ci$(obj)/cuboot-acadia.o: BOOTTARGETFLAGS += -mcpu=405 6162306a36Sopenharmony_ci$(obj)/treeboot-iss4xx.o: BOOTTARGETFLAGS += -mcpu=405 6262306a36Sopenharmony_ci$(obj)/treeboot-currituck.o: BOOTTARGETFLAGS += -mcpu=405 6362306a36Sopenharmony_ci$(obj)/treeboot-akebono.o: BOOTTARGETFLAGS += -mcpu=405 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ciifdef CONFIG_CPU_BIG_ENDIAN 6662306a36Sopenharmony_ciBOOTTARGETFLAGS += -mbig-endian 6762306a36Sopenharmony_cielse 6862306a36Sopenharmony_ciBOOTTARGETFLAGS += -mlittle-endian 6962306a36Sopenharmony_ciendif 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ciBOOTCPPFLAGS := -nostdinc $(LINUXINCLUDE) 7262306a36Sopenharmony_ciBOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ciBOOTCFLAGS := $(BOOTTARGETFLAGS) \ 7562306a36Sopenharmony_ci -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 7662306a36Sopenharmony_ci -fno-strict-aliasing -O2 \ 7762306a36Sopenharmony_ci -msoft-float -mno-altivec -mno-vsx \ 7862306a36Sopenharmony_ci $(call cc-option,-mno-prefixed) \ 7962306a36Sopenharmony_ci $(call cc-option,-mno-pcrel) \ 8062306a36Sopenharmony_ci $(call cc-option,-mno-mma) \ 8162306a36Sopenharmony_ci $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ 8262306a36Sopenharmony_ci -fomit-frame-pointer -fno-builtin -fPIC 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ciBOOTAFLAGS := $(BOOTTARGETFLAGS) -D__ASSEMBLY__ 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ciBOOTARFLAGS := -crD 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ciifdef CONFIG_CC_IS_CLANG 8962306a36Sopenharmony_ciBOOTCFLAGS += $(CLANG_FLAGS) 9062306a36Sopenharmony_ciBOOTAFLAGS += $(CLANG_FLAGS) 9162306a36Sopenharmony_ciendif 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ciifdef CONFIG_DEBUG_INFO 9462306a36Sopenharmony_ciBOOTCFLAGS += -g 9562306a36Sopenharmony_ciendif 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ciifeq ($(call cc-option-yn, -fstack-protector),y) 9862306a36Sopenharmony_ciBOOTCFLAGS += -fno-stack-protector 9962306a36Sopenharmony_ciendif 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ciBOOTCFLAGS += -include $(srctree)/include/linux/compiler_attributes.h 10262306a36Sopenharmony_ciBOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ciDTC_FLAGS ?= -p 1024 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci# The pre-boot decompressors pull in a lot of kernel headers and other source 10762306a36Sopenharmony_ci# files. This creates a bit of a dependency headache since we need to copy 10862306a36Sopenharmony_ci# these files into the build dir, fix up any includes and ensure that dependent 10962306a36Sopenharmony_ci# files are copied in the right order. 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci# these need to be seperate variables because they are copied out of different 11262306a36Sopenharmony_ci# directories in the kernel tree. Sure you COULd merge them, but it's a 11362306a36Sopenharmony_ci# cure-is-worse-than-disease situation. 11462306a36Sopenharmony_cizlib-decomp-$(CONFIG_KERNEL_GZIP) := decompress_inflate.c 11562306a36Sopenharmony_cizlib-$(CONFIG_KERNEL_GZIP) := inffast.c inflate.c inftrees.c 11662306a36Sopenharmony_cizlibheader-$(CONFIG_KERNEL_GZIP) := inffast.h inffixed.h inflate.h inftrees.h infutil.h 11762306a36Sopenharmony_cizliblinuxheader-$(CONFIG_KERNEL_GZIP) := zlib.h zconf.h zutil.h 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci$(addprefix $(obj)/, decompress.o): \ 12062306a36Sopenharmony_ci $(addprefix $(obj)/,$(zlib-decomp-y)) 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci$(addprefix $(obj)/, $(zlib-decomp-y)): \ 12362306a36Sopenharmony_ci $(addprefix $(obj)/,$(zliblinuxheader-y)) \ 12462306a36Sopenharmony_ci $(addprefix $(obj)/,$(zlibheader-y)) \ 12562306a36Sopenharmony_ci $(addprefix $(obj)/,$(zlib-y)) 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci$(addprefix $(obj)/,$(zlib-y)): \ 12862306a36Sopenharmony_ci $(addprefix $(obj)/,$(zliblinuxheader-y)) \ 12962306a36Sopenharmony_ci $(addprefix $(obj)/,$(zlibheader-y)) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_cilibfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 13262306a36Sopenharmony_cilibfdtheader := fdt.h libfdt.h libfdt_internal.h 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o \ 13562306a36Sopenharmony_ci treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o): \ 13662306a36Sopenharmony_ci $(addprefix $(obj)/,$(libfdtheader)) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_cisrc-wlib-y := string.S crt0.S stdio.c decompress.c main.c \ 13962306a36Sopenharmony_ci $(libfdt) libfdt-wrapper.c \ 14062306a36Sopenharmony_ci ns16550.c serial.c simple_alloc.c div64.S util.S \ 14162306a36Sopenharmony_ci elf_util.c $(zlib-y) devtree.c stdlib.c \ 14262306a36Sopenharmony_ci oflib.c ofconsole.c cuboot.c 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_cisrc-wlib-$(CONFIG_PPC_MPC52xx) += mpc52xx-psc.c 14562306a36Sopenharmony_cisrc-wlib-$(CONFIG_PPC_POWERNV) += opal-calls.S opal.c 14662306a36Sopenharmony_ciifndef CONFIG_PPC64_BOOT_WRAPPER 14762306a36Sopenharmony_cisrc-wlib-y += crtsavres.S 14862306a36Sopenharmony_ciendif 14962306a36Sopenharmony_cisrc-wlib-$(CONFIG_40x) += 4xx.c planetcore.c 15062306a36Sopenharmony_cisrc-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c 15162306a36Sopenharmony_cisrc-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c 15262306a36Sopenharmony_cisrc-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c 15362306a36Sopenharmony_cisrc-wlib-$(CONFIG_EMBEDDED6xx) += ugecon.c fsl-soc.c 15462306a36Sopenharmony_cisrc-wlib-$(CONFIG_CPM) += cpm-serial.c 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_cisrc-plat-y := of.c epapr.c 15762306a36Sopenharmony_cisrc-plat-$(CONFIG_40x) += fixed-head.S cuboot-hotfoot.c \ 15862306a36Sopenharmony_ci cuboot-acadia.c \ 15962306a36Sopenharmony_ci cuboot-kilauea.c simpleboot.c 16062306a36Sopenharmony_cisrc-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ 16162306a36Sopenharmony_ci cuboot-bamboo.c cuboot-sam440ep.c \ 16262306a36Sopenharmony_ci cuboot-sequoia.c cuboot-rainier.c \ 16362306a36Sopenharmony_ci cuboot-taishan.c cuboot-katmai.c \ 16462306a36Sopenharmony_ci cuboot-warp.c cuboot-yosemite.c \ 16562306a36Sopenharmony_ci treeboot-iss4xx.c treeboot-currituck.c \ 16662306a36Sopenharmony_ci treeboot-akebono.c \ 16762306a36Sopenharmony_ci simpleboot.c fixed-head.S 16862306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c 16962306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c 17062306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c 17162306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c 17262306a36Sopenharmony_cisrc-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c 17362306a36Sopenharmony_cisrc-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c \ 17462306a36Sopenharmony_ci gamecube-head.S gamecube.c \ 17562306a36Sopenharmony_ci wii-head.S wii.c holly.c \ 17662306a36Sopenharmony_ci fixed-head.S mvme5100.c 17762306a36Sopenharmony_cisrc-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c 17862306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c 17962306a36Sopenharmony_cisrc-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c 18062306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_PSERIES) += pseries-head.S 18162306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S 18262306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S 18362306a36Sopenharmony_cisrc-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_cisrc-plat-$(CONFIG_PPC_MICROWATT) += fixed-head.S microwatt.c 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_cisrc-wlib := $(sort $(src-wlib-y)) 18862306a36Sopenharmony_cisrc-plat := $(sort $(src-plat-y)) 18962306a36Sopenharmony_cisrc-boot := $(src-wlib) $(src-plat) empty.c 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_cisrc-boot := $(addprefix $(obj)/, $(src-boot)) 19262306a36Sopenharmony_ciobj-boot := $(addsuffix .o, $(basename $(src-boot))) 19362306a36Sopenharmony_ciobj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 19462306a36Sopenharmony_ciobj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 19562306a36Sopenharmony_ciobj-plat: $(libfdt) 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ciquiet_cmd_copy_kern_src = COPY $@ 19862306a36Sopenharmony_ci cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@ 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci$(addprefix $(obj)/,$(zlib-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 20162306a36Sopenharmony_ci $(call cmd,copy_kern_src) 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci$(addprefix $(obj)/,$(zlibheader-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/% 20462306a36Sopenharmony_ci $(call cmd,copy_kern_src) 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci$(addprefix $(obj)/,$(zliblinuxheader-y)): $(obj)/%: $(srctree)/include/linux/% 20762306a36Sopenharmony_ci $(call cmd,copy_kern_src) 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci$(addprefix $(obj)/,$(zlib-decomp-y)): $(obj)/%: $(srctree)/lib/% 21062306a36Sopenharmony_ci $(call cmd,copy_kern_src) 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ciquiet_cmd_copy_libfdt = COPY $@ 21362306a36Sopenharmony_ci cmd_copy_libfdt = cp $< $@ 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci$(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% 21662306a36Sopenharmony_ci $(call cmd,copy_libfdt) 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci$(obj)/empty.c: 21962306a36Sopenharmony_ci $(Q)touch $@ 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci$(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S 22262306a36Sopenharmony_ci $(Q)cp $< $@ 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ciclean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \ 22562306a36Sopenharmony_ci $(zlib-decomp-) $(libfdt) $(libfdtheader) \ 22662306a36Sopenharmony_ci empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ciquiet_cmd_bootcc = BOOTCC $@ 22962306a36Sopenharmony_ci cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTCFLAGS) -c -o $@ $< 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ciquiet_cmd_bootas = BOOTAS $@ 23262306a36Sopenharmony_ci cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTAFLAGS) -c -o $@ $< 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ciquiet_cmd_bootar = BOOTAR $@ 23562306a36Sopenharmony_ci cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@ 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci$(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE 23862306a36Sopenharmony_ci $(call if_changed_dep,bootcc) 23962306a36Sopenharmony_ci$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE 24062306a36Sopenharmony_ci $(Q)mkdir -p $(dir $@) 24162306a36Sopenharmony_ci $(call if_changed_dep,bootcc) 24262306a36Sopenharmony_ci$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE 24362306a36Sopenharmony_ci $(Q)mkdir -p $(dir $@) 24462306a36Sopenharmony_ci $(call if_changed_dep,bootas) 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci$(obj)/wrapper.a: $(obj-wlib) FORCE 24762306a36Sopenharmony_ci $(call if_changed,bootar) 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_cihostprogs := addnote hack-coff mktree 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_citargets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) zImage.lds 25262306a36Sopenharmony_ciextra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 25362306a36Sopenharmony_ci $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_cidtstree := $(srctree)/$(src)/dts 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ciwrapper :=$(srctree)/$(src)/wrapper 25862306a36Sopenharmony_ciwrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ 25962306a36Sopenharmony_ci $(wrapper) FORCE 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ci############# 26262306a36Sopenharmony_ci# Bits for building various flavours of zImage 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ciifneq ($(CROSS32_COMPILE),) 26562306a36Sopenharmony_ciCROSSWRAP := -C "$(CROSS32_COMPILE)" 26662306a36Sopenharmony_cielse 26762306a36Sopenharmony_ciifneq ($(CROSS_COMPILE),) 26862306a36Sopenharmony_ciCROSSWRAP := -C "$(CROSS_COMPILE)" 26962306a36Sopenharmony_ciendif 27062306a36Sopenharmony_ciendif 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_cicompressor-$(CONFIG_KERNEL_GZIP) := gz 27362306a36Sopenharmony_cicompressor-$(CONFIG_KERNEL_XZ) := xz 27462306a36Sopenharmony_cicompressor-$(CONFIG_KERNEL_LZMA) := lzma 27562306a36Sopenharmony_cicompressor-$(CONFIG_KERNEL_LZO) := lzo 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci# args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd 27862306a36Sopenharmony_ciquiet_cmd_wrap = WRAP $@ 27962306a36Sopenharmony_ci cmd_wrap =$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \ 28062306a36Sopenharmony_ci $(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \ 28162306a36Sopenharmony_ci vmlinux 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ciimage-$(CONFIG_PPC_PSERIES) += zImage.pseries 28462306a36Sopenharmony_ciimage-$(CONFIG_PPC_POWERNV) += zImage.pseries 28562306a36Sopenharmony_ciimage-$(CONFIG_PPC_MAPLE) += zImage.maple 28662306a36Sopenharmony_ciimage-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries 28762306a36Sopenharmony_ciimage-$(CONFIG_PPC_PS3) += dtbImage.ps3 28862306a36Sopenharmony_ciimage-$(CONFIG_PPC_CHRP) += zImage.chrp 28962306a36Sopenharmony_ciimage-$(CONFIG_PPC_EFIKA) += zImage.chrp 29062306a36Sopenharmony_ciimage-$(CONFIG_PPC_PMAC) += zImage.pmac 29162306a36Sopenharmony_ciimage-$(CONFIG_PPC_HOLLY) += dtbImage.holly 29262306a36Sopenharmony_ciimage-$(CONFIG_DEFAULT_UIMAGE) += uImage 29362306a36Sopenharmony_ciimage-$(CONFIG_EPAPR_BOOT) += zImage.epapr 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci# 29662306a36Sopenharmony_ci# Targets which embed a device tree blob 29762306a36Sopenharmony_ci# 29862306a36Sopenharmony_ci# Theses are default targets to build images which embed device tree blobs. 29962306a36Sopenharmony_ci# They are only required on boards which do not have FDT support in firmware. 30062306a36Sopenharmony_ci# Boards with newish u-boot firmware can use the uImage target above 30162306a36Sopenharmony_ci# 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/40x/Kconfig 30462306a36Sopenharmony_ciimage-$(CONFIG_HOTFOOT) += cuImage.hotfoot 30562306a36Sopenharmony_ciimage-$(CONFIG_ACADIA) += cuImage.acadia 30662306a36Sopenharmony_ciimage-$(CONFIG_OBS600) += uImage.obs600 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/44x/Kconfig 30962306a36Sopenharmony_ciimage-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 31062306a36Sopenharmony_ciimage-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo 31162306a36Sopenharmony_ciimage-$(CONFIG_SAM440EP) += cuImage.sam440ep 31262306a36Sopenharmony_ciimage-$(CONFIG_SEQUOIA) += cuImage.sequoia 31362306a36Sopenharmony_ciimage-$(CONFIG_RAINIER) += cuImage.rainier 31462306a36Sopenharmony_ciimage-$(CONFIG_TAISHAN) += cuImage.taishan 31562306a36Sopenharmony_ciimage-$(CONFIG_KATMAI) += cuImage.katmai 31662306a36Sopenharmony_ciimage-$(CONFIG_WARP) += cuImage.warp 31762306a36Sopenharmony_ciimage-$(CONFIG_YOSEMITE) += cuImage.yosemite 31862306a36Sopenharmony_ciimage-$(CONFIG_ISS4xx) += treeImage.iss4xx \ 31962306a36Sopenharmony_ci treeImage.iss4xx-mpic 32062306a36Sopenharmony_ciimage-$(CONFIG_CURRITUCK) += treeImage.currituck 32162306a36Sopenharmony_ciimage-$(CONFIG_AKEBONO) += treeImage.akebono 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/8xx/Kconfig 32462306a36Sopenharmony_ciimage-$(CONFIG_MPC86XADS) += cuImage.mpc866ads 32562306a36Sopenharmony_ciimage-$(CONFIG_MPC885ADS) += cuImage.mpc885ads 32662306a36Sopenharmony_ciimage-$(CONFIG_PPC_EP88XC) += dtbImage.ep88xc 32762306a36Sopenharmony_ciimage-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \ 32862306a36Sopenharmony_ci dtbImage.adder875-redboot 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/52xx/Kconfig 33162306a36Sopenharmony_ciimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 33262306a36Sopenharmony_ciimage-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b 33362306a36Sopenharmony_ciimage-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/82xx/Kconfig 33662306a36Sopenharmony_ciimage-$(CONFIG_EP8248E) += dtbImage.ep8248e 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/83xx/Kconfig 33962306a36Sopenharmony_ciimage-$(CONFIG_MPC832x_RDB) += cuImage.mpc832x_rdb 34062306a36Sopenharmony_ciimage-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \ 34162306a36Sopenharmony_ci cuImage.mpc8349emitxgp 34262306a36Sopenharmony_ciimage-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot 34362306a36Sopenharmony_ci 34462306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/85xx/Kconfig 34562306a36Sopenharmony_ciimage-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds 34662306a36Sopenharmony_ciimage-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \ 34762306a36Sopenharmony_ci cuImage.mpc8572ds 34862306a36Sopenharmony_ciimage-$(CONFIG_TQM8540) += cuImage.tqm8540 34962306a36Sopenharmony_ciimage-$(CONFIG_TQM8541) += cuImage.tqm8541 35062306a36Sopenharmony_ciimage-$(CONFIG_TQM8548) += cuImage.tqm8548 35162306a36Sopenharmony_ciimage-$(CONFIG_TQM8555) += cuImage.tqm8555 35262306a36Sopenharmony_ciimage-$(CONFIG_TQM8560) += cuImage.tqm8560 35362306a36Sopenharmony_ciimage-$(CONFIG_KSI8560) += cuImage.ksi8560 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/86xx/Kconfig 35662306a36Sopenharmony_ciimage-$(CONFIG_MVME7100) += dtbImage.mvme7100 35762306a36Sopenharmony_ci 35862306a36Sopenharmony_ci# Board ports in arch/powerpc/platform/embedded6xx/Kconfig 35962306a36Sopenharmony_ciimage-$(CONFIG_STORCENTER) += cuImage.storcenter 36062306a36Sopenharmony_ciimage-$(CONFIG_GAMECUBE) += dtbImage.gamecube 36162306a36Sopenharmony_ciimage-$(CONFIG_WII) += dtbImage.wii 36262306a36Sopenharmony_ciimage-$(CONFIG_MVME5100) += dtbImage.mvme5100 36362306a36Sopenharmony_ci 36462306a36Sopenharmony_ci# Board port in arch/powerpc/platform/amigaone/Kconfig 36562306a36Sopenharmony_ciimage-$(CONFIG_AMIGAONE) += cuImage.amigaone 36662306a36Sopenharmony_ci 36762306a36Sopenharmony_ciimage-$(CONFIG_PPC_MICROWATT) += dtbImage.microwatt 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci# For 32-bit powermacs, build the COFF and miboot images 37062306a36Sopenharmony_ci# as well as the ELF images. 37162306a36Sopenharmony_ciifdef CONFIG_PPC32 37262306a36Sopenharmony_ciimage-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot 37362306a36Sopenharmony_ciendif 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci# Allow extra targets to be added to the defconfig 37662306a36Sopenharmony_ciimage-y += $(CONFIG_EXTRA_TARGETS) 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ciinitrd- := $(patsubst zImage%, zImage.initrd%, $(image-)) 37962306a36Sopenharmony_ciinitrd-y := $(patsubst zImage%, zImage.initrd%, \ 38062306a36Sopenharmony_ci $(patsubst dtbImage%, dtbImage.initrd%, \ 38162306a36Sopenharmony_ci $(patsubst simpleImage%, simpleImage.initrd%, \ 38262306a36Sopenharmony_ci $(patsubst treeImage%, treeImage.initrd%, $(image-y))))) 38362306a36Sopenharmony_ciinitrd-y := $(filter-out $(image-y), $(initrd-y)) 38462306a36Sopenharmony_citargets += $(image-y) $(initrd-y) 38562306a36Sopenharmony_citargets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ 38662306a36Sopenharmony_ci $(patsubst $(x).%, dts/%.dtb, $(filter $(x).%, $(image-y)))) 38762306a36Sopenharmony_citargets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ 38862306a36Sopenharmony_ci $(patsubst $(x).%, dts/fsl/%.dtb, $(filter $(x).%, $(image-y)))) 38962306a36Sopenharmony_ci 39062306a36Sopenharmony_ci$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_ci# Don't put the ramdisk on the pattern rule; when its missing make will try 39362306a36Sopenharmony_ci# the pattern rule with less dependencies that also matches (even with the 39462306a36Sopenharmony_ci# hard dependency listed). 39562306a36Sopenharmony_ci$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) FORCE 39662306a36Sopenharmony_ci $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_ci$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits) FORCE 39962306a36Sopenharmony_ci $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@)) 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci# dtbImage% - a dtbImage is a zImage with an embedded device tree blob 40262306a36Sopenharmony_ci$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE 40362306a36Sopenharmony_ci $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_ci$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE 40662306a36Sopenharmony_ci $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb) 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci# This cannot be in the root of $(src) as the zImage rule always adds a $(obj) 40962306a36Sopenharmony_ci# prefix 41062306a36Sopenharmony_ci$(obj)/vmlinux.strip: vmlinux 41162306a36Sopenharmony_ci $(STRIP) -s -R .comment $< -o $@ 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci$(obj)/uImage: vmlinux $(wrapperbits) FORCE 41462306a36Sopenharmony_ci $(call if_changed,wrap,uboot) 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci$(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 41762306a36Sopenharmony_ci $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_ci$(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 42062306a36Sopenharmony_ci $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb) 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ci$(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 42362306a36Sopenharmony_ci $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 42462306a36Sopenharmony_ci 42562306a36Sopenharmony_ci$(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 42662306a36Sopenharmony_ci $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb) 42762306a36Sopenharmony_ci 42862306a36Sopenharmony_ci$(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 42962306a36Sopenharmony_ci $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci$(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 43262306a36Sopenharmony_ci $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb) 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci$(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 43562306a36Sopenharmony_ci $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_ci$(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE 43862306a36Sopenharmony_ci $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb) 43962306a36Sopenharmony_ci 44062306a36Sopenharmony_ci# Needed for the above targets to work with dts/fsl/ files 44162306a36Sopenharmony_ci$(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb 44262306a36Sopenharmony_ci @cp $< $@ 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci# If there isn't a platform selected then just strip the vmlinux. 44562306a36Sopenharmony_ciifeq (,$(image-y)) 44662306a36Sopenharmony_ciimage-y := vmlinux.strip 44762306a36Sopenharmony_ciendif 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_ci$(obj)/zImage: $(addprefix $(obj)/, $(image-y)) 45062306a36Sopenharmony_ci $(Q)rm -f $@; ln $< $@ 45162306a36Sopenharmony_ci$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) 45262306a36Sopenharmony_ci $(Q)rm -f $@; ln $< $@ 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_ci# anything not in $(targets) 45562306a36Sopenharmony_ciclean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \ 45662306a36Sopenharmony_ci zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \ 45762306a36Sopenharmony_ci zImage.miboot zImage.pmac zImage.pseries \ 45862306a36Sopenharmony_ci zImage.maple simpleImage.* otheros.bld 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ci# clean up files cached by wrapper 46162306a36Sopenharmony_ciclean-kernel-base := vmlinux.strip vmlinux.bin 46262306a36Sopenharmony_ciclean-kernel := $(addsuffix .gz,$(clean-kernel-base)) 46362306a36Sopenharmony_ciclean-kernel += $(addsuffix .xz,$(clean-kernel-base)) 46462306a36Sopenharmony_ci# clean-files are relative to $(obj). 46562306a36Sopenharmony_ciclean-files += $(addprefix ../../../, $(clean-kernel)) 46662306a36Sopenharmony_ci 46762306a36Sopenharmony_ciWRAPPER_OBJDIR := /usr/lib/kernel-wrapper 46862306a36Sopenharmony_ciWRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts 46962306a36Sopenharmony_ciWRAPPER_BINDIR := /usr/sbin 47062306a36Sopenharmony_ciINSTALL := install 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_ciextra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) 47362306a36Sopenharmony_cihostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs)) 47462306a36Sopenharmony_ciwrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper 47562306a36Sopenharmony_cidts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts)) 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_ciall-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ciquiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 48062306a36Sopenharmony_ci cmd_mkdir = mkdir -p $@ 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_ciquiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@) 48362306a36Sopenharmony_ci cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ 48462306a36Sopenharmony_ci 48562306a36Sopenharmony_ciquiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@) 48662306a36Sopenharmony_ci cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ 48762306a36Sopenharmony_ci 48862306a36Sopenharmony_ciquiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 48962306a36Sopenharmony_ci cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ 49062306a36Sopenharmony_ci 49162306a36Sopenharmony_ciquiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) 49262306a36Sopenharmony_ci cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\ 49362306a36Sopenharmony_ci sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \ 49462306a36Sopenharmony_ci -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \ 49562306a36Sopenharmony_ci 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_ci$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR): 49862306a36Sopenharmony_ci $(call cmd,mkdir) 49962306a36Sopenharmony_ci 50062306a36Sopenharmony_ci$(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR) 50162306a36Sopenharmony_ci $(call cmd,install) 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_ci$(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR) 50462306a36Sopenharmony_ci $(call cmd,install_exe) 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_ci$(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR) 50762306a36Sopenharmony_ci $(call cmd,install_dts) 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR) 51062306a36Sopenharmony_ci $(call cmd,install_wrapper) 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci$(obj)/bootwrapper_install: $(all-installed) 513