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