u-boot-brain/tools/dtoc
Simon Glass 8490c578f4 dtoc: Only generate the required files
At present all possible files are generated, even if some of them just
have a header and an empty body. It is better to generate only the files
that are needed, so that the two types of build (based on the setting of
OF_PLATDATA_INST) can be mutually exclusive.

This is intended to fix a strange problem sometimes found with CI:

   Building current source for 1 boards (1 thread, 40 jobs per thread)
      sandbox:  +   sandbox_spl
   +drivers/built-in.o: In function `dm_setup_inst':
   +drivers/core/root.c:135: undefined reference to
   `_u_boot_list_2_udevice_2_root'
   +dts/dt-uclass.o:(.u_boot_list_2_uclass_2_serial+0x10): undefined
   reference to `_u_boot_list_2_udevice_2_serial'
   ...

This likely happens when switching from !OF_PLATDATA_INST to
OF_PLATDATA_INST since running 'make xxx_defconfig" does not currently
cause any change in which files are generated. With !OF_PLATDATA_INST
the dt-device.c file has no declarations and this is assumed to be the
starting state. The error above seems to indicate that, after changing
to OF_PLATDATA_INST, the dt-uclass.c file is regenerated but the
dt-device.c files is not. This does not seem possible from the relevant
Makefile.spl rule:

   u-boot-spl-platdata := $(obj)/dts/dt-plat.o $(obj)/dts/dt-uclass.o
	$(obj)/dts/dt-device.o

   cmd_dtoc = $(DTOC_ARGS) -c $(obj)/dts -C include/generated all

   include/generated/dt-structs-gen.h $(u-boot-spl-platdata_c) &: \
		$(obj)/$(SPL_BIN).dtb
	@[ -d $(obj)/dts ] || mkdir -p $(obj)/dts
	$(call if_changed,dtoc)

It seems that this cannot regenerate dt-uclass.c without dt-device.c since
'dtoc all' is used. So here the trail ends for now.

In any case it seems better to generate files that are uses and not bother
with those that serve no purpose. So update dtoc to do this automatically.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26 17:03:08 +13:00
..
test dtoc: Read aliases for uclasses 2021-03-22 19:23:27 +13:00
.gitignore dm: Add a library to provide simple device-tree access 2016-07-14 20:40:24 -06:00
dtb_platdata.py dtoc: Only generate the required files 2021-03-26 17:03:08 +13:00
dtoc dtoc: Rename the main module 2020-04-26 14:25:21 -06:00
fdt_util.py binman: Use target-specific tools when cross-compiling 2020-09-22 12:54:13 -06:00
fdt.py binman: Support alignment of files 2021-01-30 14:25:41 -07:00
main.py dtoc: Add an option for device instantiation 2021-03-22 19:23:27 +13:00
setup.py dtoc: Add a setup script for Python 2020-08-22 08:53:38 -06:00
src_scan.py dtoc: Support processing the root node 2021-03-22 19:23:27 +13:00
test_dtoc.py dtoc: Only generate the required files 2021-03-26 17:03:08 +13:00
test_fdt dtoc: Add some tests for the fdt module 2018-07-09 09:11:00 -06:00
test_fdt.py dtoc: Move test files into a test/ directory 2021-03-22 19:23:27 +13:00
test_src_scan.py dtoc: Support processing the root node 2021-03-22 19:23:27 +13:00