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