aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2018-10-04 15:16:15 -0400
committerRob Herring <robh@kernel.org>2018-10-04 15:16:15 -0400
commit4355151de47c2b4bc72c026ee743bd9ed7f71ba3 (patch)
tree159451d359e3154734e1fb3205556f1c421f878e
parent5d5a0ab1a7918fce5ca5c0fb1871a3e2000f85de (diff)
parent92f687f40ee511e0ea6046bf63ceb48ff3ad1494 (diff)
Merge branch 'all-dtbs' into dt/next
-rw-r--r--Makefile37
-rw-r--r--arch/arc/Makefile6
-rw-r--r--arch/arm/Makefile20
-rw-r--r--arch/arm64/Makefile17
-rw-r--r--arch/c6x/Makefile2
-rw-r--r--arch/c6x/boot/dts/Makefile17
-rw-r--r--arch/c6x/boot/dts/linked_dtb.S2
-rw-r--r--arch/c6x/include/asm/sections.h1
-rw-r--r--arch/c6x/kernel/setup.c4
-rw-r--r--arch/c6x/kernel/vmlinux.lds.S10
-rw-r--r--arch/h8300/Makefile11
-rw-r--r--arch/microblaze/Makefile4
-rw-r--r--arch/microblaze/boot/dts/Makefile4
-rw-r--r--arch/mips/Makefile15
-rw-r--r--arch/nds32/Makefile2
-rw-r--r--arch/nios2/Makefile11
-rw-r--r--arch/nios2/boot/Makefile22
-rw-r--r--arch/nios2/boot/dts/Makefile6
-rw-r--r--arch/nios2/boot/linked_dtb.S19
-rw-r--r--arch/powerpc/Makefile3
-rw-r--r--arch/powerpc/boot/Makefile55
-rw-r--r--arch/powerpc/boot/dts/Makefile6
-rw-r--r--arch/powerpc/boot/dts/fsl/Makefile4
-rw-r--r--arch/xtensa/Makefile12
-rw-r--r--scripts/Makefile3
-rw-r--r--scripts/Makefile.lib2
-rw-r--r--scripts/dtc/Makefile2
27 files changed, 102 insertions, 195 deletions
diff --git a/Makefile b/Makefile
index 19948e556941..021e274c4b03 100644
--- a/Makefile
+++ b/Makefile
@@ -1071,7 +1071,7 @@ include/config/kernel.release: $(srctree)/Makefile FORCE
1071# Carefully list dependencies so we do not try to build scripts twice 1071# Carefully list dependencies so we do not try to build scripts twice
1072# in parallel 1072# in parallel
1073PHONY += scripts 1073PHONY += scripts
1074scripts: scripts_basic asm-generic gcc-plugins $(autoksyms_h) 1074scripts: scripts_basic scripts_dtc asm-generic gcc-plugins $(autoksyms_h)
1075 $(Q)$(MAKE) $(build)=$(@) 1075 $(Q)$(MAKE) $(build)=$(@)
1076 1076
1077# Things we need to do before we recursively start building the kernel 1077# Things we need to do before we recursively start building the kernel
@@ -1216,6 +1216,35 @@ kselftest-merge:
1216 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig 1216 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
1217 1217
1218# --------------------------------------------------------------------------- 1218# ---------------------------------------------------------------------------
1219# Devicetree files
1220
1221ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),)
1222dtstree := arch/$(SRCARCH)/boot/dts
1223endif
1224
1225ifneq ($(dtstree),)
1226
1227%.dtb: prepare3 scripts_dtc
1228 $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
1229
1230PHONY += dtbs dtbs_install
1231dtbs: prepare3 scripts_dtc
1232 $(Q)$(MAKE) $(build)=$(dtstree)
1233
1234dtbs_install:
1235 $(Q)$(MAKE) $(dtbinst)=$(dtstree)
1236
1237ifdef CONFIG_OF_EARLY_FLATTREE
1238all: dtbs
1239endif
1240
1241endif
1242
1243PHONY += scripts_dtc
1244scripts_dtc: scripts_basic
1245 $(Q)$(MAKE) $(build)=scripts/dtc
1246
1247# ---------------------------------------------------------------------------
1219# Modules 1248# Modules
1220 1249
1221ifdef CONFIG_MODULES 1250ifdef CONFIG_MODULES
@@ -1424,6 +1453,12 @@ help:
1424 @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing' 1453 @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing'
1425 @echo ' .config.' 1454 @echo ' .config.'
1426 @echo '' 1455 @echo ''
1456 @$(if $(dtstree), \
1457 echo 'Devicetree:'; \
1458 echo '* dtbs - Build device tree blobs for enabled boards'; \
1459 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'; \
1460 echo '')
1461
1427 @echo 'Userspace tools targets:' 1462 @echo 'Userspace tools targets:'
1428 @echo ' use "make tools/help"' 1463 @echo ' use "make tools/help"'
1429 @echo ' or "cd tools; make help"' 1464 @echo ' or "cd tools; make help"'
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index fb026196aaab..5c7bc6d62f43 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -132,11 +132,5 @@ boot_targets += uImage uImage.bin uImage.gz
132$(boot_targets): vmlinux 132$(boot_targets): vmlinux
133 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 133 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
134 134
135%.dtb %.dtb.S %.dtb.o: scripts
136 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
137
138dtbs: scripts
139 $(Q)$(MAKE) $(build)=$(boot)/dts
140
141archclean: 135archclean:
142 $(Q)$(MAKE) $(clean)=$(boot) 136 $(Q)$(MAKE) $(clean)=$(boot)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d1516f85f25d..161c2df6567e 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -307,12 +307,7 @@ else
307KBUILD_IMAGE := $(boot)/zImage 307KBUILD_IMAGE := $(boot)/zImage
308endif 308endif
309 309
310# Build the DT binary blobs if we have OF configured 310all: $(notdir $(KBUILD_IMAGE))
311ifeq ($(CONFIG_USE_OF),y)
312KBUILD_DTBS := dtbs
313endif
314
315all: $(notdir $(KBUILD_IMAGE)) $(KBUILD_DTBS)
316 311
317 312
318archheaders: 313archheaders:
@@ -339,17 +334,6 @@ $(BOOT_TARGETS): vmlinux
339$(INSTALL_TARGETS): 334$(INSTALL_TARGETS):
340 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 335 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
341 336
342%.dtb: | scripts
343 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
344
345PHONY += dtbs dtbs_install
346
347dtbs: prepare scripts
348 $(Q)$(MAKE) $(build)=$(boot)/dts
349
350dtbs_install:
351 $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
352
353PHONY += vdso_install 337PHONY += vdso_install
354vdso_install: 338vdso_install:
355ifeq ($(CONFIG_VDSO),y) 339ifeq ($(CONFIG_VDSO),y)
@@ -371,8 +355,6 @@ define archhelp
371 echo ' uImage - U-Boot wrapped zImage' 355 echo ' uImage - U-Boot wrapped zImage'
372 echo ' bootpImage - Combined zImage and initial RAM disk' 356 echo ' bootpImage - Combined zImage and initial RAM disk'
373 echo ' (supply initrd image via make variable INITRD=<path>)' 357 echo ' (supply initrd image via make variable INITRD=<path>)'
374 echo '* dtbs - Build device tree blobs for enabled boards'
375 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
376 echo ' install - Install uncompressed kernel' 358 echo ' install - Install uncompressed kernel'
377 echo ' zinstall - Install compressed kernel' 359 echo ' zinstall - Install compressed kernel'
378 echo ' uinstall - Install U-Boot wrapped compressed kernel' 360 echo ' uinstall - Install U-Boot wrapped compressed kernel'
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 106039d25e2f..b4e994cd3a42 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -113,9 +113,8 @@ core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
113# Default target when executing plain make 113# Default target when executing plain make
114boot := arch/arm64/boot 114boot := arch/arm64/boot
115KBUILD_IMAGE := $(boot)/Image.gz 115KBUILD_IMAGE := $(boot)/Image.gz
116KBUILD_DTBS := dtbs
117 116
118all: Image.gz $(KBUILD_DTBS) 117all: Image.gz
119 118
120 119
121Image: vmlinux 120Image: vmlinux
@@ -127,17 +126,6 @@ Image.%: Image
127zinstall install: 126zinstall install:
128 $(Q)$(MAKE) $(build)=$(boot) $@ 127 $(Q)$(MAKE) $(build)=$(boot) $@
129 128
130%.dtb: scripts
131 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
132
133PHONY += dtbs dtbs_install
134
135dtbs: prepare scripts
136 $(Q)$(MAKE) $(build)=$(boot)/dts
137
138dtbs_install:
139 $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
140
141PHONY += vdso_install 129PHONY += vdso_install
142vdso_install: 130vdso_install:
143 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ 131 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
@@ -145,7 +133,6 @@ vdso_install:
145# We use MRPROPER_FILES and CLEAN_FILES now 133# We use MRPROPER_FILES and CLEAN_FILES now
146archclean: 134archclean:
147 $(Q)$(MAKE) $(clean)=$(boot) 135 $(Q)$(MAKE) $(clean)=$(boot)
148 $(Q)$(MAKE) $(clean)=$(boot)/dts
149 136
150# We need to generate vdso-offsets.h before compiling certain files in kernel/. 137# We need to generate vdso-offsets.h before compiling certain files in kernel/.
151# In order to do that, we should use the archprepare target, but we can't since 138# In order to do that, we should use the archprepare target, but we can't since
@@ -160,8 +147,6 @@ vdso_prepare: prepare0
160define archhelp 147define archhelp
161 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' 148 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
162 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' 149 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
163 echo '* dtbs - Build device tree blobs for enabled boards'
164 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
165 echo ' install - Install uncompressed kernel' 150 echo ' install - Install uncompressed kernel'
166 echo ' zinstall - Install compressed kernel' 151 echo ' zinstall - Install compressed kernel'
167 echo ' Install using (your) ~/bin/installkernel or' 152 echo ' Install using (your) ~/bin/installkernel or'
diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index 3fe8a948e94c..b7aa854f7008 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -40,9 +40,7 @@ boot := arch/$(ARCH)/boot
40DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS))) 40DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS)))
41export DTB 41export DTB
42 42
43ifneq ($(DTB),)
44core-y += $(boot)/dts/ 43core-y += $(boot)/dts/
45endif
46 44
47# With make 3.82 we cannot mix normal and wildcard targets 45# With make 3.82 we cannot mix normal and wildcard targets
48 46
diff --git a/arch/c6x/boot/dts/Makefile b/arch/c6x/boot/dts/Makefile
index b212d278ebc4..f438285c3640 100644
--- a/arch/c6x/boot/dts/Makefile
+++ b/arch/c6x/boot/dts/Makefile
@@ -5,15 +5,12 @@
5 5
6DTC_FLAGS ?= -p 1024 6DTC_FLAGS ?= -p 1024
7 7
8dtb-$(CONFIG_SOC_TMS320C6455) += dsk6455.dtb
9dtb-$(CONFIG_SOC_TMS320C6457) += evmc6457.dtb
10dtb-$(CONFIG_SOC_TMS320C6472) += evmc6472.dtb
11dtb-$(CONFIG_SOC_TMS320C6474) += evmc6474.dtb
12dtb-$(CONFIG_SOC_TMS320C6678) += evmc6678.dtb
13
8ifneq ($(DTB),) 14ifneq ($(DTB),)
9obj-y += linked_dtb.o 15obj-y += $(DTB).dtb.o
10endif 16endif
11
12quiet_cmd_cp = CP $< $@$2
13 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
14
15# Generate builtin.dtb from $(DTB).dtb
16$(obj)/builtin.dtb: $(obj)/$(DTB).dtb
17 $(call if_changed,cp)
18
19$(obj)/linked_dtb.o: $(obj)/builtin.dtb
diff --git a/arch/c6x/boot/dts/linked_dtb.S b/arch/c6x/boot/dts/linked_dtb.S
deleted file mode 100644
index cf347f1d16ce..000000000000
--- a/arch/c6x/boot/dts/linked_dtb.S
+++ /dev/null
@@ -1,2 +0,0 @@
1.section __fdt_blob,"a"
2.incbin "arch/c6x/boot/dts/builtin.dtb"
diff --git a/arch/c6x/include/asm/sections.h b/arch/c6x/include/asm/sections.h
index d6c591ab5b7e..dc2f15eb3bde 100644
--- a/arch/c6x/include/asm/sections.h
+++ b/arch/c6x/include/asm/sections.h
@@ -8,6 +8,5 @@ extern char _vectors_start[];
8extern char _vectors_end[]; 8extern char _vectors_end[];
9 9
10extern char _data_lma[]; 10extern char _data_lma[];
11extern char _fdt_start[], _fdt_end[];
12 11
13#endif /* _ASM_C6X_SECTIONS_H */ 12#endif /* _ASM_C6X_SECTIONS_H */
diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
index 2e97455ca0b7..05d96a9541b5 100644
--- a/arch/c6x/kernel/setup.c
+++ b/arch/c6x/kernel/setup.c
@@ -265,7 +265,7 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)
265notrace void __init machine_init(unsigned long dt_ptr) 265notrace void __init machine_init(unsigned long dt_ptr)
266{ 266{
267 void *dtb = __va(dt_ptr); 267 void *dtb = __va(dt_ptr);
268 void *fdt = _fdt_start; 268 void *fdt = __dtb_start;
269 269
270 /* interrupts must be masked */ 270 /* interrupts must be masked */
271 set_creg(IER, 2); 271 set_creg(IER, 2);
@@ -358,7 +358,7 @@ void __init setup_arch(char **cmdline_p)
358 memory_end >> PAGE_SHIFT); 358 memory_end >> PAGE_SHIFT);
359 memblock_reserve(memory_start, bootmap_size); 359 memblock_reserve(memory_start, bootmap_size);
360 360
361 unflatten_device_tree(); 361 unflatten_and_copy_device_tree();
362 362
363 c6x_cache_init(); 363 c6x_cache_init();
364 364
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index 1fba5b421eee..584bab2bace6 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -90,16 +90,6 @@ SECTIONS
90 *(.switch) 90 *(.switch)
91 } 91 }
92 92
93 . = ALIGN (8) ;
94 __fdt_blob : AT(ADDR(__fdt_blob) - LOAD_OFFSET)
95 {
96 _fdt_start = . ; /* place for fdt blob */
97 *(__fdt_blob) ; /* Any link-placed DTB */
98 BYTE(0); /* section always has contents */
99 . = _fdt_start + 0x4000; /* Pad up to 16kbyte */
100 _fdt_end = . ;
101 }
102
103 _etext = .; 93 _etext = .;
104 94
105 /* 95 /*
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index 58634e6bae92..4003ddc616e1 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -31,21 +31,12 @@ CROSS_COMPILE := h8300-unknown-linux-
31endif 31endif
32 32
33core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ 33core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
34ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""' 34core-y += arch/$(ARCH)/boot/dts/
35core-y += arch/h8300/boot/dts/
36endif
37 35
38libs-y += arch/$(ARCH)/lib/ 36libs-y += arch/$(ARCH)/lib/
39 37
40boot := arch/h8300/boot 38boot := arch/h8300/boot
41 39
42%.dtb %.dtb.S %.dtb.o: | scripts
43 $(Q)$(MAKE) $(build)=arch/h8300/boot/dts arch/h8300/boot/dts/$@
44
45PHONY += dtbs
46dtbs: scripts
47 $(Q)$(MAKE) $(build)=arch/h8300/boot/dts
48
49archmrproper: 40archmrproper:
50 41
51archclean: 42archclean:
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 4f3ab5707265..0823d291fbeb 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -65,9 +65,7 @@ boot := arch/microblaze/boot
65# Are we making a simpleImage.<boardname> target? If so, crack out the boardname 65# Are we making a simpleImage.<boardname> target? If so, crack out the boardname
66DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS))) 66DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
67 67
68ifneq ($(DTB),) 68core-y += $(boot)/dts/
69 core-y += $(boot)/dts/
70endif
71 69
72# defines filename extension depending memory management type 70# defines filename extension depending memory management type
73ifeq ($(CONFIG_MMU),) 71ifeq ($(CONFIG_MMU),)
diff --git a/arch/microblaze/boot/dts/Makefile b/arch/microblaze/boot/dts/Makefile
index 1f77913d404d..c7324e74f9ef 100644
--- a/arch/microblaze/boot/dts/Makefile
+++ b/arch/microblaze/boot/dts/Makefile
@@ -1,6 +1,9 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# 2#
3 3
4dtb-y := system.dtb
5
6ifneq ($(DTB),)
4obj-y += linked_dtb.o 7obj-y += linked_dtb.o
5 8
6# Ensure system.dtb exists 9# Ensure system.dtb exists
@@ -11,6 +14,7 @@ ifneq ($(DTB),system)
11$(obj)/system.dtb: $(obj)/$(DTB).dtb 14$(obj)/system.dtb: $(obj)/$(DTB).dtb
12 $(call if_changed,cp) 15 $(call if_changed,cp)
13endif 16endif
17endif
14 18
15quiet_cmd_cp = CP $< $@$2 19quiet_cmd_cp = CP $< $@$2
16 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false) 20 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d74b3742fa5d..d43eeaa6d75b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -407,18 +407,7 @@ endif
407CLEAN_FILES += vmlinux.32 vmlinux.64 407CLEAN_FILES += vmlinux.32 vmlinux.64
408 408
409# device-trees 409# device-trees
410core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/ 410core-y += arch/mips/boot/dts/
411
412%.dtb %.dtb.S %.dtb.o: | scripts
413 $(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
414
415PHONY += dtbs
416dtbs: scripts
417 $(Q)$(MAKE) $(build)=arch/mips/boot/dts
418
419PHONY += dtbs_install
420dtbs_install:
421 $(Q)$(MAKE) $(dtbinst)=arch/mips/boot/dts
422 411
423archprepare: 412archprepare:
424ifdef CONFIG_MIPS32_N32 413ifdef CONFIG_MIPS32_N32
@@ -461,8 +450,6 @@ define archhelp
461 echo ' uImage.lzma - U-Boot image (lzma)' 450 echo ' uImage.lzma - U-Boot image (lzma)'
462 echo ' uImage.lzo - U-Boot image (lzo)' 451 echo ' uImage.lzo - U-Boot image (lzo)'
463 echo ' uzImage.bin - U-Boot image (self-extracting)' 452 echo ' uzImage.bin - U-Boot image (self-extracting)'
464 echo ' dtbs - Device-tree blobs for enabled boards'
465 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
466 echo 453 echo
467 echo ' These will be default as appropriate for a configured platform.' 454 echo ' These will be default as appropriate for a configured platform.'
468 echo 455 echo
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
index 63f4f173e5f4..adcac830d051 100644
--- a/arch/nds32/Makefile
+++ b/arch/nds32/Makefile
@@ -43,7 +43,7 @@ CHECKFLAGS += -D__NDS32_EB__
43endif 43endif
44 44
45boot := arch/nds32/boot 45boot := arch/nds32/boot
46core-$(BUILTIN_DTB) += $(boot)/dts/ 46core-y += $(boot)/dts/
47 47
48.PHONY: FORCE 48.PHONY: FORCE
49 49
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
index 8673a79dca9c..52c03e60b114 100644
--- a/arch/nios2/Makefile
+++ b/arch/nios2/Makefile
@@ -49,21 +49,13 @@ BOOT_TARGETS = vmImage zImage
49PHONY += $(BOOT_TARGETS) install 49PHONY += $(BOOT_TARGETS) install
50KBUILD_IMAGE := $(nios2-boot)/vmImage 50KBUILD_IMAGE := $(nios2-boot)/vmImage
51 51
52ifneq ($(CONFIG_NIOS2_DTB_SOURCE),"") 52core-y += $(nios2-boot)/dts/
53 core-y += $(nios2-boot)/
54endif
55 53
56all: vmImage 54all: vmImage
57 55
58archclean: 56archclean:
59 $(Q)$(MAKE) $(clean)=$(nios2-boot) 57 $(Q)$(MAKE) $(clean)=$(nios2-boot)
60 58
61%.dtb: | scripts
62 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
63
64dtbs:
65 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
66
67$(BOOT_TARGETS): vmlinux 59$(BOOT_TARGETS): vmlinux
68 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ 60 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
69 61
@@ -76,5 +68,4 @@ define archhelp
76 echo ' (your) ~/bin/$(INSTALLKERNEL) or' 68 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
77 echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 69 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
78 echo ' install to $$(INSTALL_PATH)' 70 echo ' install to $$(INSTALL_PATH)'
79 echo ' dtbs - Build device tree blobs for enabled boards'
80endef 71endef
diff --git a/arch/nios2/boot/Makefile b/arch/nios2/boot/Makefile
index 2ba23a679732..37dfc7e584bc 100644
--- a/arch/nios2/boot/Makefile
+++ b/arch/nios2/boot/Makefile
@@ -31,27 +31,5 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
31$(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE 31$(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE
32 $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 32 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
33 33
34# Rule to build device tree blobs
35DTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE))
36
37# Make sure the generated dtb gets removed during clean
38extra-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += system.dtb
39
40$(obj)/system.dtb: $(DTB_SRC) FORCE
41 $(call cmd,dtc)
42
43# Ensure system.dtb exists
44$(obj)/linked_dtb.o: $(obj)/system.dtb
45
46obj-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += linked_dtb.o
47
48targets += $(dtb-y)
49
50# Rule to build device tree blobs with make command
51$(obj)/%.dtb: $(src)/dts/%.dts FORCE
52 $(call if_changed_dep,dtc)
53
54$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
55
56install: 34install:
57 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" 35 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/nios2/boot/dts/Makefile b/arch/nios2/boot/dts/Makefile
new file mode 100644
index 000000000000..a91a0b09be63
--- /dev/null
+++ b/arch/nios2/boot/dts/Makefile
@@ -0,0 +1,6 @@
1# SPDX-License-Identifier: GPL-2.0
2
3obj-y := $(patsubst "%.dts",%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE))
4
5dtstree := $(srctree)/$(src)
6dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
diff --git a/arch/nios2/boot/linked_dtb.S b/arch/nios2/boot/linked_dtb.S
deleted file mode 100644
index 071f922db338..000000000000
--- a/arch/nios2/boot/linked_dtb.S
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Copyright (C) 2011 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18.section .dtb.init.rodata,"a"
19.incbin "arch/nios2/boot/system.dtb"
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 11a1acba164a..42f225f6ec93 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -293,9 +293,6 @@ $(BOOT_TARGETS2): vmlinux
293bootwrapper_install: 293bootwrapper_install:
294 $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 294 $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
295 295
296%.dtb: scripts
297 $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
298
299# Used to create 'merged defconfigs' 296# Used to create 'merged defconfigs'
300# To use it $(call) it with the first argument as the base defconfig 297# To use it $(call) it with the first argument as the base defconfig
301# and the second argument as a space separated list of .config files to merge, 298# and the second argument as a space separated list of .config files to merge,
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 0fb96c26136f..bca5c23767df 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -304,9 +304,9 @@ image-$(CONFIG_PPC_ADDER875) += cuImage.adder875-uboot \
304 dtbImage.adder875-redboot 304 dtbImage.adder875-redboot
305 305
306# Board ports in arch/powerpc/platform/52xx/Kconfig 306# Board ports in arch/powerpc/platform/52xx/Kconfig
307image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200 lite5200.dtb 307image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200
308image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b lite5200b.dtb 308image-$(CONFIG_PPC_LITE5200) += cuImage.lite5200b
309image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200 media5200.dtb 309image-$(CONFIG_PPC_MEDIA5200) += cuImage.media5200
310 310
311# Board ports in arch/powerpc/platform/82xx/Kconfig 311# Board ports in arch/powerpc/platform/82xx/Kconfig
312image-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads 312image-$(CONFIG_MPC8272_ADS) += cuImage.mpc8272ads
@@ -381,11 +381,11 @@ $(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperb
381 $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@)) 381 $(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
382 382
383# dtbImage% - a dtbImage is a zImage with an embedded device tree blob 383# dtbImage% - a dtbImage is a zImage with an embedded device tree blob
384$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE 384$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
385 $(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 385 $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
386 386
387$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE 387$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/dts/%.dtb FORCE
388 $(call if_changed,wrap,$*,,$(obj)/$*.dtb) 388 $(call if_changed,wrap,$*,,$(obj)/dts/$*.dtb)
389 389
390# This cannot be in the root of $(src) as the zImage rule always adds a $(obj) 390# This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
391# prefix 391# prefix
@@ -395,36 +395,33 @@ $(obj)/vmlinux.strip: vmlinux
395$(obj)/uImage: vmlinux $(wrapperbits) FORCE 395$(obj)/uImage: vmlinux $(wrapperbits) FORCE
396 $(call if_changed,wrap,uboot) 396 $(call if_changed,wrap,uboot)
397 397
398$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 398$(obj)/uImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
399 $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 399 $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
400 400
401$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 401$(obj)/uImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
402 $(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb) 402 $(call if_changed,wrap,uboot-$*,,$(obj)/dts/$*.dtb)
403 403
404$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 404$(obj)/cuImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
405 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 405 $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
406 406
407$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 407$(obj)/cuImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
408 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb) 408 $(call if_changed,wrap,cuboot-$*,,$(obj)/dts/$*.dtb)
409 409
410$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 410$(obj)/simpleImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
411 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 411 $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
412 412
413$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 413$(obj)/simpleImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
414 $(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb) 414 $(call if_changed,wrap,simpleboot-$*,,$(obj)/dts/$*.dtb)
415 415
416$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 416$(obj)/treeImage.initrd.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
417 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz) 417 $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb,$(obj)/ramdisk.image.gz)
418 418
419$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE 419$(obj)/treeImage.%: vmlinux $(obj)/dts/%.dtb $(wrapperbits) FORCE
420 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) 420 $(call if_changed,wrap,treeboot-$*,,$(obj)/dts/$*.dtb)
421 421
422# Rule to build device tree blobs 422# Needed for the above targets to work with dts/fsl/ files
423$(obj)/%.dtb: $(src)/dts/%.dts FORCE 423$(obj)/dts/%.dtb: $(obj)/dts/fsl/%.dtb
424 $(call if_changed_dep,dtc) 424 @cp $< $@
425
426$(obj)/%.dtb: $(src)/dts/fsl/%.dts FORCE
427 $(call if_changed_dep,dtc)
428 425
429# If there isn't a platform selected then just strip the vmlinux. 426# If there isn't a platform selected then just strip the vmlinux.
430ifeq (,$(image-y)) 427ifeq (,$(image-y))
diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
new file mode 100644
index 000000000000..fb335d05aae8
--- /dev/null
+++ b/arch/powerpc/boot/dts/Makefile
@@ -0,0 +1,6 @@
1# SPDX-License-Identifier: GPL-2.0
2
3subdir-y += fsl
4
5dtstree := $(srctree)/$(src)
6dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
diff --git a/arch/powerpc/boot/dts/fsl/Makefile b/arch/powerpc/boot/dts/fsl/Makefile
new file mode 100644
index 000000000000..3bae982641e9
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/Makefile
@@ -0,0 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0
2
3dtstree := $(srctree)/$(src)
4dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 295c120ed099..13fd3301c517 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -84,28 +84,18 @@ LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
84head-y := arch/xtensa/kernel/head.o 84head-y := arch/xtensa/kernel/head.o
85core-y += arch/xtensa/kernel/ arch/xtensa/mm/ 85core-y += arch/xtensa/kernel/ arch/xtensa/mm/
86core-y += $(buildvar) $(buildplf) 86core-y += $(buildvar) $(buildplf)
87core-y += arch/xtensa/boot/dts/
87 88
88libs-y += arch/xtensa/lib/ $(LIBGCC) 89libs-y += arch/xtensa/lib/ $(LIBGCC)
89drivers-$(CONFIG_OPROFILE) += arch/xtensa/oprofile/ 90drivers-$(CONFIG_OPROFILE) += arch/xtensa/oprofile/
90 91
91ifneq ($(CONFIG_BUILTIN_DTB),"")
92core-$(CONFIG_OF) += arch/xtensa/boot/dts/
93endif
94
95boot := arch/xtensa/boot 92boot := arch/xtensa/boot
96 93
97all Image zImage uImage: vmlinux 94all Image zImage uImage: vmlinux
98 $(Q)$(MAKE) $(build)=$(boot) $@ 95 $(Q)$(MAKE) $(build)=$(boot) $@
99 96
100%.dtb:
101 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
102
103dtbs: scripts
104 $(Q)$(MAKE) $(build)=$(boot)/dts
105
106define archhelp 97define archhelp
107 @echo '* Image - Kernel ELF image with reset vector' 98 @echo '* Image - Kernel ELF image with reset vector'
108 @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' 99 @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
109 @echo '* uImage - U-Boot wrapped image' 100 @echo '* uImage - U-Boot wrapped image'
110 @echo ' dtbs - Build device tree blobs for enabled boards'
111endef 101endef
diff --git a/scripts/Makefile b/scripts/Makefile
index 61affa300d25..ece52ff20171 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -39,8 +39,7 @@ build_unifdef: $(obj)/unifdef
39subdir-$(CONFIG_MODVERSIONS) += genksyms 39subdir-$(CONFIG_MODVERSIONS) += genksyms
40subdir-y += mod 40subdir-y += mod
41subdir-$(CONFIG_SECURITY_SELINUX) += selinux 41subdir-$(CONFIG_SECURITY_SELINUX) += selinux
42subdir-$(CONFIG_DTC) += dtc
43subdir-$(CONFIG_GDB_SCRIPTS) += gdb 42subdir-$(CONFIG_GDB_SCRIPTS) += gdb
44 43
45# Let clean descend into subdirs 44# Let clean descend into subdirs
46subdir- += basic kconfig package gcc-plugins 45subdir- += basic dtc kconfig package gcc-plugins
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 61e596650ed3..8fe4468f9bda 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -283,7 +283,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
283 283
284quiet_cmd_dtc = DTC $@ 284quiet_cmd_dtc = DTC $@
285cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ 285cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
286 $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ 286 $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
287 $(DTC) -O dtb -o $@ -b 0 \ 287 $(DTC) -O dtb -o $@ -b 0 \
288 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \ 288 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
289 -d $(depfile).dtc.tmp $(dtc-tmp) ; \ 289 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 81c6f5132f12..056d5da6c477 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# scripts/dtc makefile 2# scripts/dtc makefile
3 3
4hostprogs-y := dtc 4hostprogs-$(CONFIG_DTC) := dtc
5always := $(hostprogs-y) 5always := $(hostprogs-y)
6 6
7dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ 7dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \