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