Commit d6a0c78a4efb1353f4ec6f6c59c0771298510f58
Committed by
Tom Rini
1 parent
15b97f5c5e
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
pylibfdt: compile pylibfdt only when dtoc/binman is necessary
Currently, pylibfdt is always compiled if swig is installed on your machine. It is really annoying because most of targets (excepts x86, sunxi, rockchip) do not use dtoc or binman. "checkbinman" and "checkdtoc" are wrong. It is odd that the final build stage checks if we have built necessary tools. If your platform depends on dtoc/binman, you must be able to build pylibfdt. If swig is not installed, it should fail immediately. I added PYLIBFDT, DTOC, BINMAN entries to Kconfig. They should be property select:ed by platforms that need them. Kbuild will descend into scripts/dtc/pylibfdt/ only when CONFIG_PYLIBFDT is enabled. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Showing 6 changed files with 20 additions and 29 deletions Side-by-side Diff
Makefile
... | ... | @@ -1135,7 +1135,7 @@ |
1135 | 1135 | |
1136 | 1136 | u-boot.rom: u-boot-x86-16bit.bin u-boot.bin \ |
1137 | 1137 | $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \ |
1138 | - $(if $(CONFIG_HAVE_REFCODE),refcode.bin) checkbinman FORCE | |
1138 | + $(if $(CONFIG_HAVE_REFCODE),refcode.bin) FORCE | |
1139 | 1139 | $(call if_changed,binman) |
1140 | 1140 | |
1141 | 1141 | OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec |
... | ... | @@ -1144,8 +1144,7 @@ |
1144 | 1144 | endif |
1145 | 1145 | |
1146 | 1146 | ifneq ($(CONFIG_ARCH_SUNXI),) |
1147 | -u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb \ | |
1148 | - checkbinman FORCE | |
1147 | +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE | |
1149 | 1148 | $(call if_changed,binman) |
1150 | 1149 | endif |
1151 | 1150 | |
... | ... | @@ -1378,18 +1377,6 @@ |
1378 | 1377 | |
1379 | 1378 | $(timestamp_h): $(srctree)/Makefile FORCE |
1380 | 1379 | $(call filechk,timestamp.h) |
1381 | - | |
1382 | -checkbinman: tools | |
1383 | - @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt $(PYTHON) )); then \ | |
1384 | - echo >&2; \ | |
1385 | - echo >&2 '*** binman needs the Python libfdt library.'; \ | |
1386 | - echo >&2 '*** Either install it on your system, or try:'; \ | |
1387 | - echo >&2 '***'; \ | |
1388 | - echo >&2 '*** sudo apt-get install swig libpython-dev'; \ | |
1389 | - echo >&2 '***'; \ | |
1390 | - echo >&2 '*** to have U-Boot build its own version.'; \ | |
1391 | - false; \ | |
1392 | - fi | |
1393 | 1380 | |
1394 | 1381 | # --------------------------------------------------------------------------- |
1395 | 1382 | quiet_cmd_cpp_lds = LDS $@ |
arch/arm/Kconfig
arch/x86/Kconfig
dts/Kconfig
... | ... | @@ -8,6 +8,17 @@ |
8 | 8 | config DTC |
9 | 9 | bool |
10 | 10 | |
11 | +config PYLIBFDT | |
12 | + bool | |
13 | + | |
14 | +config DTOC | |
15 | + bool | |
16 | + select PYLIBFDT | |
17 | + | |
18 | +config BINMAN | |
19 | + bool | |
20 | + select DTOC | |
21 | + | |
11 | 22 | menu "Device Tree Control" |
12 | 23 | depends on SUPPORT_OF_CONTROL |
13 | 24 | |
... | ... | @@ -231,6 +242,7 @@ |
231 | 242 | config SPL_OF_PLATDATA |
232 | 243 | bool "Generate platform data for use in SPL" |
233 | 244 | depends on SPL_OF_CONTROL |
245 | + select DTOC | |
234 | 246 | help |
235 | 247 | For very constrained SPL environments the overhead of decoding |
236 | 248 | device tree nodes and converting their contents into platform data |
... | ... | @@ -252,6 +264,7 @@ |
252 | 264 | config TPL_OF_PLATDATA |
253 | 265 | bool "Generate platform data for use in TPL" |
254 | 266 | depends on TPL_OF_CONTROL |
267 | + select DTOC | |
255 | 268 | help |
256 | 269 | For very constrained SPL environments the overhead of decoding |
257 | 270 | device tree nodes and converting their contents into platform data |
scripts/Makefile.spl
... | ... | @@ -276,10 +276,10 @@ |
276 | 276 | dts_dir: |
277 | 277 | $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) |
278 | 278 | |
279 | -include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc | |
279 | +include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir FORCE | |
280 | 280 | $(call if_changed,dtoch) |
281 | 281 | |
282 | -$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc | |
282 | +$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir FORCE | |
283 | 283 | $(call if_changed,dtocc) |
284 | 284 | |
285 | 285 | ifdef CONFIG_SAMSUNG |
... | ... | @@ -379,17 +379,6 @@ |
379 | 379 | $(cmd_files): ; # Do not try to update included dependency files |
380 | 380 | include $(cmd_files) |
381 | 381 | endif |
382 | - | |
383 | -checkdtoc: tools | |
384 | - @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt $(PYTHON) )); then \ | |
385 | - echo '*** dtoc needs the Python libfdt library. Either '; \ | |
386 | - echo '*** install it on your system, or try:'; \ | |
387 | - echo '***'; \ | |
388 | - echo '*** sudo apt-get install swig libpython-dev'; \ | |
389 | - echo '***'; \ | |
390 | - echo '*** to have U-Boot build its own version.'; \ | |
391 | - false; \ | |
392 | - fi | |
393 | 382 | |
394 | 383 | PHONY += FORCE |
395 | 384 | FORCE: |
scripts/dtc/Makefile