| .. | .. |
|---|
| 7 | 7 | # Based on coffboot by Paul Mackerras |
|---|
| 8 | 8 | # Simplified for ppc64 by Todd Inglett |
|---|
| 9 | 9 | # |
|---|
| 10 | | -# NOTE: this code is built for 32 bit in ELF32 format even though |
|---|
| 10 | +# NOTE: this code may be built for 32 bit in ELF32 format even though |
|---|
| 11 | 11 | # it packages a 64 bit kernel. We do this to simplify the |
|---|
| 12 | 12 | # bootloader and increase compatibility with OpenFirmware. |
|---|
| 13 | 13 | # |
|---|
| .. | .. |
|---|
| 20 | 20 | |
|---|
| 21 | 21 | all: $(obj)/zImage |
|---|
| 22 | 22 | |
|---|
| 23 | | -compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP |
|---|
| 24 | | -compress-$(CONFIG_KERNEL_XZ) := CONFIG_KERNEL_XZ |
|---|
| 25 | | - |
|---|
| 26 | 23 | ifdef CROSS32_COMPILE |
|---|
| 27 | 24 | BOOTCC := $(CROSS32_COMPILE)gcc |
|---|
| 28 | 25 | BOOTAR := $(CROSS32_COMPILE)ar |
|---|
| .. | .. |
|---|
| 32 | 29 | endif |
|---|
| 33 | 30 | |
|---|
| 34 | 31 | BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
|---|
| 35 | | - -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \ |
|---|
| 32 | + -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ |
|---|
| 33 | + $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ |
|---|
| 36 | 34 | -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ |
|---|
| 37 | | - -D$(compress-y) |
|---|
| 35 | + $(LINUXINCLUDE) |
|---|
| 38 | 36 | |
|---|
| 39 | 37 | ifdef CONFIG_PPC64_BOOT_WRAPPER |
|---|
| 40 | 38 | BOOTCFLAGS += -m64 |
|---|
| .. | .. |
|---|
| 51 | 49 | BOOTCFLAGS += $(call cc-option,-mabi=elfv2) |
|---|
| 52 | 50 | endif |
|---|
| 53 | 51 | |
|---|
| 54 | | -BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc |
|---|
| 52 | +BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc |
|---|
| 55 | 53 | |
|---|
| 56 | | -BOOTARFLAGS := -cr$(KBUILD_ARFLAGS) |
|---|
| 54 | +BOOTARFLAGS := -crD |
|---|
| 57 | 55 | |
|---|
| 58 | 56 | ifdef CONFIG_CC_IS_CLANG |
|---|
| 59 | 57 | BOOTCFLAGS += $(CLANG_FLAGS) |
|---|
| .. | .. |
|---|
| 73 | 71 | DTC_FLAGS ?= -p 1024 |
|---|
| 74 | 72 | |
|---|
| 75 | 73 | $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 76 | | -$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 74 | +$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 |
|---|
| 77 | 75 | $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 78 | | -$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 79 | | -$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 76 | +$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 |
|---|
| 77 | +$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 |
|---|
| 80 | 78 | $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 81 | | -$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 82 | 79 | $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 83 | 80 | $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 84 | 81 | $(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405 |
|---|
| 85 | | -$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405 |
|---|
| 86 | 82 | |
|---|
| 87 | 83 | # The pre-boot decompressors pull in a lot of kernel headers and other source |
|---|
| 88 | 84 | # files. This creates a bit of a dependency headache since we need to copy |
|---|
| .. | .. |
|---|
| 132 | 128 | src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c |
|---|
| 133 | 129 | src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c |
|---|
| 134 | 130 | src-wlib-$(CONFIG_EMBEDDED6xx) += ugecon.c fsl-soc.c |
|---|
| 135 | | -src-wlib-$(CONFIG_XILINX_VIRTEX) += uartlite.c |
|---|
| 136 | 131 | src-wlib-$(CONFIG_CPM) += cpm-serial.c |
|---|
| 137 | 132 | |
|---|
| 138 | 133 | src-plat-y := of.c epapr.c |
|---|
| 139 | | -src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \ |
|---|
| 140 | | - treeboot-walnut.c cuboot-acadia.c \ |
|---|
| 141 | | - cuboot-kilauea.c simpleboot.c \ |
|---|
| 142 | | - virtex405-head.S virtex.c |
|---|
| 134 | +src-plat-$(CONFIG_40x) += fixed-head.S cuboot-hotfoot.c \ |
|---|
| 135 | + cuboot-acadia.c \ |
|---|
| 136 | + cuboot-kilauea.c simpleboot.c |
|---|
| 143 | 137 | src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ |
|---|
| 144 | 138 | cuboot-bamboo.c cuboot-sam440ep.c \ |
|---|
| 145 | 139 | cuboot-sequoia.c cuboot-rainier.c \ |
|---|
| .. | .. |
|---|
| 147 | 141 | cuboot-warp.c cuboot-yosemite.c \ |
|---|
| 148 | 142 | treeboot-iss4xx.c treeboot-currituck.c \ |
|---|
| 149 | 143 | treeboot-akebono.c \ |
|---|
| 150 | | - simpleboot.c fixed-head.S virtex.c |
|---|
| 144 | + simpleboot.c fixed-head.S |
|---|
| 151 | 145 | src-plat-$(CONFIG_PPC_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c |
|---|
| 152 | 146 | src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c |
|---|
| 153 | 147 | src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c |
|---|
| .. | .. |
|---|
| 213 | 207 | cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< |
|---|
| 214 | 208 | |
|---|
| 215 | 209 | quiet_cmd_bootar = BOOTAR $@ |
|---|
| 216 | | - cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ |
|---|
| 210 | + cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@ |
|---|
| 217 | 211 | |
|---|
| 218 | 212 | $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE |
|---|
| 219 | 213 | $(call if_changed_dep,bootcc) |
|---|
| .. | .. |
|---|
| 227 | 221 | $(obj)/wrapper.a: $(obj-wlib) FORCE |
|---|
| 228 | 222 | $(call if_changed,bootar) |
|---|
| 229 | 223 | |
|---|
| 230 | | -hostprogs-y := addnote hack-coff mktree |
|---|
| 224 | +hostprogs := addnote hack-coff mktree |
|---|
| 231 | 225 | |
|---|
| 232 | 226 | targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) |
|---|
| 233 | 227 | extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ |
|---|
| .. | .. |
|---|
| 252 | 246 | |
|---|
| 253 | 247 | compressor-$(CONFIG_KERNEL_GZIP) := gz |
|---|
| 254 | 248 | compressor-$(CONFIG_KERNEL_XZ) := xz |
|---|
| 249 | +compressor-$(CONFIG_KERNEL_LZMA) := lzma |
|---|
| 250 | +compressor-$(CONFIG_KERNEL_LZO) := lzo |
|---|
| 255 | 251 | |
|---|
| 256 | 252 | # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd |
|---|
| 257 | 253 | quiet_cmd_wrap = WRAP $@ |
|---|
| .. | .. |
|---|
| 280 | 276 | # |
|---|
| 281 | 277 | |
|---|
| 282 | 278 | # Board ports in arch/powerpc/platform/40x/Kconfig |
|---|
| 283 | | -image-$(CONFIG_EP405) += dtbImage.ep405 |
|---|
| 284 | 279 | image-$(CONFIG_HOTFOOT) += cuImage.hotfoot |
|---|
| 285 | | -image-$(CONFIG_WALNUT) += treeImage.walnut |
|---|
| 286 | 280 | image-$(CONFIG_ACADIA) += cuImage.acadia |
|---|
| 287 | 281 | image-$(CONFIG_OBS600) += uImage.obs600 |
|---|
| 288 | 282 | |
|---|
| .. | .. |
|---|
| 309 | 303 | dtbImage.adder875-redboot |
|---|
| 310 | 304 | |
|---|
| 311 | 305 | # Board ports in arch/powerpc/platform/52xx/Kconfig |
|---|
| 312 | | -image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 lite5200.dtb |
|---|
| 313 | | -image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b lite5200b.dtb |
|---|
| 314 | | -image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 media5200.dtb |
|---|
| 306 | +image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 |
|---|
| 307 | +image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b |
|---|
| 308 | +image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 |
|---|
| 315 | 309 | |
|---|
| 316 | 310 | # Board ports in arch/powerpc/platform/82xx/Kconfig |
|---|
| 317 | 311 | image-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads |
|---|
| .. | .. |
|---|
| 373 | 367 | $(patsubst treeImage%, treeImage.initrd%, $(image-y))))) |
|---|
| 374 | 368 | initrd-y := $(filter-out $(image-y), $(initrd-y)) |
|---|
| 375 | 369 | targets += $(image-y) $(initrd-y) |
|---|
| 370 | +targets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ |
|---|
| 371 | + $(patsubst $(x).%, dts/%.dtb, $(filter $(x).%, $(image-y)))) |
|---|
| 372 | +targets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ |
|---|
| 373 | + $(patsubst $(x).%, dts/fsl/%.dtb, $(filter $(x).%, $(image-y)))) |
|---|
| 376 | 374 | |
|---|
| 377 | 375 | $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz |
|---|
| 378 | 376 | |
|---|
| .. | .. |
|---|
| 386 | 384 | $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@)) |
|---|
| 387 | 385 | |
|---|
| 388 | 386 | # dtbImage% - a dtbImage is a zImage with an embedded device tree blob |
|---|
| 389 | | -$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE |
|---|
| 390 | | - $(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 387 | +$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE |
|---|
| 388 | + $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 391 | 389 | |
|---|
| 392 | | -$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE |
|---|
| 393 | | - $(call if_changed,wrap,$*,,$(obj)/$*.dtb) |
|---|
| 390 | +$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE |
|---|
| 391 | + $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb) |
|---|
| 394 | 392 | |
|---|
| 395 | 393 | # This cannot be in the root of $(src) as the zImage rule always adds a $(obj) |
|---|
| 396 | 394 | # prefix |
|---|
| .. | .. |
|---|
| 400 | 398 | $(obj)/uImage: vmlinux $(wrapperbits) FORCE |
|---|
| 401 | 399 | $(call if_changed,wrap,uboot) |
|---|
| 402 | 400 | |
|---|
| 403 | | -$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 404 | | - $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 401 | +$(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 402 | + $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 405 | 403 | |
|---|
| 406 | | -$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 407 | | - $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb) |
|---|
| 404 | +$(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 405 | + $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb) |
|---|
| 408 | 406 | |
|---|
| 409 | | -$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 410 | | - $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 407 | +$(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 408 | + $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 411 | 409 | |
|---|
| 412 | | -$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 413 | | - $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb) |
|---|
| 410 | +$(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 411 | + $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb) |
|---|
| 414 | 412 | |
|---|
| 415 | | -$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 416 | | - $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 413 | +$(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 414 | + $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 417 | 415 | |
|---|
| 418 | | -$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 419 | | - $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb) |
|---|
| 416 | +$(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 417 | + $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb) |
|---|
| 420 | 418 | |
|---|
| 421 | | -$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 422 | | - $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 419 | +$(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 420 | + $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz) |
|---|
| 423 | 421 | |
|---|
| 424 | | -$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE |
|---|
| 425 | | - $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) |
|---|
| 422 | +$(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE |
|---|
| 423 | + $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb) |
|---|
| 426 | 424 | |
|---|
| 427 | | -# Rule to build device tree blobs |
|---|
| 428 | | -$(obj)/%.dtb: $(src)/dts/%.dts FORCE |
|---|
| 429 | | - $(call if_changed_dep,dtc) |
|---|
| 430 | | - |
|---|
| 431 | | -$(obj)/%.dtb: $(src)/dts/fsl/%.dts FORCE |
|---|
| 432 | | - $(call if_changed_dep,dtc) |
|---|
| 425 | +# Needed for the above targets to work with dts/fsl/ files |
|---|
| 426 | +$(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb |
|---|
| 427 | + @cp $< $@ |
|---|
| 433 | 428 | |
|---|
| 434 | 429 | # If there isn't a platform selected then just strip the vmlinux. |
|---|
| 435 | 430 | ifeq (,$(image-y)) |
|---|
| .. | .. |
|---|
| 448 | 443 | # Install the vmlinux and other built boot targets. |
|---|
| 449 | 444 | zInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) |
|---|
| 450 | 445 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^ |
|---|
| 446 | + |
|---|
| 447 | +PHONY += install zInstall |
|---|
| 451 | 448 | |
|---|
| 452 | 449 | # anything not in $(targets) |
|---|
| 453 | 450 | clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \ |
|---|
| .. | .. |
|---|
| 468 | 465 | INSTALL := install |
|---|
| 469 | 466 | |
|---|
| 470 | 467 | extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) |
|---|
| 471 | | -hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y)) |
|---|
| 468 | +hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs)) |
|---|
| 472 | 469 | wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper |
|---|
| 473 | 470 | dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts)) |
|---|
| 474 | 471 | |
|---|