hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/powerpc/boot/Makefile
....@@ -7,7 +7,7 @@
77 # Based on coffboot by Paul Mackerras
88 # Simplified for ppc64 by Todd Inglett
99 #
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
1111 # it packages a 64 bit kernel. We do this to simplify the
1212 # bootloader and increase compatibility with OpenFirmware.
1313 #
....@@ -20,9 +20,6 @@
2020
2121 all: $(obj)/zImage
2222
23
-compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP
24
-compress-$(CONFIG_KERNEL_XZ) := CONFIG_KERNEL_XZ
25
-
2623 ifdef CROSS32_COMPILE
2724 BOOTCC := $(CROSS32_COMPILE)gcc
2825 BOOTAR := $(CROSS32_COMPILE)ar
....@@ -32,9 +29,10 @@
3229 endif
3330
3431 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) \
3634 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
37
- -D$(compress-y)
35
+ $(LINUXINCLUDE)
3836
3937 ifdef CONFIG_PPC64_BOOT_WRAPPER
4038 BOOTCFLAGS += -m64
....@@ -51,9 +49,9 @@
5149 BOOTCFLAGS += $(call cc-option,-mabi=elfv2)
5250 endif
5351
54
-BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
52
+BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
5553
56
-BOOTARFLAGS := -cr$(KBUILD_ARFLAGS)
54
+BOOTARFLAGS := -crD
5755
5856 ifdef CONFIG_CC_IS_CLANG
5957 BOOTCFLAGS += $(CLANG_FLAGS)
....@@ -73,16 +71,14 @@
7371 DTC_FLAGS ?= -p 1024
7472
7573 $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
76
-$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
74
+$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
7775 $(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
8078 $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
81
-$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
8279 $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
8380 $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
8481 $(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
85
-$(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405
8682
8783 # The pre-boot decompressors pull in a lot of kernel headers and other source
8884 # files. This creates a bit of a dependency headache since we need to copy
....@@ -132,14 +128,12 @@
132128 src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c
133129 src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
134130 src-wlib-$(CONFIG_EMBEDDED6xx) += ugecon.c fsl-soc.c
135
-src-wlib-$(CONFIG_XILINX_VIRTEX) += uartlite.c
136131 src-wlib-$(CONFIG_CPM) += cpm-serial.c
137132
138133 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
143137 src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
144138 cuboot-bamboo.c cuboot-sam440ep.c \
145139 cuboot-sequoia.c cuboot-rainier.c \
....@@ -147,7 +141,7 @@
147141 cuboot-warp.c cuboot-yosemite.c \
148142 treeboot-iss4xx.c treeboot-currituck.c \
149143 treeboot-akebono.c \
150
- simpleboot.c fixed-head.S virtex.c
144
+ simpleboot.c fixed-head.S
151145 src-plat-$(CONFIG_PPC_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
152146 src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
153147 src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
....@@ -213,7 +207,7 @@
213207 cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
214208
215209 quiet_cmd_bootar = BOOTAR $@
216
- cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
210
+ cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@
217211
218212 $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
219213 $(call if_changed_dep,bootcc)
....@@ -227,7 +221,7 @@
227221 $(obj)/wrapper.a: $(obj-wlib) FORCE
228222 $(call if_changed,bootar)
229223
230
-hostprogs-y := addnote hack-coff mktree
224
+hostprogs := addnote hack-coff mktree
231225
232226 targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
233227 extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
....@@ -252,6 +246,8 @@
252246
253247 compressor-$(CONFIG_KERNEL_GZIP) := gz
254248 compressor-$(CONFIG_KERNEL_XZ) := xz
249
+compressor-$(CONFIG_KERNEL_LZMA) := lzma
250
+compressor-$(CONFIG_KERNEL_LZO) := lzo
255251
256252 # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
257253 quiet_cmd_wrap = WRAP $@
....@@ -280,9 +276,7 @@
280276 #
281277
282278 # Board ports in arch/powerpc/platform/40x/Kconfig
283
-image-$(CONFIG_EP405) += dtbImage.ep405
284279 image-$(CONFIG_HOTFOOT) += cuImage.hotfoot
285
-image-$(CONFIG_WALNUT) += treeImage.walnut
286280 image-$(CONFIG_ACADIA) += cuImage.acadia
287281 image-$(CONFIG_OBS600) += uImage.obs600
288282
....@@ -309,9 +303,9 @@
309303 dtbImage.adder875-redboot
310304
311305 # 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
315309
316310 # Board ports in arch/powerpc/platform/82xx/Kconfig
317311 image-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads
....@@ -373,6 +367,10 @@
373367 $(patsubst treeImage%, treeImage.initrd%, $(image-y)))))
374368 initrd-y := $(filter-out $(image-y), $(initrd-y))
375369 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))))
376374
377375 $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
378376
....@@ -386,11 +384,11 @@
386384 $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
387385
388386 # 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)
391389
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)
394392
395393 # This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
396394 # prefix
....@@ -400,36 +398,33 @@
400398 $(obj)/uImage: vmlinux $(wrapperbits) FORCE
401399 $(call if_changed,wrap,uboot)
402400
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)
405403
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)
408406
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)
411409
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)
414412
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)
417415
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)
420418
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)
423421
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)
426424
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 $< $@
433428
434429 # If there isn't a platform selected then just strip the vmlinux.
435430 ifeq (,$(image-y))
....@@ -448,6 +443,8 @@
448443 # Install the vmlinux and other built boot targets.
449444 zInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
450445 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
446
+
447
+PHONY += install zInstall
451448
452449 # anything not in $(targets)
453450 clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
....@@ -468,7 +465,7 @@
468465 INSTALL := install
469466
470467 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))
472469 wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
473470 dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
474471