Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0
0002 # Makefile for making ELF bootable images for booting on CHRP
0003 # using Open Firmware.
0004 #
0005 # Geert Uytterhoeven    September 1997
0006 #
0007 # Based on coffboot by Paul Mackerras
0008 # Simplified for ppc64 by Todd Inglett
0009 #
0010 # NOTE: this code may be built for 32 bit in ELF32 format even though
0011 #       it packages a 64 bit kernel.  We do this to simplify the
0012 #       bootloader and increase compatibility with OpenFirmware.
0013 #
0014 #       To this end we need to define BOOTCC, etc, as the tools
0015 #       needed to build the 32 bit image.  That's normally the same
0016 #       compiler for the rest of the kernel, with the -m32 flag added.
0017 #       To make it easier to setup a cross compiler,
0018 #       CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
0019 #       in the toplevel makefile.
0020 
0021 all: $(obj)/zImage
0022 
0023 ifdef CROSS32_COMPILE
0024 ifdef CONFIG_CC_IS_CLANG
0025     BOOTCC := $(CROSS32_COMPILE)clang
0026 else
0027     BOOTCC := $(CROSS32_COMPILE)gcc
0028 endif
0029     BOOTAR := $(CROSS32_COMPILE)ar
0030 else
0031     BOOTCC := $(CC)
0032     BOOTAR := $(AR)
0033 endif
0034 
0035 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
0036                  -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
0037                  -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
0038                  $(LINUXINCLUDE)
0039 
0040 ifdef CONFIG_PPC64_BOOT_WRAPPER
0041 ifdef CONFIG_CPU_LITTLE_ENDIAN
0042 BOOTCFLAGS      += -m64 -mcpu=powerpc64le
0043 else
0044 BOOTCFLAGS      += -m64 -mcpu=powerpc64
0045 endif
0046 else
0047 BOOTCFLAGS      += -m32 -mcpu=powerpc
0048 endif
0049 
0050 BOOTCFLAGS      += -isystem $(shell $(BOOTCC) -print-file-name=include)
0051 
0052 ifdef CONFIG_CPU_BIG_ENDIAN
0053 BOOTCFLAGS      += -mbig-endian
0054 else
0055 BOOTCFLAGS      += -mlittle-endian
0056 endif
0057 ifdef CONFIG_PPC64_ELF_ABI_V2
0058 BOOTCFLAGS      += $(call cc-option,-mabi=elfv2)
0059 endif
0060 
0061 BOOTAFLAGS      := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
0062 
0063 BOOTARFLAGS     := -crD
0064 
0065 ifdef CONFIG_CC_IS_CLANG
0066 BOOTCFLAGS += $(CLANG_FLAGS)
0067 BOOTAFLAGS += $(CLANG_FLAGS)
0068 endif
0069 
0070 ifdef CONFIG_DEBUG_INFO
0071 BOOTCFLAGS      += -g
0072 endif
0073 
0074 ifeq ($(call cc-option-yn, -fstack-protector),y)
0075 BOOTCFLAGS      += -fno-stack-protector
0076 endif
0077 
0078 BOOTCFLAGS      += -include $(srctree)/include/linux/compiler_attributes.h
0079 BOOTCFLAGS      += -I$(objtree)/$(obj) -I$(srctree)/$(obj)
0080 
0081 DTC_FLAGS       ?= -p 1024
0082 
0083 $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
0084 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
0085 $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
0086 $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440
0087 $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
0088 $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
0089 $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
0090 $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
0091 $(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
0092 
0093 # The pre-boot decompressors pull in a lot of kernel headers and other source
0094 # files. This creates a bit of a dependency headache since we need to copy
0095 # these files into the build dir, fix up any includes and ensure that dependent
0096 # files are copied in the right order.
0097 
0098 # these need to be seperate variables because they are copied out of different
0099 # directories in the kernel tree. Sure you COULd merge them, but it's a
0100 # cure-is-worse-than-disease situation.
0101 zlib-decomp-$(CONFIG_KERNEL_GZIP) := decompress_inflate.c
0102 zlib-$(CONFIG_KERNEL_GZIP) := inffast.c inflate.c inftrees.c
0103 zlibheader-$(CONFIG_KERNEL_GZIP) := inffast.h inffixed.h inflate.h inftrees.h infutil.h
0104 zliblinuxheader-$(CONFIG_KERNEL_GZIP) := zlib.h zconf.h zutil.h
0105 
0106 $(addprefix $(obj)/, decompress.o): \
0107         $(addprefix $(obj)/,$(zlib-decomp-y))
0108 
0109 $(addprefix $(obj)/, $(zlib-decomp-y)): \
0110         $(addprefix $(obj)/,$(zliblinuxheader-y)) \
0111         $(addprefix $(obj)/,$(zlibheader-y)) \
0112         $(addprefix $(obj)/,$(zlib-y))
0113 
0114 $(addprefix $(obj)/,$(zlib-y)): \
0115         $(addprefix $(obj)/,$(zliblinuxheader-y)) \
0116         $(addprefix $(obj)/,$(zlibheader-y))
0117 
0118 libfdt       := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
0119 libfdtheader := fdt.h libfdt.h libfdt_internal.h
0120 
0121 $(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o \
0122         treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o): \
0123         $(addprefix $(obj)/,$(libfdtheader))
0124 
0125 src-wlib-y := string.S crt0.S stdio.c decompress.c main.c \
0126                 $(libfdt) libfdt-wrapper.c \
0127                 ns16550.c serial.c simple_alloc.c div64.S util.S \
0128                 elf_util.c $(zlib-y) devtree.c stdlib.c \
0129                 oflib.c ofconsole.c cuboot.c
0130 
0131 src-wlib-$(CONFIG_PPC_MPC52xx) += mpc52xx-psc.c
0132 src-wlib-$(CONFIG_PPC_POWERNV) += opal-calls.S opal.c
0133 ifndef CONFIG_PPC64_BOOT_WRAPPER
0134 src-wlib-y += crtsavres.S
0135 endif
0136 src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
0137 src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
0138 src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c
0139 src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
0140 src-wlib-$(CONFIG_EMBEDDED6xx) += ugecon.c fsl-soc.c
0141 src-wlib-$(CONFIG_CPM) += cpm-serial.c
0142 
0143 src-plat-y := of.c epapr.c
0144 src-plat-$(CONFIG_40x) += fixed-head.S cuboot-hotfoot.c \
0145                                 cuboot-acadia.c \
0146                                 cuboot-kilauea.c simpleboot.c
0147 src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
0148                                 cuboot-bamboo.c cuboot-sam440ep.c \
0149                                 cuboot-sequoia.c cuboot-rainier.c \
0150                                 cuboot-taishan.c cuboot-katmai.c \
0151                                 cuboot-warp.c cuboot-yosemite.c \
0152                                 treeboot-iss4xx.c treeboot-currituck.c \
0153                                 treeboot-akebono.c \
0154                                 simpleboot.c fixed-head.S
0155 src-plat-$(CONFIG_PPC_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
0156 src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
0157 src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
0158 src-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c
0159 src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
0160 src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
0161                                         gamecube-head.S gamecube.c \
0162                                         wii-head.S wii.c holly.c \
0163                                         fixed-head.S mvme5100.c
0164 src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
0165 src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
0166 src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
0167 src-plat-$(CONFIG_PPC_PSERIES) += pseries-head.S
0168 src-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S
0169 src-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S
0170 src-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c
0171 
0172 src-plat-$(CONFIG_PPC_MICROWATT) += fixed-head.S microwatt.c
0173 
0174 src-wlib := $(sort $(src-wlib-y))
0175 src-plat := $(sort $(src-plat-y))
0176 src-boot := $(src-wlib) $(src-plat) empty.c
0177 
0178 src-boot := $(addprefix $(obj)/, $(src-boot))
0179 obj-boot := $(addsuffix .o, $(basename $(src-boot)))
0180 obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
0181 obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
0182 obj-plat: $(libfdt)
0183 
0184 quiet_cmd_copy_kern_src = COPY    $@
0185       cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@
0186 
0187 $(addprefix $(obj)/,$(zlib-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
0188         $(call cmd,copy_kern_src)
0189 
0190 $(addprefix $(obj)/,$(zlibheader-y)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
0191         $(call cmd,copy_kern_src)
0192 
0193 $(addprefix $(obj)/,$(zliblinuxheader-y)): $(obj)/%: $(srctree)/include/linux/%
0194         $(call cmd,copy_kern_src)
0195 
0196 $(addprefix $(obj)/,$(zlib-decomp-y)): $(obj)/%: $(srctree)/lib/%
0197         $(call cmd,copy_kern_src)
0198 
0199 quiet_cmd_copy_libfdt = COPY    $@
0200       cmd_copy_libfdt = cp $< $@
0201 
0202 $(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
0203         $(call cmd,copy_libfdt)
0204 
0205 $(obj)/empty.c:
0206         $(Q)touch $@
0207 
0208 $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
0209         $(Q)cp $< $@
0210 
0211 clean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \
0212                 $(zlib-decomp-) $(libfdt) $(libfdtheader) \
0213                 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
0214 
0215 quiet_cmd_bootcc = BOOTCC  $@
0216       cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
0217 
0218 quiet_cmd_bootas = BOOTAS  $@
0219       cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
0220 
0221 quiet_cmd_bootar = BOOTAR  $@
0222       cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@
0223 
0224 $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
0225         $(call if_changed_dep,bootcc)
0226 $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
0227         $(Q)mkdir -p $(dir $@)
0228         $(call if_changed_dep,bootcc)
0229 $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
0230         $(Q)mkdir -p $(dir $@)
0231         $(call if_changed_dep,bootas)
0232 
0233 $(obj)/wrapper.a: $(obj-wlib) FORCE
0234         $(call if_changed,bootar)
0235 
0236 hostprogs       := addnote hack-coff mktree
0237 
0238 targets         += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) zImage.lds
0239 extra-y         := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
0240                    $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
0241 
0242 dtstree         := $(srctree)/$(src)/dts
0243 
0244 wrapper         :=$(srctree)/$(src)/wrapper
0245 wrapperbits     := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
0246                         $(wrapper) FORCE
0247 
0248 #############
0249 # Bits for building various flavours of zImage
0250 
0251 ifneq ($(CROSS32_COMPILE),)
0252 CROSSWRAP := -C "$(CROSS32_COMPILE)"
0253 else
0254 ifneq ($(CROSS_COMPILE),)
0255 CROSSWRAP := -C "$(CROSS_COMPILE)"
0256 endif
0257 endif
0258 
0259 compressor-$(CONFIG_KERNEL_GZIP) := gz
0260 compressor-$(CONFIG_KERNEL_XZ)   := xz
0261 compressor-$(CONFIG_KERNEL_LZMA)   := lzma
0262 compressor-$(CONFIG_KERNEL_LZO) := lzo
0263 
0264 # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
0265 quiet_cmd_wrap  = WRAP    $@
0266       cmd_wrap  =$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \
0267                 $(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \
0268                 vmlinux
0269 
0270 image-$(CONFIG_PPC_PSERIES)             += zImage.pseries
0271 image-$(CONFIG_PPC_POWERNV)             += zImage.pseries
0272 image-$(CONFIG_PPC_MAPLE)               += zImage.maple
0273 image-$(CONFIG_PPC_IBM_CELL_BLADE)      += zImage.pseries
0274 image-$(CONFIG_PPC_PS3)                 += dtbImage.ps3
0275 image-$(CONFIG_PPC_CHRP)                += zImage.chrp
0276 image-$(CONFIG_PPC_EFIKA)               += zImage.chrp
0277 image-$(CONFIG_PPC_PMAC)                += zImage.pmac
0278 image-$(CONFIG_PPC_HOLLY)               += dtbImage.holly
0279 image-$(CONFIG_DEFAULT_UIMAGE)          += uImage
0280 image-$(CONFIG_EPAPR_BOOT)              += zImage.epapr
0281 
0282 #
0283 # Targets which embed a device tree blob
0284 #
0285 # Theses are default targets to build images which embed device tree blobs.
0286 # They are only required on boards which do not have FDT support in firmware.
0287 # Boards with newish u-boot firmware can use the uImage target above
0288 #
0289 
0290 # Board ports in arch/powerpc/platform/40x/Kconfig
0291 image-$(CONFIG_HOTFOOT)                 += cuImage.hotfoot
0292 image-$(CONFIG_ACADIA)                  += cuImage.acadia
0293 image-$(CONFIG_OBS600)                  += uImage.obs600
0294 
0295 # Board ports in arch/powerpc/platform/44x/Kconfig
0296 image-$(CONFIG_EBONY)                   += treeImage.ebony cuImage.ebony
0297 image-$(CONFIG_BAMBOO)                  += treeImage.bamboo cuImage.bamboo
0298 image-$(CONFIG_SAM440EP)                += cuImage.sam440ep
0299 image-$(CONFIG_SEQUOIA)                 += cuImage.sequoia
0300 image-$(CONFIG_RAINIER)                 += cuImage.rainier
0301 image-$(CONFIG_TAISHAN)                 += cuImage.taishan
0302 image-$(CONFIG_KATMAI)                  += cuImage.katmai
0303 image-$(CONFIG_WARP)                    += cuImage.warp
0304 image-$(CONFIG_YOSEMITE)                += cuImage.yosemite
0305 image-$(CONFIG_ISS4xx)                  += treeImage.iss4xx \
0306                                            treeImage.iss4xx-mpic
0307 image-$(CONFIG_CURRITUCK)                       += treeImage.currituck
0308 image-$(CONFIG_AKEBONO)                 += treeImage.akebono
0309 
0310 # Board ports in arch/powerpc/platform/8xx/Kconfig
0311 image-$(CONFIG_MPC86XADS)               += cuImage.mpc866ads
0312 image-$(CONFIG_MPC885ADS)               += cuImage.mpc885ads
0313 image-$(CONFIG_PPC_EP88XC)              += dtbImage.ep88xc
0314 image-$(CONFIG_PPC_ADDER875)            += cuImage.adder875-uboot \
0315                                            dtbImage.adder875-redboot
0316 
0317 # Board ports in arch/powerpc/platform/52xx/Kconfig
0318 image-$(CONFIG_PPC_LITE5200)            += cuImage.lite5200
0319 image-$(CONFIG_PPC_LITE5200)            += cuImage.lite5200b
0320 image-$(CONFIG_PPC_MEDIA5200)           += cuImage.media5200
0321 
0322 # Board ports in arch/powerpc/platform/82xx/Kconfig
0323 image-$(CONFIG_MPC8272_ADS)             += cuImage.mpc8272ads
0324 image-$(CONFIG_PQ2FADS)                 += cuImage.pq2fads
0325 image-$(CONFIG_EP8248E)                 += dtbImage.ep8248e
0326 
0327 # Board ports in arch/powerpc/platform/83xx/Kconfig
0328 image-$(CONFIG_MPC832x_MDS)             += cuImage.mpc832x_mds
0329 image-$(CONFIG_MPC832x_RDB)             += cuImage.mpc832x_rdb
0330 image-$(CONFIG_MPC834x_ITX)             += cuImage.mpc8349emitx \
0331                                            cuImage.mpc8349emitxgp
0332 image-$(CONFIG_MPC834x_MDS)             += cuImage.mpc834x_mds
0333 image-$(CONFIG_MPC836x_MDS)             += cuImage.mpc836x_mds
0334 image-$(CONFIG_ASP834x)                 += dtbImage.asp834x-redboot
0335 
0336 # Board ports in arch/powerpc/platform/85xx/Kconfig
0337 image-$(CONFIG_MPC8540_ADS)             += cuImage.mpc8540ads
0338 image-$(CONFIG_MPC8560_ADS)             += cuImage.mpc8560ads
0339 image-$(CONFIG_MPC85xx_CDS)             += cuImage.mpc8541cds \
0340                                            cuImage.mpc8548cds_32b \
0341                                            cuImage.mpc8555cds
0342 image-$(CONFIG_MPC85xx_MDS)             += cuImage.mpc8568mds
0343 image-$(CONFIG_MPC85xx_DS)              += cuImage.mpc8544ds \
0344                                            cuImage.mpc8572ds
0345 image-$(CONFIG_TQM8540)                 += cuImage.tqm8540
0346 image-$(CONFIG_TQM8541)                 += cuImage.tqm8541
0347 image-$(CONFIG_TQM8548)                 += cuImage.tqm8548
0348 image-$(CONFIG_TQM8555)                 += cuImage.tqm8555
0349 image-$(CONFIG_TQM8560)                 += cuImage.tqm8560
0350 image-$(CONFIG_KSI8560)                 += cuImage.ksi8560
0351 
0352 # Board ports in arch/powerpc/platform/86xx/Kconfig
0353 image-$(CONFIG_MVME7100)                += dtbImage.mvme7100
0354 
0355 # Board ports in arch/powerpc/platform/embedded6xx/Kconfig
0356 image-$(CONFIG_STORCENTER)              += cuImage.storcenter
0357 image-$(CONFIG_MPC7448HPC2)             += cuImage.mpc7448hpc2
0358 image-$(CONFIG_GAMECUBE)                += dtbImage.gamecube
0359 image-$(CONFIG_WII)                     += dtbImage.wii
0360 image-$(CONFIG_MVME5100)                += dtbImage.mvme5100
0361 
0362 # Board port in arch/powerpc/platform/amigaone/Kconfig
0363 image-$(CONFIG_AMIGAONE)                += cuImage.amigaone
0364 
0365 image-$(CONFIG_PPC_MICROWATT)           += dtbImage.microwatt
0366 
0367 # For 32-bit powermacs, build the COFF and miboot images
0368 # as well as the ELF images.
0369 ifdef CONFIG_PPC32
0370 image-$(CONFIG_PPC_PMAC)        += zImage.coff zImage.miboot
0371 endif
0372 
0373 # Allow extra targets to be added to the defconfig
0374 image-y += $(CONFIG_EXTRA_TARGETS)
0375 
0376 initrd-  := $(patsubst zImage%, zImage.initrd%, $(image-))
0377 initrd-y := $(patsubst zImage%, zImage.initrd%, \
0378                 $(patsubst dtbImage%, dtbImage.initrd%, \
0379                 $(patsubst simpleImage%, simpleImage.initrd%, \
0380                 $(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
0381 initrd-y := $(filter-out $(image-y), $(initrd-y))
0382 targets += $(image-y) $(initrd-y)
0383 targets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \
0384                 $(patsubst $(x).%, dts/%.dtb, $(filter $(x).%, $(image-y))))
0385 targets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \
0386                 $(patsubst $(x).%, dts/fsl/%.dtb, $(filter $(x).%, $(image-y))))
0387 
0388 $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
0389 
0390 # Don't put the ramdisk on the pattern rule; when its missing make will try
0391 # the pattern rule with less dependencies that also matches (even with the
0392 # hard dependency listed).
0393 $(obj)/zImage.initrd.%: vmlinux $(wrapperbits) FORCE
0394         $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
0395 
0396 $(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits) FORCE
0397         $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
0398 
0399 # dtbImage% - a dtbImage is a zImage with an embedded device tree blob
0400 $(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
0401         $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
0402 
0403 $(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
0404         $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb)
0405 
0406 # This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
0407 # prefix
0408 $(obj)/vmlinux.strip: vmlinux
0409         $(STRIP) -s -R .comment $< -o $@
0410 
0411 $(obj)/uImage: vmlinux $(wrapperbits) FORCE
0412         $(call if_changed,wrap,uboot)
0413 
0414 $(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0415         $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
0416 
0417 $(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0418         $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb)
0419 
0420 $(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0421         $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
0422 
0423 $(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0424         $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb)
0425 
0426 $(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0427         $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
0428 
0429 $(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0430         $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb)
0431 
0432 $(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0433         $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
0434 
0435 $(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
0436         $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb)
0437 
0438 # Needed for the above targets to work with dts/fsl/ files
0439 $(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb
0440         @cp $< $@
0441 
0442 # If there isn't a platform selected then just strip the vmlinux.
0443 ifeq (,$(image-y))
0444 image-y := vmlinux.strip
0445 endif
0446 
0447 $(obj)/zImage:          $(addprefix $(obj)/, $(image-y))
0448         $(Q)rm -f $@; ln $< $@
0449 $(obj)/zImage.initrd:   $(addprefix $(obj)/, $(initrd-y))
0450         $(Q)rm -f $@; ln $< $@
0451 
0452 # anything not in $(targets)
0453 clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
0454         zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
0455         zImage.miboot zImage.pmac zImage.pseries \
0456         zImage.maple simpleImage.* otheros.bld
0457 
0458 # clean up files cached by wrapper
0459 clean-kernel-base := vmlinux.strip vmlinux.bin
0460 clean-kernel := $(addsuffix .gz,$(clean-kernel-base))
0461 clean-kernel += $(addsuffix .xz,$(clean-kernel-base))
0462 # clean-files are relative to $(obj).
0463 clean-files += $(addprefix ../../../, $(clean-kernel))
0464 
0465 WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
0466 WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
0467 WRAPPER_BINDIR := /usr/sbin
0468 INSTALL := install
0469 
0470 extra-installed         := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
0471 hostprogs-installed     := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs))
0472 wrapper-installed       := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
0473 dts-installed           := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
0474 
0475 all-installed           := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
0476 
0477 quiet_cmd_mkdir           = MKDIR   $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
0478       cmd_mkdir           = mkdir -p $@
0479 
0480 quiet_cmd_install         = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
0481       cmd_install         = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@
0482 
0483 quiet_cmd_install_dts     = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
0484       cmd_install_dts     = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@
0485 
0486 quiet_cmd_install_exe     = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
0487       cmd_install_exe     = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@
0488 
0489 quiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
0490       cmd_install_wrapper = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
0491                                 sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
0492                                           -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
0493 
0494 
0495 $(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
0496         $(call cmd,mkdir)
0497 
0498 $(extra-installed)      : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
0499         $(call cmd,install)
0500 
0501 $(hostprogs-installed)  : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
0502         $(call cmd,install_exe)
0503 
0504 $(dts-installed)        : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
0505         $(call cmd,install_dts)
0506 
0507 $(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
0508         $(call cmd,install_wrapper)
0509 
0510 $(obj)/bootwrapper_install: $(all-installed)