Skip to content

Commit 321f60d

Browse files
yihsin-hungasus-leslieyu
authored andcommitted
scripts/dtc: Update to upstream version 1.4.1
Includes the new localfixups format. Signed-off-by: Phil Elwell <phil@raspberrypi.org> scripts/dtc: Fix UMR causing corrupt dtbo overlay files struct fixup_entry is allocated from the heap but it's member local_fixup_generated was never initialized. This lead to corrupted dtbo files. Fix this by initializing local_fixup_generated to false. Signed-off-by: Matthias Reichl <hias@horus.com> scripts/dtc: Only emit local fixups for overlays Signed-off-by: Phil Elwell <phil@raspberrypi.org> build: support for .dtbo files for dtb overlays Kernel 4.4.6+ on RaspberryPi support .dtbo files for overlays, instead of .dtb. Patch the kernel, which has faulty rules to generate .dtbo the way yocto does Signed-off-by: Herve Jourdain <herve.jourdain@neuf.fr> Signed-off-by: Khem Raj <raj.khem@gmail.com> Change-Id: I1efe921f1b56ce5c5cf6f208485e7f22a07851f7 Signed-off-by: yi-hsin_hung <yi-hsin_hung@asus.com>
1 parent 3a896dc commit 321f60d

19 files changed

Lines changed: 1340 additions & 684 deletions

arch/arm/Makefile

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ $(INSTALL_TARGETS):
333333

334334
%.dtb: | scripts
335335
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
336+
%.dtbo: | scripts
337+
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
336338

337339
PHONY += dtbs dtbs_install
338340

arch/arm/boot/dts/Makefile

100644100755
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -783,20 +783,21 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
783783
mt8127-moose.dtb \
784784
mt8135-evbp1.dtb
785785
dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb
786-
endif
787786

788-
dtstree := $(srctree)/$(src)
789-
dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
787+
targets += dtbs dtbs_install
788+
targets += $(dtb-y)
790789

791-
DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES))
792-
ifneq ($(DTB_NAMES),)
793-
DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
794-
else
795-
DTB_LIST := $(dtb-y)
796790
endif
797791

798-
targets += dtbs dtbs_install
799-
targets += $(DTB_LIST)
792+
dtstree := $(srctree)/$(src)
793+
dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
800794

801-
always := $(DTB_LIST)
795+
always := $(dtb-y)
796+
subdir-y := overlays
802797
clean-files := *.dtb
798+
799+
# Enable fixups to support overlays on BCM2835 platforms
800+
ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
801+
DTC_FLAGS ?= -@ -H epapr
802+
dts-dirs += overlays
803+
endif
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Overlays for the Tinker board platform
2+
3+
dtbo-$(CONFIG_ARCH_ROCKCHIP) += \
4+
hifiberry-dac-amp.dtbo \
5+
6+
targets += dtbs dtbs_install
7+
targets += $(dtbo-y)
8+
9+
always := $(dtbo-y)
10+
clean-files := *.dtbo
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
/ {
5+
compatible = "rockchip,rk3288";
6+
7+
fragment@0 {
8+
target-path = "/i2c@ff140000";
9+
__overlay__ {
10+
pcm5122: pcm5122 {
11+
#sound-dai-cells = <0>;
12+
compatible = "ti,pcm5122";
13+
reg = <0x4c>;
14+
status = "okay";
15+
};
16+
};
17+
18+
};
19+
20+
21+
fragment@1 {
22+
target-path ="/sound-simple-card";
23+
__overlay__ {
24+
simple-audio-card,codec {
25+
sound-dai = <&pcm5122>;
26+
};
27+
};
28+
};
29+
30+
fragment@2 {
31+
target-path = "/i2s@ff890000";
32+
__overlay__ {
33+
rockchip,xfer-mode = <1>;
34+
};
35+
};
36+
37+
};

scripts/Makefile.dtbinst

100644100755
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ifeq ("$(dtbinst-root)", "$(obj)")
2929
endif
3030

3131
dtbinst-files := $(dtb-y)
32+
dtboinst-files := $(dtbo-y)
3233
dtbinst-dirs := $(dts-dirs)
3334

3435
# Helper targets for Installing DTBs into the boot directory
@@ -37,15 +38,18 @@ quiet_cmd_dtb_install = INSTALL $<
3738

3839
install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
3940

40-
$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep
41+
$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep
4142

4243
$(dtbinst-files): %.dtb: $(obj)/%.dtb
4344
$(call cmd,dtb_install,$(install-dir))
4445

46+
$(dtboinst-files): %.dtbo: $(obj)/%.dtbo
47+
$(call cmd,dtb_install,$(install-dir))
48+
4549
$(dtbinst-dirs):
4650
$(Q)$(MAKE) $(dtbinst)=$(obj)/$@
4751

