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