Makefile: Integrate CHID files into the build

When CONFIG_CHID is enabled, U-Boot must have access to a set of CHIDs
which it can use to identfy the hardware it is running on.

Add support for reading a hwids/compatible.hwidmap file in the board
directory and including the information in the board's devicetree.

This works by running the hwids_to_dtsi.py.py script and putting the
result in the dtsi_include_list variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-09-02 13:53:23 -06:00
parent ada443accb
commit a9e04b5d36

View File

@@ -204,6 +204,21 @@ ifdef DEVICE_TREE_DEBUG
u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw)) u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw))
endif endif
# Computer Hardware Identification (CHID)
# Convert files mentioned in the compatible.hwidmap file into .dtsi includes for
# addition to the board's devicetree.
ifdef CONFIG_CHID
chid_hwids_dtsi=hwids.dtsi
quiet_cmd_chid_dtsi_gen = CHID_DTSI_GEN $@
cmd_chid_dtsi_gen = $(srctree)/scripts/hwids_to_dtsi.py \
-m $(srctree)/board/$(BOARDDIR)/hwids/compatible.hwidmap -o $@
$(obj)/$(chid_hwids_dtsi): $(srctree)/board/$(BOARDDIR)/hwids/compatible.hwidmap \
$(wildcard $(srctree)/board/$(BOARDDIR)/hwids/*.txt) FORCE
$(call cmd,chid_dtsi_gen)
endif
# We use the first match to be included # We use the first match to be included
dtsi_include_list = $(strip $(u_boot_dtsi_options_debug) \ dtsi_include_list = $(strip $(u_boot_dtsi_options_debug) \
$(notdir $(firstword $(u_boot_dtsi_options)))) $(notdir $(firstword $(u_boot_dtsi_options))))
@@ -429,6 +444,12 @@ quiet_cmd_dtb = $(quiet_cmd_dtc)
cmd_dtb = $(cmd_dtc) cmd_dtb = $(cmd_dtc)
endif endif
# Add CHID dependency to dtsi_include_list
ifdef CONFIG_CHID
dtsi_include_list += $(chid_hwids_dtsi)
dtsi_include_list_deps += $(obj)/$(chid_hwids_dtsi)
endif
$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) $(DT_TMP_SCHEMA) FORCE $(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) $(DT_TMP_SCHEMA) FORCE
$(call if_changed_dep,dtb) $(call if_changed_dep,dtb)