48-
PHONY += $(dtbinst-files) $(dtbinst-dirs)
49-
__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
52+
PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs)
53+
__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs)
5054

5155
.PHONY: $(PHONY)

scripts/Makefile.lib

100644100755
Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m))
4848

4949
# if $(foo-objs) exists, foo.o is a composite object
5050
multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
51-
multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
51+
multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m))))
5252
multi-used := $(multi-used-y) $(multi-used-m)
5353
single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
5454

@@ -67,7 +67,7 @@ obj-dirs := $(dir $(multi-objs) $(obj-y))
6767

6868
# Replace multi-part objects by their individual parts, look at local dir only
6969
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
70-
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
70+
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
7171

7272
# Add subdir path
7373

@@ -96,16 +96,17 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
9696
# Note: Files that end up in two or more modules are compiled without the
9797
# KBUILD_MODNAME definition. The reason is that any made-up name would
9898
# differ in different configs.
99-
name-fix = $(subst $(comma),_,$(subst -,_,$1))
100-
basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
99+
name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)
100+
basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
101101
modname_flags = $(if $(filter 1,$(words $(modname))),\
102-
-D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
102+
-DKBUILD_MODNAME=$(call name-fix,$(modname)))
103103

104104
orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
105105
$(ccflags-y) $(CFLAGS_$(basetarget).o)
106106
_c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
107-
_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
107+
orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
108108
$(asflags-y) $(AFLAGS_$(basetarget).o)
109+
_a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags))
109110
_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
110111

111112
#
@@ -129,6 +130,18 @@ _c_flags += $(if $(patsubst n%,, \
129130
$(CFLAGS_KASAN))
130131
endif
131132

133+
ifeq ($(CONFIG_UBSAN),y)
134+
_c_flags += $(if $(patsubst n%,, \
135+
$(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)$(CONFIG_UBSAN_SANITIZE_ALL)), \
136+
$(CFLAGS_UBSAN))
137+
endif
138+
139+
ifeq ($(CONFIG_KCOV),y)
140+
_c_flags += $(if $(patsubst n%,, \
141+
$(KCOV_INSTRUMENT_$(basetarget).o)$(KCOV_INSTRUMENT)$(CONFIG_KCOV_INSTRUMENT_ALL)), \
142+
$(CFLAGS_KCOV))
143+
endif
144+
132145
# If building the kernel in a separate objtree expand all occurrences
133146
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
134147

@@ -142,14 +155,15 @@ else
142155
# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
143156
# and locates generated .h files
144157
# FIXME: Replace both with specific CFLAGS* statements in the makefiles
145-
__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags)
158+
__c_flags = $(if $(obj),-I$(srctree)/$(src) -I$(obj)) \
159+
$(call flags,_c_flags)
146160
__a_flags = $(call flags,_a_flags)
147161
__cpp_flags = $(call flags,_cpp_flags)
148162
endif
149163

150164
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
151165
$(__c_flags) $(modkern_cflags) \
152-
-D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
166+
$(basename_flags) $(modname_flags)
153167

154168
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
155169
$(__a_flags) $(modkern_aflags)
@@ -262,6 +276,12 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
262276

263277
# DTC
264278
# ---------------------------------------------------------------------------
279+
DTC ?= $(objtree)/scripts/dtc/dtc
280+
281+
# Disable noisy checks by default
282+
ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
283+
DTC_FLAGS += -Wno-unit_address_vs_reg
284+
endif
265285

266286
# Generate an assembly file to wrap the output of the device tree compiler
267287
quiet_cmd_dt_S_dtb= DTB $@
@@ -284,21 +304,26 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
284304
quiet_cmd_dtc = DTC $@
285305
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
286306
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
287-
$(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
307+
$(DTC) -O dtb -o $@ -b 0 \
288308
-i $(dir $<) $(DTC_FLAGS) \
289309
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
290310
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
291311

292312
$(obj)/%.dtb: $(src)/%.dts FORCE
293313
$(call if_changed_dep,dtc)
294314

295-
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
315+
quiet_cmd_dtco = DTCO $@
316+
cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
317+
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
318+
$(DTC) -@ -H epapr -O dtb -o $@ -b 0 \
319+
-i $(dir $<) $(DTC_FLAGS) \
320+
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
321+
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
296322

297-
# cat
298-
# ---------------------------------------------------------------------------
299-
# Concatentate multiple files together
300-
quiet_cmd_cat = CAT $@
301-
cmd_cat = (cat $(filter-out FORCE,$^) > $@) || (rm -f $@; false)
323+
$(obj)/%.dtbo: $(src)/%-overlay.dts FORCE
324+
$(call if_changed_dep,dtco)
325+
326+
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
302327

303328
# Bzip2
304329
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)