Skip to content

Commit 78046fa

Browse files
committed
kbuild: determine the output format of DTC by the target suffix
cmd_dtc takes the additional parameter $(2) to select the target format, dtb or yaml. This makes things complicated when it is used with cmd_and_fixdep and if_changed_rule. I actually stumbled on this. See commit 3d4b223 ("kbuild: fix DT binding schema rule again to avoid needless rebuilds"). Extract the suffix part of the target instead of passing the parameter. Fortunately, this works for both $(obj)/%.dtb and $(obj)/%.dt.yaml . Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 1ca0c2f commit 78046fa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎scripts/Makefile.lib‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,13 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
287287
quiet_cmd_dtc = DTC $@
288288
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
289289
$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
290-
$(DTC) -O $(2) -o $@ -b 0 \
290+
$(DTC) -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
291291
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
292292
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
293293
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
294294

295295
$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
296-
$(call if_changed_dep,dtc,dtb)
296+
$(call if_changed_dep,dtc)
297297

298298
DT_CHECKER ?= dt-validate
299299
DT_BINDING_DIR := Documentation/devicetree/bindings
@@ -304,7 +304,7 @@ quiet_cmd_dtb_check = CHECK $@
304304
cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@
305305

306306
define rule_dtc
307-
$(call cmd_and_fixdep,dtc,yaml)
307+
$(call cmd_and_fixdep,dtc)
308308
$(call cmd,dtb_check)
309309
endef
310310

0 commit comments

Comments
 (0)