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