Skip to contentSkip to conversation

An effort to bring DT bindings compliance within U-Boot

PATCH Superseded Sumit Garg 9 participants 68 messages Dec 28, 2023 – Jan 9, 2024

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Sumit Garg

author
#0 lore raw

v3 cover An effort to bring DT bindings compliance within U-Boot

Changes in v3:
--------------
- Patch #4: Minor commit message update
- Patch #5: Replace CONFIG_* with Kconfig options
- Patch #7: Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.
- Patch #1, #3, #6 and #8: Picked up review tags

Changes in v2:
--------------
- Patch #1: excluded gitab CI config check and added commit description.
- Patch #3: s/UBOOT_DTSI_LOC/u_boot_dtsi_loc/
- Patch #4: s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/
- Patch #5: s/U-boot/U-Boot/
- Patch #6 and #7: Picked up review tags

Prerequisite
------------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-Boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-Boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-Boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-Boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows:

$ git subtree pull --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-Boot maintainers here [4]. Now we would like to reach out to wider U-Boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-Boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-Boot to run devicetree bindings schema checks which will bring compliance to U-Boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

It is also possible to run checks with a subset of matching schema files by setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or patterns (partial match of a fixed string). Each file or pattern should be separated by ':'.

$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
$ make dtbs_check DT_SCHEMA_FILES=/gpio/
$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml

Sumit Garg (8):
CI: Exclude devicetree-rebasing subtree for CONFIG checks
Makefile: Add support for DT bindings schema checks scripts/Makefile.lib: Statically define *-u-boot.dtsi files location
dts: Add alternative location for upstream DTB builds
doc: devicetree: Updates for devicetree-rebasing subtree
MAINTAINERS: Add myself as devicetree-rebasing maintainer
dts: meson-gxbb: Switch to using upstream DT
dts: meson-gxbb: Drop redundant devicetree files

 .azure-pipelines.yml                    |   3 +-
 .gitlab-ci.yml                          |   3 +-
 MAINTAINERS                             |   6 +
 Makefile                                |  20 +-
 arch/arm/dts/Makefile                   |   8 -
 arch/arm/dts/meson-gxbb-kii-pro.dts     | 140 ----
 arch/arm/dts/meson-gxbb-nanopi-k2.dts   | 415 ------------
 arch/arm/dts/meson-gxbb-odroidc2.dts    | 418 ------------
 arch/arm/dts/meson-gxbb-p200.dts        | 100 ---
 arch/arm/dts/meson-gxbb-p201.dts        |  26 -
 arch/arm/dts/meson-gxbb-p20x.dtsi       | 250 -------
 arch/arm/dts/meson-gxbb-wetek-hub.dts   |  58 --
 arch/arm/dts/meson-gxbb-wetek-play2.dts | 119 ----
 arch/arm/dts/meson-gxbb-wetek.dtsi      | 292 --------
 arch/arm/dts/meson-gxbb.dtsi            | 856 ------------------------
 arch/arm/mach-meson/Kconfig             |   1 +
 configs/nanopi-k2_defconfig             |   2 +-
 configs/odroid-c2_defconfig             |   2 +-
 configs/p200_defconfig                  |   2 +-
 configs/p201_defconfig                  |   2 +-
 configs/videostrong-kii-pro_defconfig   |   2 +-
 configs/wetek-hub_defconfig             |   2 +-
 configs/wetek-play2_defconfig           |   2 +-
 doc/develop/devicetree/control.rst      | 131 +++-
 dts/Kconfig                             |  11 +
 dts/Makefile                            |  17 +-
 dts/arch/arm64/Makefile                 |  14 +
 dts/arch/arm64/amlogic                  |   1 +
 scripts/Makefile.lib                    |  42 +-
 29 files changed, 201 insertions(+), 2744 deletions(-)
 delete mode 100644 arch/arm/dts/meson-gxbb-kii-pro.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-nanopi-k2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p200.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p201.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p20x.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb.dtsi
 create mode 100644 dts/arch/arm64/Makefile
 create mode 120000 dts/arch/arm64/amlogic
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v3 1/8 CI: Exclude devicetree-rebasing subtree for CONFIG checks

Since devicetree-rebasing is an external repo with its own coding style, exclude it from Azure and gitlab CI CONFIG checks.

---

Changes in v3:
--------------
- Picked up review tag

Changes in v2:
--------------
- Excluded gitab CI config check and added commit description.

 .azure-pipelines.yml | 3 ++-
 .gitlab-ci.yml       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
.azure-pipelines.yml +2 -1
index d6f3fa423c6..f100c4493e6 100644
@@ -65,7 +65,8 @@ stages:
       # have no matches.
       - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-                  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+                  :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+                  exit 1 || exit 0
 
   - job: docs
     displayName: 'Build documentation'
.gitlab-ci.yml +2 -1
index fee165198ae..96ca9f72bbc 100644
@@ -161,7 +161,8 @@ check for new CONFIG symbols outside Kconfig:
     # have no matches.
     - git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
         :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-        :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+        :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+        exit 1 || exit 0
 
 # build documentation
 docs:
Signature · 1 line
2.34.1
Reviewed-by on v3 1/8
#2 lore raw

Re: [PATCH v3 1/8] CI: Exclude devicetree-rebasing subtree for CONFIG checks

Quoted 49 lines · Sumit Garg

Since devicetree-rebasing is an external repo with its own coding style, exclude it from Azure and gitlab CI CONFIG checks.

---

Changes in v3:
--------------
- Picked up review tag

Changes in v2:
--------------
- Excluded gitab CI config check and added commit description.

 .azure-pipelines.yml | 3 ++-
 .gitlab-ci.yml       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
.azure-pipelines.yml +2 -1
index d6f3fa423c6..f100c4493e6 100644
@@ -65,7 +65,8 @@ stages:
       # have no matches.
       - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-                  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+                  :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+                  exit 1 || exit 0
 
   - job: docs
     displayName: 'Build documentation'
.gitlab-ci.yml +2 -2
index fee165198ae..96ca9f72bbc 100644
@@ -161,7 +161,8 @@ check for new CONFIG symbols outside Kconfig:
     # have no matches.
     - git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
         :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-        :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+        :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+        exit 1 || exit 0
 
 # build documentation
 docs:
--
Quoted 2 lines

2.34.1

Reviewed-by
#3 lore raw

Re: [PATCH v3 1/8] CI: Exclude devicetree-rebasing subtree for CONFIG checks

Quoted 14 lines · Ilias Apalodimas
Quoted 12 lines · Sumit Garg

Since devicetree-rebasing is an external repo with its own coding style, exclude it from Azure and gitlab CI CONFIG checks.

---

Changes in v3:
--------------
- Picked up review tag

Quoted 7 lines
Quoted 7 lines

Changes in v2:
--------------
- Excluded gitab CI config check and added commit description.

 .azure-pipelines.yml | 3 ++-
 .gitlab-ci.yml       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
author
#4 lore raw

PATCH v3 2/8 Makefile: Add support for DT bindings schema checks

In reply to Sumit Garg

This adds the build infrastructure for checking DT binding schema documents and validating dtb files using the binding schema. Here we use devicetree-rebasing directory to provide the DT bindings.

Dependency:
-----------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip::

pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems::

apt install swig python3-dev

Testing:
--------

Build dts files and check using DT binding schema:

$ make dtbs_check

Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to use for validation. This makes it easier to find and fix errors generated by a specific schema.

Note, at this point dtbs_check is an optional build target as there are many warnings generated due to custom DT properties used by many platforms in u-boot. It is expected with these checks that compliance with DT bindings to take place. Once that's done it can be added to CI builds to remain compliant with DT bindings.

---

Changes in v3:
--------------
- None

Changes in v2:
--------------
- None

 Makefile             | 20 ++++++++++++++++++--
 scripts/Makefile.lib | 17 +++++++++++++++--
 2 files changed, 33 insertions(+), 4 deletions(-)
Makefile +18 -2
index 750bbdb1b71..d8d168cd4c3 100644
@@ -1158,12 +1158,28 @@ endif
 	@# disabling OF_BOARD.
 	$(call cmd,ofcheck,$(KCONFIG_CONFIG))
 
-PHONY += dtbs
+PHONY += dtbs dtbs_check
 dtbs: dts/dt.dtb
 	@:
-dts/dt.dtb: u-boot
+dts/dt.dtb: dtbs_prepare u-boot
 	$(Q)$(MAKE) $(build)=dts dtbs
 
+dtbs_prepare: prepare3
+
+ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
+export CHECK_DTBS=y
+endif
+
+ifneq ($(CHECK_DTBS),)
+dtbs_prepare: dt_binding_check
+endif
+
+dtbs_check: dt_binding_check dtbs
+
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+dt_binding_check: scripts_dtc
+	$(Q)$(MAKE) $(build)=$(DT_BINDING_DIR) $(DT_BINDING_DIR)/processed-schema.json
+
 quiet_cmd_copy = COPY    $@
       cmd_copy = cp $< $@
 
scripts/Makefile.lib +15 -2
index 16bbc277a9f..27b9437027c 100644
@@ -356,8 +356,21 @@ endif
 
 dtsi_include_list_deps = $(addprefix $(obj)/,$(subst $(quote),,$(dtsi_include_list)))
 
-$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) FORCE
-	$(call if_changed_dep,dtc)
+ifneq ($(CHECK_DTBS),)
+DT_CHECKER ?= dt-validate
+DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
+
+quiet_cmd_dtb = DTC_CHK $@
+      cmd_dtb = $(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
+else
+quiet_cmd_dtb = $(quiet_cmd_dtc)
+      cmd_dtb = $(cmd_dtc)
+endif
+
+$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) $(DT_TMP_SCHEMA) FORCE
+	$(call if_changed_dep,dtb)
 
 pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
Signature · 1 line
2.34.1
Reviewed-by Tested-by on v3 2/8
#5 lore raw

Re: [PATCH v3 2/8] Makefile: Add support for DT bindings schema checks

Quoted 42 lines · Sumit Garg

This adds the build infrastructure for checking DT binding schema documents and validating dtb files using the binding schema. Here we use devicetree-rebasing directory to provide the DT bindings.

Dependency:
-----------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip::

pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems::

apt install swig python3-dev

Testing:
--------

Build dts files and check using DT binding schema:

$ make dtbs_check

Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to use for validation. This makes it easier to find and fix errors generated by a specific schema.

Note, at this point dtbs_check is an optional build target as there are many warnings generated due to custom DT properties used by many platforms in u-boot. It is expected with these checks that compliance with DT bindings to take place. Once that's done it can be added to CI builds to remain compliant with DT bindings.

---

Changes in v3:
--------------
- None

Quoted 7 lines

Changes in v2:
--------------
- None

 Makefile             | 20 ++++++++++++++++++--
 scripts/Makefile.lib | 17 +++++++++++++++--
 2 files changed, 33 insertions(+), 4 deletions(-)
author
#6 lore raw

PATCH v3 3/8 scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

In reply to Sumit Garg

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---

Changes in v3:
--------------
- Picked up review tags

Changes in v2:
--------------
- s/UBOOT_DTSI_LOC/u_boot_dtsi_loc/

 scripts/Makefile.lib | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
scripts/Makefile.lib +14 -11
index 27b9437027c..09330421856 100644
@@ -159,18 +159,20 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
 
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
-	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
-	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
-	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-	$(wildcard $(dir $<)u-boot.dtsi))
+u_boot_dtsi_loc = $(srctree)/arch/$(ARCH)/dts/
+
+u_boot_dtsi_options = $(strip $(wildcard $(u_boot_dtsi_loc)$(basename $(notdir $<))-u-boot.dtsi) \
+	$(wildcard $(u_boot_dtsi_loc)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
+	$(wildcard $(u_boot_dtsi_loc)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
+	$(wildcard $(u_boot_dtsi_loc)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
+	$(wildcard $(u_boot_dtsi_loc)u-boot.dtsi))
 
 u_boot_dtsi_options_raw = $(warning Automatic .dtsi inclusion: options: \
-	$(dir $<)$(basename $(notdir $<))-u-boot.dtsi \
-	$(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
-	$(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
-	$(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
-	$(dir $<)u-boot.dtsi ... \
+	$(u_boot_dtsi_loc)$(basename $(notdir $<))-u-boot.dtsi \
+	$(u_boot_dtsi_loc)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
+	$(u_boot_dtsi_loc)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
+	$(u_boot_dtsi_loc)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
+	$(u_boot_dtsi_loc)u-boot.dtsi ... \
 	found: $(if $(u_boot_dtsi_options),"$(u_boot_dtsi_options)",nothing!))
 
 # Uncomment for debugging
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 		 $(UBOOTINCLUDE)                                         \
 		 -I$(dir $<)                                             \
+		 -I$(u_boot_dtsi_loc)                                     \
 		 -I$(srctree)/arch/$(ARCH)/dts/include                   \
 		 -I$(srctree)/include                                    \
 		 -D__ASSEMBLY__                                          \
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
 	  echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
 	$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
 	$(DTC) -O dtb -o $@ -b 0 \
-		-i $(dir $<) $(DTC_FLAGS) \
+		-i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
 		-d $(depfile).dtc.tmp $(dtc-tmp) || \
 		(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
 		; \
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Hi Sumit!

On December 28, 2023 thus sayeth Sumit Garg:

Quoted 15 lines

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---

...

Quoted 5 lines
scripts/Makefile.lib +0 -0
index 27b9437027c..09330421856 100644

...

Quoted 10 lines

# Uncomment for debugging

scripts/Makefile.lib +1 -0
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 		 $(UBOOTINCLUDE)                                         \
 		 -I$(dir $<)                                             \
+		 -I$(u_boot_dtsi_loc)                                     \
 		 -I$(srctree)/arch/$(ARCH)/dts/include                   \
 		 -I$(srctree)/include                                    \
 		 -D__ASSEMBLY__                                          \

scripts/Makefile.lib cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ · line 337

Quoted 8 lines
scripts/Makefile.lib +1 -1
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
 	  echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
 	$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
 	$(DTC) -O dtb -o $@ -b 0 \
-		-i $(dir $<) $(DTC_FLAGS) \
+		-i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
 		-d $(depfile).dtc.tmp $(dtc-tmp) || \
 		(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
 		; \

One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt directory is when we have U-Boot board files that use dtsi files in the OF_UPSTREAM folder.

For example our reference boards uses the primary bootloader's dtb (eg:
k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be found in the OF_UPSTREAM directory and modifies it to give it the perspective of the micro-controller it will be running on during boot.

What do you think if we have both paths included regardless if OF_UPSTREAM is selected or not? IDK if this will break anyone else

~Bryan

author
#8 lore raw

Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Hi Bryan,

Quoted 53 lines · Bryan Brattlof

Hi Sumit!

On December 28, 2023 thus sayeth Sumit Garg:

Quoted 15 lines

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---

...

Quoted 5 lines
scripts/Makefile.lib +0 -0
index 27b9437027c..09330421856 100644

...

Quoted 10 lines

# Uncomment for debugging

scripts/Makefile.lib +1 -0
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
               $(UBOOTINCLUDE)                                         \
               -I$(dir $<)                                             \
+              -I$(u_boot_dtsi_loc)                                     \
               -I$(srctree)/arch/$(ARCH)/dts/include                   \
               -I$(srctree)/include                                    \
               -D__ASSEMBLY__                                          \

scripts/Makefile.lib cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ · line 337

Quoted 8 lines
scripts/Makefile.lib +1 -1
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
        echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
      $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
      $(DTC) -O dtb -o $@ -b 0 \
-             -i $(dir $<) $(DTC_FLAGS) \
+             -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
              -d $(depfile).dtc.tmp $(dtc-tmp) || \
              (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
              ; \

One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt directory is when we have U-Boot board files that use dtsi files in the OF_UPSTREAM folder.

Quoted 4 lines

For example our reference boards uses the primary bootloader's dtb (eg:
k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be found in the OF_UPSTREAM directory and modifies it to give it the perspective of the micro-controller it will be running on during boot.

Thanks for bringing this up. I have been playing with the idea to reuse DT includes from upstream.

Quoted 3 lines

What do you think if we have both paths included regardless if OF_UPSTREAM is selected or not? IDK if this will break anyone else

Sure, we should be able to do that if we maintain the correct order of include paths as per following patch [1]. If this works for you let me know and I will include it for v4.

[1]

commit 7fcebc044c69c57b43ff0e59f2d8c3713bc68b6c

Author: Sumit Garg <[email protected]>
Date:   Tue Jan 2 19:20:01 2024 +0530

Makefile: Allow upstream DT subtree to provide DT includes

Allow platforms to reuse DT headers and dtsi includes directly form upstream DT subtree which will be frequently synced with Linux kernel. This will further allow us to drop corresponding DT includes copy from U-Boot tree.

Also, since the DT includes from upstream DT subtree are done after DT includes from U-Boot tree, so it shouldn't cause any conflicts.

Makefile +2 -1
index d8d168cd4c3..0160e827a29 100644
@@ -834,7 +834,8 @@ UBOOTINCLUDE    := \
                                -I$(srctree)/arch/arm/thumb1/include), \
                        -I$(srctree)/arch/arm/thumb1/include)) \
        -I$(srctree)/arch/$(ARCH)/include \
-       -include $(srctree)/include/linux/kconfig.h
+       -include $(srctree)/include/linux/kconfig.h \
+       -I$(srctree)/devicetree-rebasing/include
 
 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 
scripts/Makefile.lib +2 -0
index 09330421856..30033092597 100644
@@ -189,12 +189,17 @@ dtsi_include_list = $(strip $(u_boot_dtsi_options_debug) \
 dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 
 # Modified for U-Boot
+upstream_dtsi_include = $(addprefix -I, $(srctree)/devicetree-rebasing/src/ \
+       $(sort $(dir $(wildcard

$(srctree)/devicetree-rebasing/src/$(ARCH)/*/*))) \
+ $(if (CONFIG_ARM64), \
+ $(sort $(dir $(wildcard
$(srctree)/devicetree-rebasing/src/arm64/*/*)))))

 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
                 $(UBOOTINCLUDE)                                         \
                 -I$(dir $<)                                             \
                 -I$(u_boot_dtsi_loc)                                     \
                 -I$(srctree)/arch/$(ARCH)/dts/include                   \
                 -I$(srctree)/include                                    \
+                $(upstream_dtsi_include)                                \
                 -D__ASSEMBLY__                                          \
                 -undef -D__DTS__

-Sumit

#9 lore raw

Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

On January 8, 2024 thus sayeth Sumit Garg:

Quoted 65 lines

Hi Bryan,

Quoted 53 lines · Bryan Brattlof

Hi Sumit!

On December 28, 2023 thus sayeth Sumit Garg:

Quoted 15 lines

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---

...

Quoted 5 lines
scripts/Makefile.lib +0 -0
index 27b9437027c..09330421856 100644

...

Quoted 10 lines

# Uncomment for debugging

scripts/Makefile.lib +1 -0
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
               $(UBOOTINCLUDE)                                         \
               -I$(dir $<)                                             \
+              -I$(u_boot_dtsi_loc)                                     \
               -I$(srctree)/arch/$(ARCH)/dts/include                   \
               -I$(srctree)/include                                    \
               -D__ASSEMBLY__                                          \

scripts/Makefile.lib cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ · line 337

Quoted 8 lines
scripts/Makefile.lib +1 -1
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
        echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
      $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
      $(DTC) -O dtb -o $@ -b 0 \
-             -i $(dir $<) $(DTC_FLAGS) \
+             -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
              -d $(depfile).dtc.tmp $(dtc-tmp) || \
              (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
              ; \

One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt directory is when we have U-Boot board files that use dtsi files in the OF_UPSTREAM folder.

Quoted 4 lines

For example our reference boards uses the primary bootloader's dtb (eg:
k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be found in the OF_UPSTREAM directory and modifies it to give it the perspective of the micro-controller it will be running on during boot.

Thanks for bringing this up. I have been playing with the idea to reuse DT includes from upstream.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

What do you think if we have both paths included regardless if OF_UPSTREAM is selected or not? IDK if this will break anyone else

Sure, we should be able to do that if we maintain the correct order of include paths as per following patch [1]. If this works for you let me know and I will include it for v4.

This works beautifully.

I did have to hack around to get Makefile.spl working but this is headed in the right direction for me :)

Thank you
~Bryan

author
#10 lore raw

Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Quoted 75 lines · Bryan Brattlof

On January 8, 2024 thus sayeth Sumit Garg:

Quoted 65 lines

Hi Bryan,

Quoted 53 lines · Bryan Brattlof

Hi Sumit!

On December 28, 2023 thus sayeth Sumit Garg:

Quoted 15 lines

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---

...

Quoted 5 lines
scripts/Makefile.lib +0 -0
index 27b9437027c..09330421856 100644

...

Quoted 10 lines

# Uncomment for debugging

scripts/Makefile.lib +1 -0
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
               $(UBOOTINCLUDE)                                         \
               -I$(dir $<)                                             \
+              -I$(u_boot_dtsi_loc)                                     \
               -I$(srctree)/arch/$(ARCH)/dts/include                   \
               -I$(srctree)/include                                    \
               -D__ASSEMBLY__                                          \

scripts/Makefile.lib cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ · line 337

Quoted 8 lines
scripts/Makefile.lib +1 -1
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
        echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
      $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
      $(DTC) -O dtb -o $@ -b 0 \
-             -i $(dir $<) $(DTC_FLAGS) \
+             -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
              -d $(depfile).dtc.tmp $(dtc-tmp) || \
              (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
              ; \

One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt directory is when we have U-Boot board files that use dtsi files in the OF_UPSTREAM folder.

Quoted 4 lines

For example our reference boards uses the primary bootloader's dtb (eg:
k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be found in the OF_UPSTREAM directory and modifies it to give it the perspective of the micro-controller it will be running on during boot.

Thanks for bringing this up. I have been playing with the idea to reuse DT includes from upstream.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

What do you think if we have both paths included regardless if OF_UPSTREAM is selected or not? IDK if this will break anyone else

Sure, we should be able to do that if we maintain the correct order of include paths as per following patch [1]. If this works for you let me know and I will include it for v4.

Quoted 4 lines

This works beautifully.

I did have to hack around to get Makefile.spl working but this is headed in the right direction for me :)

Thanks for testing. I hope I can take that as a tested-by tag for this patch.

-Sumit

Quoted 3 lines

Thank you
~Bryan

Tested-by
#11 lore raw

Re: [PATCH v3 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

On January 9, 2024 thus sayeth Sumit Garg:

Quoted 76 lines · Bryan Brattlof
Quoted 75 lines

On January 8, 2024 thus sayeth Sumit Garg:

Quoted 72 lines

Hi Bryan,

Quoted 53 lines · Bryan Brattlof

Hi Sumit!

On December 28, 2023 thus sayeth Sumit Garg:

Quoted 15 lines

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---

...

Quoted 5 lines
scripts/Makefile.lib +0 -0
index 27b9437027c..09330421856 100644

...

Quoted 10 lines

# Uncomment for debugging

scripts/Makefile.lib +1 -0
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
               $(UBOOTINCLUDE)                                         \
               -I$(dir $<)                                             \
+              -I$(u_boot_dtsi_loc)                                     \
               -I$(srctree)/arch/$(ARCH)/dts/include                   \
               -I$(srctree)/include                                    \
               -D__ASSEMBLY__                                          \

scripts/Makefile.lib cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ · line 337

Quoted 8 lines
scripts/Makefile.lib +1 -1
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
        echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
      $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
      $(DTC) -O dtb -o $@ -b 0 \
-             -i $(dir $<) $(DTC_FLAGS) \
+             -i $(dir $<) -i $(u_boot_dtsi_loc) $(DTC_FLAGS) \
              -d $(depfile).dtc.tmp $(dtc-tmp) || \
              (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
              ; \

One of the issues I see with having a separate OF_UPSTREAM and U-Boot dt directory is when we have U-Boot board files that use dtsi files in the OF_UPSTREAM folder.

Quoted 4 lines

For example our reference boards uses the primary bootloader's dtb (eg:
k3-am62a7-r5-sk.dts) which #includes the k3-am62a7-sk.dts that will be found in the OF_UPSTREAM directory and modifies it to give it the perspective of the micro-controller it will be running on during boot.

Thanks for bringing this up. I have been playing with the idea to reuse DT includes from upstream.

Quoted 3 lines

What do you think if we have both paths included regardless if OF_UPSTREAM is selected or not? IDK if this will break anyone else

Sure, we should be able to do that if we maintain the correct order of include paths as per following patch [1]. If this works for you let me know and I will include it for v4.

Quoted 7 lines
Quoted 4 lines

This works beautifully.

I did have to hack around to get Makefile.spl working but this is headed in the right direction for me :)

Thanks for testing. I hope I can take that as a tested-by tag for this patch.

Absolutely

~Bryan

author
#12 lore raw

PATCH v3 4/8 dts: Add alternative location for upstream DTB builds

In reply to Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +11 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
 	  enables a live tree which is available after relocation,
 	  and can be adjusted as needed.
 
+config OF_UPSTREAM
+	bool "Enable use of devicetree imported from Linux kernel release"
+	help
+	  Traditionally, U-Boot platforms used to have their custom devicetree
+	  files or copy devicetree files from Linux kernel which are hard to
+	  maintain and can usually get out-of-sync from Linux kernel. This
+	  option enables platforms to migrate to devicetree-rebasing repo where
+	  a regular sync will be maintained every major Linux kernel release
+	  cycle. However, platforms can still have some custom u-boot specific
+	  bits maintained as part of *-u-boot.dtsi files.
+
 choice
 	prompt "Provider of DTB for DT control"
 	depends on OF_CONTROL
dts/Makefile +14 -3
index 3437e54033d..68daaf45ec7 100644
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+dt_dir := dts/arch/arm64
+else
+dt_dir := dts/arch/$(ARCH)
+endif
+else
+dt_dir := arch/$(ARCH)/dts
+endif
+
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 else
-DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+DTB := $(dt_dir)/$(DEVICE_TREE).dtb
 endif
 
 $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
@@ -41,7 +51,7 @@ $(DTB): arch-dtbs
 
 PHONY += arch-dtbs
 arch-dtbs:
-	$(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
+	$(Q)$(MAKE) $(build)=$(dt_dir) dtbs
 
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
@@ -65,4 +75,5 @@ clean-files := dt.dtb.S
 # Let clean descend into dts directories
 subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts	\
 	   ../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts	\
-	   ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts
+	   ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts	\
+	   ./arch/arm64 ./arch/$(ARCH)
dts/arch/arm64/Makefile new file +14 -0
new file mode 100644
index 00000000000..16e9fea622d
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+include $(srctree)/scripts/Makefile.dts
+
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS += -a 0x8
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+	@:
+
+clean-files := */*.dtb */*.dtbo */*_HS
Signature · 1 line
2.34.1
#13 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

bool # Enable use of devicetree imported from Linux kernel release

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Quoted 56 lines
dts/Kconfig +1 -0
+
 choice
        prompt "Provider of DTB for DT control"
        depends on OF_CONTROL
dts/Makefile +14 -3
index 3437e54033d..68daaf45ec7 100644
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+dt_dir := dts/arch/arm64
+else
+dt_dir := dts/arch/$(ARCH)
+endif
+else
+dt_dir := arch/$(ARCH)/dts
+endif
+
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 else
-DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+DTB := $(dt_dir)/$(DEVICE_TREE).dtb
 endif
 
 $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
@@ -41,7 +51,7 @@ $(DTB): arch-dtbs
 
 PHONY += arch-dtbs
 arch-dtbs:
-       $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
+       $(Q)$(MAKE) $(build)=$(dt_dir) dtbs
 
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
@@ -65,4 +75,5 @@ clean-files := dt.dtb.S
 # Let clean descend into dts directories
 subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts     \
           ../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts     \
-          ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts
+          ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts        \
+          ./arch/arm64 ./arch/$(ARCH)
dts/arch/arm64/Makefile new file +4 -0
new file mode 100644
index 00000000000..16e9fea622d
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+include $(srctree)/scripts/Makefile.dts
+

dts/arch/arm64/Makefile line 14

Quoted 10 lines
dts/arch/arm64/Makefile new file +10 -0
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS += -a 0x8
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := */*.dtb */*.dtbo */*_HS

What is _HS for?

Quoted 3 lines

--
2.34.1

Regards,
Simon

#14 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 27 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

Quoted 7 lines

and get:

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

Quoted 14 lines
Quoted 14 lines
dts/arch/arm64/Makefile new file +8 -0
new file mode 100644
index 00000000000..16e9fea622d
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+include $(srctree)/scripts/Makefile.dts
+
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS += -a 0x8
Quoted 8 lines

dts/arch/arm64/Makefile line 14

Quoted 6 lines
dts/arch/arm64/Makefile new file +6 -0
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := */*.dtb */*.dtbo */*_HS

What is _HS for?

Should we even need the clean-files part here? I think this is fixed with:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Signature · 1 line
Tom
#15 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

[..]

Regards,
Simon

#16 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 153 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb
Quoted 3 lines

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.

Signature · 1 line
Tom
#17 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Tom,

Quoted 155 lines · Tom Rini
Quoted 153 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb
Quoted 8 lines
Quoted 3 lines

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

The problem I have described above applied to meson, so I believe it is clear enough with that. I wasn't able to get rk3399 going, but I am sure it would have the same problem.

The fundamental question is (I believe) whether to:

1. Build only a single DT for a board
2. Build all DTs for the SoC the board uses

This series seems to head towards (1), which worries me. We are currently mostly at (2).

Regards,
Simon

#18 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 162 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

But that's just an artifact of not having vendor directories. I don't really think we can sanely put the new object files in there, that's not what anyone is going to expect.

Quoted 3 lines

The problem I have described above applied to meson, so I believe it is clear enough with that. I wasn't able to get rk3399 going, but I am sure it would have the same problem.

I don't think meson has the problem I was asking about, which is what problem binman will have, because the series to make binman replace the vendor tools didn't complete? That's what I'm getting at, for which platform is binman going to have a problem today, so that we can look at what to do about it and evaluate solutions with an example in hand.

Quoted 7 lines

The fundamental question is (I believe) whether to:

1. Build only a single DT for a board
2. Build all DTs for the SoC the board uses

This series seems to head towards (1), which worries me. We are currently mostly at (2).

It's explicitly at (1) with the notion we'll deal with (2) down the road once there's a use case for it. Possibly once someone updates exynos platforms, based on what you had said previously?

Signature · 1 line
Tom
author
#19 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

In reply to Simon Glass
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

Quoted 11 lines

The problem I have described above applied to meson, so I believe it is clear enough with that. I wasn't able to get rk3399 going, but I am sure it would have the same problem.

The fundamental question is (I believe) whether to:

1. Build only a single DT for a board
2. Build all DTs for the SoC the board uses

This series seems to head towards (1),

v2 of this series had the Makefile rules [1] for meson gxbb SoC but..

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 2 lines

which worries me. We are
currently mostly at (2).

..after discussion with Tom, the Makefile rules are already coming via Kconfig options like DEFAULT_DEVICE_TREE, OF_LIST etc. So having redundant rules in Makefile doesn't add any value, so I took them off in v3.

However, I am very much in favour of having a generalized U-Boot image. This might become true in some cases like U-Boot acts as a second stage bootloader for a particular SoC which is a unified image where the prior stage passes the DT to it. The Qcom effort in this direction can be an example here. I am not sure at this point how we can enable different U-Boot features since there are many board specific bits needed currently not covered by DT.

The other common method is to embed board DT in U-Boot image especially where U-Boot acts as a first stage bootloader. Once that's done I don't see how we can call that a generic U-Boot image.

BTW, as Tom said we can very well add those Makefile rules later on a use case basis if a particular SoC requires a truly generic U-Boot image and the rules don't come via Kconfig options.

-Sumit

Quoted 3 lines

Regards,
Simon

#20 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these
2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit
3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)
4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

Possible options I see are:

a. Adjust U-Boot's dir structure to match Linux, first (but this might be painful?)
b. Create a script to sync the files, so we can sync into a dir structure that matches U-Boot
c. Add build rules to U-Boot's version of the devicetree-rebasing dir (this seems to be supported)
d. Give up and just live with having boards (not SoCs) specify the devicetree files they want to build

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 17 lines
Quoted 6 lines

The problem I have described above applied to meson, so I believe it is clear enough with that. I wasn't able to get rk3399 going, but I am sure it would have the same problem.

Quoted 6 lines

The fundamental question is (I believe) whether to:

1. Build only a single DT for a board
2. Build all DTs for the SoC the board uses

This series seems to head towards (1),

v2 of this series had the Makefile rules [1] for meson gxbb SoC but..

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 7 lines
Quoted 2 lines

which worries me. We are
currently mostly at (2).

..after discussion with Tom, the Makefile rules are already coming via Kconfig options like DEFAULT_DEVICE_TREE, OF_LIST etc. So having redundant rules in Makefile doesn't add any value, so I took them off in v3.

Yes, I see that you did that.

This seems to be a fundamental point of disagreement. I would like all boards for an SoC to have mostly the same defconfig and just use a devicetree for differences, at least in U-Boot proper. That is what devicetree is for. In fact, I would like to see a lot more defaults in U-Boot, so that defconfig files are just a few lines like [2] and there is no board-specific C code not gated by a compatible string.

Quoted 6 lines

However, I am very much in favour of having a generalized U-Boot image. This might become true in some cases like U-Boot acts as a second stage bootloader for a particular SoC which is a unified image where the prior stage passes the DT to it. The Qcom effort in this direction can be an example here.

Not relevant to the topic at hand, perhaps, but Qualcomm uses a closed-source blob to jump to U-Boot and is certainly not an example we should emulate. But yes, passing a DT to U-Boot proper can be useful.

Quoted 3 lines

I am not sure at this point how we
can enable different U-Boot features since there are many board specific bits needed currently not covered by DT.

I certainly see many examples of that, but the majority of features are covered. It was of course the same in Linux until someone put his foot down.

Quoted 4 lines

The other common method is to embed board DT in U-Boot image especially where U-Boot acts as a first stage bootloader. Once that's done I don't see how we can call that a generic U-Boot image.

If you mean OF_EMBED, then I don't think that is much used. It is just for using a JTAG debugger and these days, it is barely useful for that.

We do use fdtgrep to create a smaller FDT for SPL, though. In general, it will be harder to create a general SPL for an SoC. But it is also less beneficial, since SPL is small. Also, it is possible, as shown by rockchip.

Quoted 4 lines

BTW, as Tom said we can very well add those Makefile rules later on a use case basis if a particular SoC requires a truly generic U-Boot image and the rules don't come via Kconfig options.

We mostly have them already, so we should not remove them.

We are setting policy here. The policy should bias towards the generic, not to make that hard. There are over 900 arm64 devicetree files in Linux but only a few dozen SoCs and only one build. We should not have 900 arm64 U-Boots, only a few dozen and perhaps one day in the dim, distant future, if the tradeoffs make sense, one.

Regards,
Simon

[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

#21 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 183 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

Quoted 5 lines

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Quoted 2 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

Quoted 6 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

Quoted 19 lines
Quoted 11 lines
Quoted 6 lines

The fundamental question is (I believe) whether to:

1. Build only a single DT for a board
2. Build all DTs for the SoC the board uses

This series seems to head towards (1),

v2 of this series had the Makefile rules [1] for meson gxbb SoC but..

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 7 lines
Quoted 2 lines

which worries me. We are
currently mostly at (2).

..after discussion with Tom, the Makefile rules are already coming via Kconfig options like DEFAULT_DEVICE_TREE, OF_LIST etc. So having redundant rules in Makefile doesn't add any value, so I took them off in v3.

Quoted 8 lines

Yes, I see that you did that.

This seems to be a fundamental point of disagreement. I would like all boards for an SoC to have mostly the same defconfig and just use a devicetree for differences, at least in U-Boot proper. That is what devicetree is for. In fact, I would like to see a lot more defaults in U-Boot, so that defconfig files are just a few lines like [2] and there is no board-specific C code not gated by a compatible string.

That's a nice goal to aim for. Sumit's work doesn't stop that being aimed for, and by making it easy to keep our device trees modern, it makes that easier, not harder.

Heck, it's something I've been working with the TI folks with for a few years now, and this work will make things easier for them because the dts files will get synced back, for all of the chips, sooner rather than later, and we can push towards getting rid of most of the -u-boot.dtsi work, and deal with the hard question of "where do r5 dts files go?". But that will not get rid of board/siemens/iot2050/ because that's what a custom hardware design needs and wants. Not "just pass the new DTB". This is another of the valid use cases that we need to keep in mind and design around, the explicit and intentional starting point of "don't just run the EVM binary for custom hardware design production".

Quoted 10 lines
Quoted 5 lines

However, I am very much in favour of having a generalized U-Boot image. This might become true in some cases like U-Boot acts as a second stage bootloader for a particular SoC which is a unified image where the prior stage passes the DT to it. The Qcom effort in this direction can be an example here.

Not relevant to the topic at hand, perhaps, but Qualcomm uses a closed-source blob to jump to U-Boot and is certainly not an example we should emulate. But yes, passing a DT to U-Boot proper can be useful.

It's a very valid use case we need to continue to support. And to save Mark from having to repeat himself, again, it's intentionally and not changing, how the Apple M1/M2/etc platforms boot. I'm pretty sure the fact that one can use U-Boot this way is part of how engineers get proof of concept work done to show that if they had U-Boot available then they could also support X/Y/Z easier. And maybe they'll be able to longer term push internally to use bloblist to pass things along.

Heck, trying to not go too far off on a tangent, maybe the m1n1 loader can implement both conventions, as both Linux Kernel[0] and Bloblist[1] use x0 for device tree, but bloblist has x1 non-zero and Linux does not, so both could be present here? Or is there some incompatibility I don't see on quick skimming?

Signature · 4 lines
Tom

[0]: https://www.kernel.org/doc/html/latest/arch/arm64/booting.html
[1]: https://github.com/FirmwareHandoff/firmware_handoff/blob/main/source/register_conventions.rst
#22 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 313 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 183 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

Quoted 5 lines

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Quoted 2 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

Quoted 6 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

Quoted 19 lines
Quoted 11 lines
Quoted 6 lines

The fundamental question is (I believe) whether to:

1. Build only a single DT for a board
2. Build all DTs for the SoC the board uses

This series seems to head towards (1),

v2 of this series had the Makefile rules [1] for meson gxbb SoC but..

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 7 lines
Quoted 2 lines

which worries me. We are
currently mostly at (2).

..after discussion with Tom, the Makefile rules are already coming via Kconfig options like DEFAULT_DEVICE_TREE, OF_LIST etc. So having redundant rules in Makefile doesn't add any value, so I took them off in v3.

Quoted 8 lines

Yes, I see that you did that.

This seems to be a fundamental point of disagreement. I would like all boards for an SoC to have mostly the same defconfig and just use a devicetree for differences, at least in U-Boot proper. That is what devicetree is for. In fact, I would like to see a lot more defaults in U-Boot, so that defconfig files are just a few lines like [2] and there is no board-specific C code not gated by a compatible string.

That's a nice goal to aim for. Sumit's work doesn't stop that being aimed for, and by making it easy to keep our device trees modern, it makes that easier, not harder.

Heck, it's something I've been working with the TI folks with for a few years now, and this work will make things easier for them because the dts files will get synced back, for all of the chips, sooner rather than later, and we can push towards getting rid of most of the -u-boot.dtsi work, and deal with the hard question of "where do r5 dts files go?". But that will not get rid of board/siemens/iot2050/ because that's what a custom hardware design needs and wants. Not "just pass the new DTB". This is another of the valid use cases that we need to keep in mind and design around, the explicit and intentional starting point of "don't just run the EVM binary for custom hardware design production".

Quoted 10 lines
Quoted 5 lines

However, I am very much in favour of having a generalized U-Boot image. This might become true in some cases like U-Boot acts as a second stage bootloader for a particular SoC which is a unified image where the prior stage passes the DT to it. The Qcom effort in this direction can be an example here.

Not relevant to the topic at hand, perhaps, but Qualcomm uses a closed-source blob to jump to U-Boot and is certainly not an example we should emulate. But yes, passing a DT to U-Boot proper can be useful.

It's a very valid use case we need to continue to support. And to save Mark from having to repeat himself, again, it's intentionally and not changing, how the Apple M1/M2/etc platforms boot. I'm pretty sure the fact that one can use U-Boot this way is part of how engineers get proof of concept work done to show that if they had U-Boot available then they could also support X/Y/Z easier. And maybe they'll be able to longer term push internally to use bloblist to pass things along.

Quoted 5 lines

Heck, trying to not go too far off on a tangent, maybe the m1n1 loader can implement both conventions, as both Linux Kernel[0] and Bloblist[1] use x0 for device tree, but bloblist has x1 non-zero and Linux does not, so both could be present here? Or is there some incompatibility I don't see on quick skimming?

Right. Some time ago I suggested Simon to lobby the Linux kernel folks to change the arm64 Linux kernel entry convention to state that x1 can be non-zero in which case it points at a bloblist. If that happened I'd probably do the work to make m1n1 pass a bloblist. And it would probably make the folks who want to directly boot a Linux kernel from TF-A (without going through U-Boot) happy as well.

Cheers,

Mark

#23 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

git subtree pull --prefix devicetree-rebasing
git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

and it could also put the files in the right place for U-Boot.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 8 lines
Quoted 8 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

But anyway, this works OK with rk3399, for example. We need to support this use case.

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

Quoted 3 lines
Quoted 3 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

Quoted 33 lines
Quoted 33 lines
Quoted 20 lines
Quoted 12 lines
Quoted 7 lines

The fundamental question is (I believe) whether to:

1. Build only a single DT for a board
2. Build all DTs for the SoC the board uses

This series seems to head towards (1),

v2 of this series had the Makefile rules [1] for meson gxbb SoC but..

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 7 lines
Quoted 2 lines

which worries me. We are
currently mostly at (2).

..after discussion with Tom, the Makefile rules are already coming via Kconfig options like DEFAULT_DEVICE_TREE, OF_LIST etc. So having redundant rules in Makefile doesn't add any value, so I took them off in v3.

Quoted 8 lines

Yes, I see that you did that.

This seems to be a fundamental point of disagreement. I would like all boards for an SoC to have mostly the same defconfig and just use a devicetree for differences, at least in U-Boot proper. That is what devicetree is for. In fact, I would like to see a lot more defaults in U-Boot, so that defconfig files are just a few lines like [2] and there is no board-specific C code not gated by a compatible string.

That's a nice goal to aim for. Sumit's work doesn't stop that being aimed for, and by making it easy to keep our device trees modern, it makes that easier, not harder.

Quoted 10 lines
Quoted 10 lines

Heck, it's something I've been working with the TI folks with for a few years now, and this work will make things easier for them because the dts files will get synced back, for all of the chips, sooner rather than later, and we can push towards getting rid of most of the -u-boot.dtsi work, and deal with the hard question of "where do r5 dts files go?". But that will not get rid of board/siemens/iot2050/ because that's what a custom hardware design needs and wants. Not "just pass the new DTB". This is another of the valid use cases that we need to keep in mind and design around, the explicit and intentional starting point of "don't just run the EVM binary for custom hardware design production".

OK.

Quoted 26 lines
Quoted 20 lines
Quoted 11 lines
Quoted 6 lines

However, I am very much in favour of having a generalized U-Boot image. This might become true in some cases like U-Boot acts as a second stage bootloader for a particular SoC which is a unified image where the prior stage passes the DT to it. The Qcom effort in this direction can be an example here.

Not relevant to the topic at hand, perhaps, but Qualcomm uses a closed-source blob to jump to U-Boot and is certainly not an example we should emulate. But yes, passing a DT to U-Boot proper can be useful.

It's a very valid use case we need to continue to support. And to save Mark from having to repeat himself, again, it's intentionally and not changing, how the Apple M1/M2/etc platforms boot. I'm pretty sure the fact that one can use U-Boot this way is part of how engineers get proof of concept work done to show that if they had U-Boot available then they could also support X/Y/Z easier. And maybe they'll be able to longer term push internally to use bloblist to pass things along.

Quoted 5 lines

Heck, trying to not go too far off on a tangent, maybe the m1n1 loader can implement both conventions, as both Linux Kernel[0] and Bloblist[1] use x0 for device tree, but bloblist has x1 non-zero and Linux does not, so both could be present here? Or is there some incompatibility I don't see on quick skimming?

Quoted 6 lines

Right. Some time ago I suggested Simon to lobby the Linux kernel folks to change the arm64 Linux kernel entry convention to state that x1 can be non-zero in which case it points at a bloblist. If that happened I'd probably do the work to make m1n1 pass a bloblist. And it would probably make the folks who want to directly boot a Linux kernel from TF-A (without going through U-Boot) happy as well.

I got a lot of push-back on that. Perhaps there might be some willingness if it is explained that Linux doesn't need to understand the bloblist, just tolerate it being there. There are probably other people who will be more successful at pushing for kernel changes.

As you know, the handoff protocol is designed such that you don't need to decode the bloblist to find the devicetree. BTW I would like to put the ACPI/SMBIOS tables in the bloblist as well (with EFI we would provide pointers into the bloblist for Linux to use)

Regards,
Simon

#24 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 204 lines · Simon Glass

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Quoted 8 lines

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

   git subtree pull --prefix devicetree-rebasing

git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

and it could also put the files in the right place for U-Boot.

I've been saying in various places for years that I want to move away from arch/*/dts being where we have the "just a copy" dts files and have them somewhere else so they are easier to manage and differentiate our changes / additions. So arch/*/dts cannot be some hard-coded "right" path.

Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

And what I want here is to match the same structure everyone that's not U-Boot uses. For better or worse no one else seems to have gone with "treat aarch64 as just another ARM", and then the vendor directory structure only makes that more obviously a mismatch. We need to follow what everyone else uses, and developers familiar with other projects will expect to see.

Quoted 60 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 7 lines
Quoted 7 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Quoted 3 lines

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

I mean, SPL_LOAD_FIT still can handle this case, with a call to the function to re-parse the tree, when needed. I thought we did this today even, but perhaps I'm confusing my options here.

Quoted 6 lines

But anyway, this works OK with rk3399, for example. We need to support this use case.

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

I'm sorry, I don't understand what directory structure has to do with "build more dtbs". For the cases where it makes sense to, yes, we can build more dtbs, based on the SoC. I'm setting aside entirely the discussion on what SoCs that works for, for another thread.

Perhaps an issue here is that much like the kernel "install" target, we need an "install" target too, so that whatever dtbs we build can be more easily found for external packaging, but whatever tooling it is that wants it? And perhaps this is part of the problem, tooling that expects to pull things out of the object directory rather than an "installed" directory?

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

Yes, I think you're missing something. Perhaps you need to publish a WIP tree somewhere so someone can see what you're doing as it sounds like you're not able to add another SoC of any type on top of Sumit's tree and have it work.

Signature · 1 line
Tom
#25 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Tom,

Quoted 213 lines · Tom Rini
Quoted 211 lines · Simon Glass

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

   git subtree pull --prefix devicetree-rebasing

git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

Quoted 7 lines
Quoted 1 line

and it could also put the files in the right place for U-Boot.

I've been saying in various places for years that I want to move away from arch/*/dts being where we have the "just a copy" dts files and have them somewhere else so they are easier to manage and differentiate our changes / additions. So arch/*/dts cannot be some hard-coded "right" path.

OK

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

Quoted 6 lines

And what I want here is to match the same structure everyone that's not U-Boot uses. For better or worse no one else seems to have gone with "treat aarch64 as just another ARM", and then the vendor directory structure only makes that more obviously a mismatch. We need to follow what everyone else uses, and developers familiar with other projects will expect to see.

So you are saying that U-Boot should move to what Linux uses. I agree that seems like the best approach, so let's do it.

Quoted 72 lines
Quoted 61 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 7 lines
Quoted 7 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Quoted 3 lines

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

I mean, SPL_LOAD_FIT still can handle this case, with a call to the function to re-parse the tree, when needed. I thought we did this today even, but perhaps I'm confusing my options here.

Quoted 3 lines

But anyway, this works OK with rk3399, for example. We need to support this use case.

Quoted 8 lines
Quoted 3 lines

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

I'm sorry, I don't understand what directory structure has to do with "build more dtbs". For the cases where it makes sense to, yes, we can build more dtbs, based on the SoC. I'm setting aside entirely the discussion on what SoCs that works for, for another thread.

Well you said above that we should switch to the kernel dir structure, so I believe that issue is resolved.

'build more dtbs' means build all the DTBs for an SoC, not just a selection that a particular board vendor decided on.

Quoted 7 lines

Perhaps an issue here is that much like the kernel "install" target, we need an "install" target too, so that whatever dtbs we build can be more easily found for external packaging, but whatever tooling it is that wants it? And perhaps this is part of the problem, tooling that expects to pull things out of the object directory rather than an "installed" directory?

This is where binman comes in. It can run as part of U-Boot build, to build a few default firmware images. Then it can be run *later*, outside the U-Boot build, with an augmented or more targeted image definition, with mostly the same input files, to pull together images for specific uses. As you say, the input files need to be in a defined location, which they are today, for the most part.

So even if a particular board only uses one DT, all the DTs for that SoC are built and so can be used in that final-packaging step. Without that build, there is no way to get the required .dtb files, other than building every board one by one and then pulling out the .dtb files or something weird like that.

Note that this works independently of whether OF_LIST is used, etc.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

Quoted 8 lines
Quoted 3 lines

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

Yes, I think you're missing something. Perhaps you need to publish a WIP tree somewhere so someone can see what you're doing as it sounds like you're not able to add another SoC of any type on top of Sumit's tree and have it work.

The current -next source builds dtb files based on the SoC, for the most part. I sent a series to clean that up a bit[1], but it is mostly there.

From the above it seems like the plan could be:
1. Move arm64 .dts files to arch/arm64/dts/<vendor>/... and adjust Makefiles accordingly
2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'. Actually barebox even seems to have scripts for handling all of this [2]??
3. Adjust the build system to use the dts/ directory for .dts files when OF_UPSTREAM is enabled

Then it will be easy. People can enable OF_UPSTREAM for an SoC (without changing DEFAULT_DEVICE_TREE) and will get the same behaviour as now, just with upstream .dts files. All the .dts files for an SoC are built, as now, just as Linux does. We can continue cleaning up the DT build rules as time permits.

Regards,
Simon

[1] http://patchwork.ozlabs.org/project/uboot/list/?series=388154
[2] https://git.pengutronix.de/cgit/barebox/tree/dts

#26 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 328 lines · Simon Glass

Hi Tom,

Quoted 213 lines · Tom Rini
Quoted 211 lines · Simon Glass

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 44 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing
directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then
build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts
directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant
with upstream Linux kernel devicetree files.

Signed-off-by: Sumit Garg <[email protected]>
---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

dts/Kconfig | 11 +++++++++++
dts/Makefile | 17 ++++++++++++++---
dts/arch/arm64/Makefile | 14 ++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 dts/arch/arm64/Makefile

diff --git a/dts/Kconfig b/dts/Kconfig
index 00c0aeff893..e58c1c6f2ab 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -85,6 +85,17 @@ config OF_LIVE
enables a live tree which is available after relocation,
and can be adjusted as needed.

+config OF_UPSTREAM
+ bool "Enable use of devicetree imported from Linux kernel release"
+ help
+ Traditionally, U-Boot platforms used to have their custom devicetree
+ files or copy devicetree files from Linux kernel which are hard to
+ maintain and can usually get out-of-sync from Linux kernel. This
+ option enables platforms to migrate to devicetree-rebasing repo where
+ a regular sync will be maintained every major Linux kernel release
+ cycle. However, platforms can still have some custom u-boot specific
+ bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

   git subtree pull --prefix devicetree-rebasing

git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

Quoted 7 lines
Quoted 1 line

and it could also put the files in the right place for U-Boot.

I've been saying in various places for years that I want to move away from arch/*/dts being where we have the "just a copy" dts files and have them somewhere else so they are easier to manage and differentiate our changes / additions. So arch/*/dts cannot be some hard-coded "right" path.

OK

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

Quoted 6 lines

And what I want here is to match the same structure everyone that's not U-Boot uses. For better or worse no one else seems to have gone with "treat aarch64 as just another ARM", and then the vendor directory structure only makes that more obviously a mismatch. We need to follow what everyone else uses, and developers familiar with other projects will expect to see.

So you are saying that U-Boot should move to what Linux uses. I agree that seems like the best approach, so let's do it.

Quoted 72 lines
Quoted 61 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 7 lines
Quoted 7 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Quoted 3 lines

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

I mean, SPL_LOAD_FIT still can handle this case, with a call to the function to re-parse the tree, when needed. I thought we did this today even, but perhaps I'm confusing my options here.

Quoted 3 lines

But anyway, this works OK with rk3399, for example. We need to support this use case.

Quoted 8 lines
Quoted 3 lines

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

I'm sorry, I don't understand what directory structure has to do with "build more dtbs". For the cases where it makes sense to, yes, we can build more dtbs, based on the SoC. I'm setting aside entirely the discussion on what SoCs that works for, for another thread.

Quoted 5 lines

Well you said above that we should switch to the kernel dir structure, so I believe that issue is resolved.

'build more dtbs' means build all the DTBs for an SoC, not just a selection that a particular board vendor decided on.

Yes, what other dtbs to build is the sticking point, in a number of threads now.

Quoted 14 lines
Quoted 6 lines

Perhaps an issue here is that much like the kernel "install" target, we need an "install" target too, so that whatever dtbs we build can be more easily found for external packaging, but whatever tooling it is that wants it? And perhaps this is part of the problem, tooling that expects to pull things out of the object directory rather than an "installed" directory?

This is where binman comes in. It can run as part of U-Boot build, to build a few default firmware images. Then it can be run *later*, outside the U-Boot build, with an augmented or more targeted image definition, with mostly the same input files, to pull together images for specific uses. As you say, the input files need to be in a defined location, which they are today, for the most part.

Quoted 7 lines

So even if a particular board only uses one DT, all the DTs for that SoC are built and so can be used in that final-packaging step. Without that build, there is no way to get the required .dtb files, other than building every board one by one and then pulling out the .dtb files or something weird like that.

Note that this works independently of whether OF_LIST is used, etc.

How about this. When you introduce generic-rk3399_defconfig is when we can also have dts-$(CONFIG_ROCKCHIP_RK3399) list everything, and insist it be kept up to date. That to me feels like the right order to go in. And we can have all of the implementation details be hashed out elsewhere, not in the thread about fixing our nightmare about dts file resync.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

Quoted 8 lines
Quoted 4 lines

Yes, I think you're missing something. Perhaps you need to publish a WIP tree somewhere so someone can see what you're doing as it sounds like you're not able to add another SoC of any type on top of Sumit's tree and have it work.

The current -next source builds dtb files based on the SoC, for the most part. I sent a series to clean that up a bit[1], but it is mostly there.

Yes, and that relied on Rasmus' series having been merged ages ago which fixed up a number of "people just copypasta'd something here, incorrectly". Keep that in mind as part of why I have objections here.

Quoted 4 lines

From the above it seems like the plan could be:
1. Move arm64 .dts files to arch/arm64/dts/<vendor>/... and adjust Makefiles accordingly

Since we're going to move everyone to being from the upstream kernel, that seems like unneeded churn.

Quoted 4 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'. Actually barebox even seems to have scripts for handling all of this [2]??

They've been doing this since longer than git subtree has existed I believe. I suspect that much like how Rob would like to move the in-kernel devicetree compiler sync from a script to git subtree, barebox will too.

Quoted 8 lines

3. Adjust the build system to use the dts/ directory for .dts files when OF_UPSTREAM is enabled

Then it will be easy. People can enable OF_UPSTREAM for an SoC (without changing DEFAULT_DEVICE_TREE) and will get the same behaviour as now, just with upstream .dts files. All the .dts files for an SoC are built, as now, just as Linux does. We can continue cleaning up the DT build rules as time permits.

Maybe the unasked / unanswered question here is, why don't we put the subtree in to dts/ ? Just because it would make us more likely to make changes rather than treat it as read only?

Signature · 1 line
Tom
#27 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Tom,

Quoted 330 lines · Tom Rini
Quoted 328 lines · Simon Glass

Hi Tom,

Quoted 213 lines · Tom Rini
Quoted 211 lines · Simon Glass

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 53 lines · Simon Glass

Hi Sumit,

On Thu, Dec 28, 2023 at 11:58 AM Sumit Garg <[email protected]> wrote:

Allow platform owners to mirror devicetree files from devitree-rebasing
directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then
build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts
directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant
with upstream Linux kernel devicetree files.

Signed-off-by: Sumit Garg <[email protected]>
---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

dts/Kconfig | 11 +++++++++++
dts/Makefile | 17 ++++++++++++++---
dts/arch/arm64/Makefile | 14 ++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 dts/arch/arm64/Makefile

diff --git a/dts/Kconfig b/dts/Kconfig
index 00c0aeff893..e58c1c6f2ab 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -85,6 +85,17 @@ config OF_LIVE
enables a live tree which is available after relocation,
and can be adjusted as needed.

+config OF_UPSTREAM
+ bool "Enable use of devicetree imported from Linux kernel release"
+ help
+ Traditionally, U-Boot platforms used to have their custom devicetree
+ files or copy devicetree files from Linux kernel which are hard to
+ maintain and can usually get out-of-sync from Linux kernel. This
+ option enables platforms to migrate to devicetree-rebasing repo where
+ a regular sync will be maintained every major Linux kernel release
+ cycle. However, platforms can still have some custom u-boot specific
+ bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in
Kconfig, for the SoC as a whole. So I believe that means that it
should be hidden, with no string for the 'bool':

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these
files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb
rk3399-khadas-edge-captain.dtb rk3399-nanopi-neo4.dtb rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb rk3399-nanopi-r4s.dtb rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target
'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target
'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all
the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

   git subtree pull --prefix devicetree-rebasing

git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

Quoted 7 lines
Quoted 1 line

and it could also put the files in the right place for U-Boot.

I've been saying in various places for years that I want to move away from arch/*/dts being where we have the "just a copy" dts files and have them somewhere else so they are easier to manage and differentiate our changes / additions. So arch/*/dts cannot be some hard-coded "right" path.

OK

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

Quoted 6 lines

And what I want here is to match the same structure everyone that's not U-Boot uses. For better or worse no one else seems to have gone with "treat aarch64 as just another ARM", and then the vendor directory structure only makes that more obviously a mismatch. We need to follow what everyone else uses, and developers familiar with other projects will expect to see.

So you are saying that U-Boot should move to what Linux uses. I agree that seems like the best approach, so let's do it.

Quoted 80 lines
Quoted 61 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 7 lines
Quoted 7 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Quoted 3 lines

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

I mean, SPL_LOAD_FIT still can handle this case, with a call to the function to re-parse the tree, when needed. I thought we did this today even, but perhaps I'm confusing my options here.

Quoted 6 lines

But anyway, this works OK with rk3399, for example. We need to support this use case.

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

I'm sorry, I don't understand what directory structure has to do with "build more dtbs". For the cases where it makes sense to, yes, we can build more dtbs, based on the SoC. I'm setting aside entirely the discussion on what SoCs that works for, for another thread.

Quoted 8 lines
Quoted 5 lines

Well you said above that we should switch to the kernel dir structure, so I believe that issue is resolved.

'build more dtbs' means build all the DTBs for an SoC, not just a selection that a particular board vendor decided on.

Yes, what other dtbs to build is the sticking point, in a number of threads now.

All of the ones for the SoC.

Quoted 21 lines
Quoted 21 lines
Quoted 7 lines

Perhaps an issue here is that much like the kernel "install" target, we need an "install" target too, so that whatever dtbs we build can be more easily found for external packaging, but whatever tooling it is that wants it? And perhaps this is part of the problem, tooling that expects to pull things out of the object directory rather than an "installed" directory?

This is where binman comes in. It can run as part of U-Boot build, to build a few default firmware images. Then it can be run *later*, outside the U-Boot build, with an augmented or more targeted image definition, with mostly the same input files, to pull together images for specific uses. As you say, the input files need to be in a defined location, which they are today, for the most part.

So even if a particular board only uses one DT, all the DTs for that SoC are built and so can be used in that final-packaging step. Without that build, there is no way to get the required .dtb files, other than building every board one by one and then pulling out the .dtb files or something weird like that.

Quoted 8 lines
Quoted 1 line

Note that this works independently of whether OF_LIST is used, etc.

How about this. When you introduce generic-rk3399_defconfig is when we can also have dts-$(CONFIG_ROCKCHIP_RK3399) list everything, and insist it be kept up to date. That to me feels like the right order to go in. And we can have all of the implementation details be hashed out elsewhere, not in the thread about fixing our nightmare about dts file resync.

So long as Sumit can put it back so we can use build rules, that's fine. But removing the build rules is the sticking point for me.

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

Yes, I think you're missing something. Perhaps you need to publish a WIP tree somewhere so someone can see what you're doing as it sounds like you're not able to add another SoC of any type on top of Sumit's tree and have it work.

Quoted 7 lines
Quoted 3 lines

The current -next source builds dtb files based on the SoC, for the most part. I sent a series to clean that up a bit[1], but it is mostly there.

Yes, and that relied on Rasmus' series having been merged ages ago which fixed up a number of "people just copypasta'd something here, incorrectly". Keep that in mind as part of why I have objections here.

OK.

Quoted 8 lines
Quoted 5 lines

From the above it seems like the plan could be:
1. Move arm64 .dts files to arch/arm64/dts/<vendor>/... and adjust Makefiles accordingly

Since we're going to move everyone to being from the upstream kernel, that seems like unneeded churn.

What is the timeline for that move?

We are talking about 1700 lines of Makefies and I already made a good start on part of it. So if we are going to be a few months with two different paths, fine, but this is going to drag on for a year, I would rather clean it up now and have a unified path for both sets of DTs.

Quoted 10 lines
Quoted 5 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'. Actually barebox even seems to have scripts for handling all of this [2]??

They've been doing this since longer than git subtree has existed I believe. I suspect that much like how Rob would like to move the in-kernel devicetree compiler sync from a script to git subtree, barebox will too.

Maybe, although the first barebox dts/ commit was 2014 and subtree is claimed to come out in 2012...but then devicetree-rebasing might be newer, which would explain why they have 'git filter-branch' stuff in the script.

I thought devicetree-rebasing came from Linux. Is it its own repo? So what is the DT upstream these days??

If subtree does what we want without making U-Boot look like Franekstein's monster, that's fine. But I don't mind having a script.

Quoted 10 lines
Quoted 9 lines

3. Adjust the build system to use the dts/ directory for .dts files when OF_UPSTREAM is enabled

Then it will be easy. People can enable OF_UPSTREAM for an SoC (without changing DEFAULT_DEVICE_TREE) and will get the same behaviour as now, just with upstream .dts files. All the .dts files for an SoC are built, as now, just as Linux does. We can continue cleaning up the DT build rules as time permits.

Quoted 3 lines

Maybe the unasked / unanswered question here is, why don't we put the subtree in to dts/ ? Just because it would make us more likely to make changes rather than treat it as read only?

It is an easy checkpatch check, if that is your only concern.

Regards,
Simon

#28 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 336 lines · Simon Glass

Hi Tom,

Quoted 333 lines · Tom Rini
Quoted 331 lines · Simon Glass

Hi Tom,

Quoted 213 lines · Tom Rini
Quoted 211 lines · Simon Glass

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 96 lines · Tom Rini

On Thu, Dec 28, 2023 at 01:37:26PM +0000, Simon Glass wrote:
Hi Sumit,

On Thu, Dec 28, 2023 at 11:58 AM Sumit Garg <[email protected]> wrote:

Allow platform owners to mirror devicetree files from devitree-rebasing
directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then
build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts
directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant
with upstream Linux kernel devicetree files.

Signed-off-by: Sumit Garg <[email protected]>
---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

dts/Kconfig | 11 +++++++++++
dts/Makefile | 17 ++++++++++++++---
dts/arch/arm64/Makefile | 14 ++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 dts/arch/arm64/Makefile

diff --git a/dts/Kconfig b/dts/Kconfig
index 00c0aeff893..e58c1c6f2ab 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -85,6 +85,17 @@ config OF_LIVE
enables a live tree which is available after relocation,
and can be adjusted as needed.

+config OF_UPSTREAM
+ bool "Enable use of devicetree imported from Linux kernel release"
+ help
+ Traditionally, U-Boot platforms used to have their custom devicetree
+ files or copy devicetree files from Linux kernel which are hard to
+ maintain and can usually get out-of-sync from Linux kernel. This
+ option enables platforms to migrate to devicetree-rebasing repo where
+ a regular sync will be maintained every major Linux kernel release
+ cycle. However, platforms can still have some custom u-boot specific
+ bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in
Kconfig, for the SoC as a whole. So I believe that means that it
should be hidden, with no string for the 'bool':

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition
easier, before this option just goes away in time, hopefully.

Also, this doesn't seem to work for me. Before this series I get these
files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb
rk3399-khadas-edge-captain.dtb rk3399-nanopi-neo4.dtb rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb rk3399-nanopi-r4s.dtb rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target
'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

make[3]: *** No rule to make target
'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all
the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to
devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

   git subtree pull --prefix devicetree-rebasing

git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

Quoted 7 lines
Quoted 1 line

and it could also put the files in the right place for U-Boot.

I've been saying in various places for years that I want to move away from arch/*/dts being where we have the "just a copy" dts files and have them somewhere else so they are easier to manage and differentiate our changes / additions. So arch/*/dts cannot be some hard-coded "right" path.

OK

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

Quoted 6 lines

And what I want here is to match the same structure everyone that's not U-Boot uses. For better or worse no one else seems to have gone with "treat aarch64 as just another ARM", and then the vendor directory structure only makes that more obviously a mismatch. We need to follow what everyone else uses, and developers familiar with other projects will expect to see.

So you are saying that U-Boot should move to what Linux uses. I agree that seems like the best approach, so let's do it.

Quoted 72 lines
Quoted 61 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 7 lines
Quoted 7 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Quoted 3 lines

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

I mean, SPL_LOAD_FIT still can handle this case, with a call to the function to re-parse the tree, when needed. I thought we did this today even, but perhaps I'm confusing my options here.

Quoted 3 lines

But anyway, this works OK with rk3399, for example. We need to support this use case.

Quoted 8 lines
Quoted 3 lines

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

I'm sorry, I don't understand what directory structure has to do with "build more dtbs". For the cases where it makes sense to, yes, we can build more dtbs, based on the SoC. I'm setting aside entirely the discussion on what SoCs that works for, for another thread.

Well you said above that we should switch to the kernel dir structure, so I believe that issue is resolved.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

'build more dtbs' means build all the DTBs for an SoC, not just a selection that a particular board vendor decided on.

Yes, what other dtbs to build is the sticking point, in a number of threads now.

All of the ones for the SoC.

Yes, that's your position, and it's not anyone elses position.

Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
Quoted 6 lines

Perhaps an issue here is that much like the kernel "install" target, we need an "install" target too, so that whatever dtbs we build can be more easily found for external packaging, but whatever tooling it is that wants it? And perhaps this is part of the problem, tooling that expects to pull things out of the object directory rather than an "installed" directory?

This is where binman comes in. It can run as part of U-Boot build, to build a few default firmware images. Then it can be run *later*, outside the U-Boot build, with an augmented or more targeted image definition, with mostly the same input files, to pull together images for specific uses. As you say, the input files need to be in a defined location, which they are today, for the most part.

So even if a particular board only uses one DT, all the DTs for that SoC are built and so can be used in that final-packaging step. Without that build, there is no way to get the required .dtb files, other than building every board one by one and then pulling out the .dtb files or something weird like that.

Quoted 8 lines
Quoted 1 line

Note that this works independently of whether OF_LIST is used, etc.

How about this. When you introduce generic-rk3399_defconfig is when we can also have dts-$(CONFIG_ROCKCHIP_RK3399) list everything, and insist it be kept up to date. That to me feels like the right order to go in. And we can have all of the implementation details be hashed out elsewhere, not in the thread about fixing our nightmare about dts file resync.

Quoted 2 lines

So long as Sumit can put it back so we can use build rules, that's fine. But removing the build rules is the sticking point for me.

But it's not a sticking point for anyone else for the series. Because no one else gets the point you're trying to make.

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

Yes, I think you're missing something. Perhaps you need to publish a WIP tree somewhere so someone can see what you're doing as it sounds like you're not able to add another SoC of any type on top of Sumit's tree and have it work.

The current -next source builds dtb files based on the SoC, for the most part. I sent a series to clean that up a bit[1], but it is mostly there.

Quoted 5 lines
Quoted 3 lines

Yes, and that relied on Rasmus' series having been merged ages ago which fixed up a number of "people just copypasta'd something here, incorrectly". Keep that in mind as part of why I have objections here.

OK.

And since I think you're missing the point I was raising, because no one else has the "any dtb from the SoC with this binary", we'll just be getting back to re-introducing those kind of problems with what you're demanding.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

From the above it seems like the plan could be:
1. Move arm64 .dts files to arch/arm64/dts/<vendor>/... and adjust Makefiles accordingly

Since we're going to move everyone to being from the upstream kernel, that seems like unneeded churn.

What is the timeline for that move?

It could probably, largely, be done in 2024, for the platforms that actively sync. For the ones that aren't behaving well right now? I don't know, it'll depend on when someone shows up being active about them again.

Quoted 5 lines

We are talking about 1700 lines of Makefies and I already made a good start on part of it. So if we are going to be a few months with two different paths, fine, but this is going to drag on for a year, I would rather clean it up now and have a unified path for both sets of DTs.

The sticking point for migration is going to be the testing of the platforms that are not well in sync at all.

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'. Actually barebox even seems to have scripts for handling all of this [2]??

They've been doing this since longer than git subtree has existed I believe. I suspect that much like how Rob would like to move the in-kernel devicetree compiler sync from a script to git subtree, barebox will too.

Quoted 4 lines

Maybe, although the first barebox dts/ commit was 2014 and subtree is claimed to come out in 2012...but then devicetree-rebasing might be newer, which would explain why they have 'git filter-branch' stuff in the script.

Well, it was just a guess on my part. It took a while for subtree to catch on, and yes, it's taken a while for everything to reach the state it's in today, for dts sources outside of the linux kernel itself.

Quoted 2 lines

I thought devicetree-rebasing came from Linux. Is it its own repo? So what is the DT upstream these days??

I'll let Rob chime in again here if he likes. In short, devicetree-rebasing is the kernel dts files/bindings copied out and tagged, matching upstream kernel tags, and with assorted useful bits of git history available.

Quoted 2 lines

If subtree does what we want without making U-Boot look like Franekstein's monster, that's fine. But I don't mind having a script.

Yes, everyone else thus far seems fine with what we get via this series.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

3. Adjust the build system to use the dts/ directory for .dts files when OF_UPSTREAM is enabled

Then it will be easy. People can enable OF_UPSTREAM for an SoC (without changing DEFAULT_DEVICE_TREE) and will get the same behaviour as now, just with upstream .dts files. All the .dts files for an SoC are built, as now, just as Linux does. We can continue cleaning up the DT build rules as time permits.

Quoted 5 lines
Quoted 3 lines

Maybe the unasked / unanswered question here is, why don't we put the subtree in to dts/ ? Just because it would make us more likely to make changes rather than treat it as read only?

It is an easy checkpatch check, if that is your only concern.

Yeah, checkpatch isn't great for catching and stopping things. I don't know how many other custodians check their PRs before I get to them. So if it's not a fatal CI thing, it's not going to always be caught before I see it, and I don't always catch "ERROR" things in checkpatch in a PR either. But it might still be more annoying than not to have subtree be shoved in to "dts". I'm hoping for some feedback from Sumit on this point since I think he's played around.

Signature · 1 line
Tom
#29 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Tom,

Quoted 341 lines · Tom Rini
Quoted 339 lines · Simon Glass

Hi Tom,

Quoted 336 lines · Tom Rini
Quoted 333 lines · Simon Glass

Hi Tom,

Quoted 213 lines · Tom Rini
Quoted 211 lines · Simon Glass

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

On Thu, Dec 28, 2023 at 2:03 PM Tom Rini <[email protected]> wrote:

On Thu, Dec 28, 2023 at 01:37:26PM +0000, Simon Glass wrote:
Hi Sumit,

On Thu, Dec 28, 2023 at 11:58 AM Sumit Garg <[email protected]> wrote:

Allow platform owners to mirror devicetree files from devitree-rebasing
directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then
build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts
directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant
with upstream Linux kernel devicetree files.

Signed-off-by: Sumit Garg <[email protected]>
---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

dts/Kconfig | 11 +++++++++++
dts/Makefile | 17 ++++++++++++++---
dts/arch/arm64/Makefile | 14 ++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 dts/arch/arm64/Makefile

diff --git a/dts/Kconfig b/dts/Kconfig
index 00c0aeff893..e58c1c6f2ab 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -85,6 +85,17 @@ config OF_LIVE
enables a live tree which is available after relocation,
and can be adjusted as needed.

+config OF_UPSTREAM
+ bool "Enable use of devicetree imported from Linux kernel release"
+ help
+ Traditionally, U-Boot platforms used to have their custom devicetree
+ files or copy devicetree files from Linux kernel which are hard to
+ maintain and can usually get out-of-sync from Linux kernel. This
+ option enables platforms to migrate to devicetree-rebasing repo where
+ a regular sync will be maintained every major Linux kernel release
+ cycle. However, platforms can still have some custom u-boot specific
+ bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in
Kconfig, for the SoC as a whole. So I believe that means that it
should be hidden, with no string for the 'bool':

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition
easier, before this option just goes away in time, hopefully.

Also, this doesn't seem to work for me. Before this series I get these
files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb
rk3399-khadas-edge-captain.dtb rk3399-nanopi-neo4.dtb rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb rk3399-nanopi-r4s.dtb rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target
'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

make[3]: *** No rule to make target
'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all
the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to
devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even
with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb meson-g12b-odroid-n2l.dtb
meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb meson-g12b-odroid-n2-plus.dtb
meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb meson-g12b-radxa-zero2.dtb
meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb meson-gxbb-kii-pro.dtb
meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb meson-gxbb-nanopi-k2.dtb
meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb meson-gxbb-odroidc2.dtb
meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb meson-gxbb-p200.dtb
meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb meson-gxbb-p201.dtb
meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb meson-gxbb-wetek-hub.dtb
meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb meson-gxbb-wetek-play2.dtb
meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb meson-gxl-s805x-libretech-ac.dtb
meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb meson-gxl-s905d-libretech-pc.dtb
meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb
files into the same directory? Otherwise we may have some pain with
binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

   git subtree pull --prefix devicetree-rebasing

git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

Quoted 7 lines
Quoted 1 line

and it could also put the files in the right place for U-Boot.

I've been saying in various places for years that I want to move away from arch/*/dts being where we have the "just a copy" dts files and have them somewhere else so they are easier to manage and differentiate our changes / additions. So arch/*/dts cannot be some hard-coded "right" path.

OK

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

Quoted 6 lines

And what I want here is to match the same structure everyone that's not U-Boot uses. For better or worse no one else seems to have gone with "treat aarch64 as just another ARM", and then the vendor directory structure only makes that more obviously a mismatch. We need to follow what everyone else uses, and developers familiar with other projects will expect to see.

So you are saying that U-Boot should move to what Linux uses. I agree that seems like the best approach, so let's do it.

Quoted 72 lines
Quoted 61 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 7 lines
Quoted 7 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Quoted 3 lines

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

I mean, SPL_LOAD_FIT still can handle this case, with a call to the function to re-parse the tree, when needed. I thought we did this today even, but perhaps I'm confusing my options here.

Quoted 3 lines

But anyway, this works OK with rk3399, for example. We need to support this use case.

Quoted 8 lines
Quoted 3 lines

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

I'm sorry, I don't understand what directory structure has to do with "build more dtbs". For the cases where it makes sense to, yes, we can build more dtbs, based on the SoC. I'm setting aside entirely the discussion on what SoCs that works for, for another thread.

Well you said above that we should switch to the kernel dir structure, so I believe that issue is resolved.

'build more dtbs' means build all the DTBs for an SoC, not just a selection that a particular board vendor decided on.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Yes, what other dtbs to build is the sticking point, in a number of threads now.

All of the ones for the SoC.

Yes, that's your position, and it's not anyone elses position.

Indeed, I seem to be in a minority of one.

Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 15 lines
Quoted 7 lines

Perhaps an issue here is that much like the kernel "install" target, we need an "install" target too, so that whatever dtbs we build can be more easily found for external packaging, but whatever tooling it is that wants it? And perhaps this is part of the problem, tooling that expects to pull things out of the object directory rather than an "installed" directory?

This is where binman comes in. It can run as part of U-Boot build, to build a few default firmware images. Then it can be run *later*, outside the U-Boot build, with an augmented or more targeted image definition, with mostly the same input files, to pull together images for specific uses. As you say, the input files need to be in a defined location, which they are today, for the most part.

Quoted 7 lines

So even if a particular board only uses one DT, all the DTs for that SoC are built and so can be used in that final-packaging step. Without that build, there is no way to get the required .dtb files, other than building every board one by one and then pulling out the .dtb files or something weird like that.

Note that this works independently of whether OF_LIST is used, etc.

How about this. When you introduce generic-rk3399_defconfig is when we can also have dts-$(CONFIG_ROCKCHIP_RK3399) list everything, and insist it be kept up to date. That to me feels like the right order to go in. And we can have all of the implementation details be hashed out elsewhere, not in the thread about fixing our nightmare about dts file resync.

Quoted 5 lines
Quoted 2 lines

So long as Sumit can put it back so we can use build rules, that's fine. But removing the build rules is the sticking point for me.

But it's not a sticking point for anyone else for the series. Because no one else gets the point you're trying to make.

OK

Quoted 98 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

Quoted 8 lines
Quoted 3 lines

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

Yes, I think you're missing something. Perhaps you need to publish a WIP tree somewhere so someone can see what you're doing as it sounds like you're not able to add another SoC of any type on top of Sumit's tree and have it work.

The current -next source builds dtb files based on the SoC, for the most part. I sent a series to clean that up a bit[1], but it is mostly there.

Quoted 5 lines
Quoted 3 lines

Yes, and that relied on Rasmus' series having been merged ages ago which fixed up a number of "people just copypasta'd something here, incorrectly". Keep that in mind as part of why I have objections here.

OK.

And since I think you're missing the point I was raising, because no one else has the "any dtb from the SoC with this binary", we'll just be getting back to re-introducing those kind of problems with what you're demanding.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

From the above it seems like the plan could be:
1. Move arm64 .dts files to arch/arm64/dts/<vendor>/... and adjust Makefiles accordingly

Since we're going to move everyone to being from the upstream kernel, that seems like unneeded churn.

What is the timeline for that move?

It could probably, largely, be done in 2024, for the platforms that actively sync. For the ones that aren't behaving well right now? I don't know, it'll depend on when someone shows up being active about them again.

Quoted 5 lines

We are talking about 1700 lines of Makefies and I already made a good start on part of it. So if we are going to be a few months with two different paths, fine, but this is going to drag on for a year, I would rather clean it up now and have a unified path for both sets of DTs.

The sticking point for migration is going to be the testing of the platforms that are not well in sync at all.

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'. Actually barebox even seems to have scripts for handling all of this [2]??

They've been doing this since longer than git subtree has existed I believe. I suspect that much like how Rob would like to move the in-kernel devicetree compiler sync from a script to git subtree, barebox will too.

Quoted 4 lines

Maybe, although the first barebox dts/ commit was 2014 and subtree is claimed to come out in 2012...but then devicetree-rebasing might be newer, which would explain why they have 'git filter-branch' stuff in the script.

Well, it was just a guess on my part. It took a while for subtree to catch on, and yes, it's taken a while for everything to reach the state it's in today, for dts sources outside of the linux kernel itself.

Quoted 2 lines

I thought devicetree-rebasing came from Linux. Is it its own repo? So what is the DT upstream these days??

I'll let Rob chime in again here if he likes. In short, devicetree-rebasing is the kernel dts files/bindings copied out and tagged, matching upstream kernel tags, and with assorted useful bits of git history available.

Quoted 2 lines

If subtree does what we want without making U-Boot look like Franekstein's monster, that's fine. But I don't mind having a script.

Yes, everyone else thus far seems fine with what we get via this series.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

3. Adjust the build system to use the dts/ directory for .dts files when OF_UPSTREAM is enabled

Then it will be easy. People can enable OF_UPSTREAM for an SoC (without changing DEFAULT_DEVICE_TREE) and will get the same behaviour as now, just with upstream .dts files. All the .dts files for an SoC are built, as now, just as Linux does. We can continue cleaning up the DT build rules as time permits.

Quoted 5 lines
Quoted 3 lines

Maybe the unasked / unanswered question here is, why don't we put the subtree in to dts/ ? Just because it would make us more likely to make changes rather than treat it as read only?

It is an easy checkpatch check, if that is your only concern.

Quoted 7 lines

Yeah, checkpatch isn't great for catching and stopping things. I don't know how many other custodians check their PRs before I get to them. So if it's not a fatal CI thing, it's not going to always be caught before I see it, and I don't always catch "ERROR" things in checkpatch in a PR either. But it might still be more annoying than not to have subtree be shoved in to "dts". I'm hoping for some feedback from Sumit on this point since I think he's played around.

It seems to me that the base issue here (in various threads both now and in previous months) is whether U-Boot should control over the devicetree it uses, either through managing to get schema upstream, or by having its own local pieces. That question is relevant both at build time and at runtime.

Anway, I think I have said my piece. Please go ahead with whatever you think makes sense.

I would like to continue to clean up the existing Makefile rules though.

Regards,
Simon

author
#30 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

In reply to Simon Glass
Quoted 350 lines · Simon Glass

Hi Tom,

Quoted 213 lines · Tom Rini
Quoted 211 lines · Simon Glass

Hi Mark, Tom,

Quoted 194 lines · Mark Kettenis
Quoted 194 lines

Date: Sun, 31 Dec 2023 15:39:53 -0500
From: Tom Rini <[email protected]>

Quoted 188 lines · Simon Glass

Hi Sumit,

Quoted 173 lines · Sumit Garg
Quoted 163 lines · Simon Glass

Hi Tom,

Quoted 159 lines · Tom Rini
Quoted 156 lines · Simon Glass

Hi Tom, Sumit,

Quoted 88 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 44 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing
directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then
build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts
directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant
with upstream Linux kernel devicetree files.

Signed-off-by: Sumit Garg <[email protected]>
---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

dts/Kconfig | 11 +++++++++++
dts/Makefile | 17 ++++++++++++++---
dts/arch/arm64/Makefile | 14 ++++++++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 dts/arch/arm64/Makefile

diff --git a/dts/Kconfig b/dts/Kconfig
index 00c0aeff893..e58c1c6f2ab 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -85,6 +85,17 @@ config OF_LIVE
enables a live tree which is available after relocation,
and can be adjusted as needed.

+config OF_UPSTREAM
+ bool "Enable use of devicetree imported from Linux kernel release"
+ help
+ Traditionally, U-Boot platforms used to have their custom devicetree
+ files or copy devicetree files from Linux kernel which are hard to
+ maintain and can usually get out-of-sync from Linux kernel. This
+ option enables platforms to migrate to devicetree-rebasing repo where
+ a regular sync will be maintained every major Linux kernel release
+ cycle. However, platforms can still have some custom u-boot specific
+ bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 29 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

Quoted 8 lines
Quoted 5 lines

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

Using odroid-c2 with -next I see:

$ ls /tmp/b/odroid-c2/arch/arm/dts/
meson-a1-ad401.dtb                 meson-g12b-odroid-n2l.dtb
    meson-gxl-s905x-libretech-cc.dtb
meson-axg-jethome-jethub-j100.dtb  meson-g12b-odroid-n2-plus.dtb
    meson-gxl-s905x-libretech-cc-v2.dtb
meson-axg-s400.dtb                 meson-g12b-radxa-zero2.dtb
    meson-gxl-s905x-p212.dtb
meson-g12a-radxa-zero.dtb          meson-gxbb-kii-pro.dtb
    meson-gxm-gt1-ultimate.dtb
meson-g12a-sei510.dtb              meson-gxbb-nanopi-k2.dtb
    meson-gxm-khadas-vim2.dtb
meson-g12a-u200.dtb                meson-gxbb-odroidc2.dtb
    meson-gxm-s912-libretech-pc.dtb
meson-g12b-a311d-bananapi-m2s.dtb  meson-gxbb-p200.dtb
    meson-gxm-wetek-core2.dtb
meson-g12b-a311d-khadas-vim3.dtb   meson-gxbb-p201.dtb
    meson-sm1-bananapi-m2-pro.dtb
meson-g12b-bananapi-cm4-cm4io.dtb  meson-gxbb-wetek-hub.dtb
    meson-sm1-bananapi-m5.dtb
meson-g12b-gsking-x.dtb            meson-gxbb-wetek-play2.dtb
    meson-sm1-khadas-vim3l.dtb
meson-g12b-gtking.dtb              meson-gxl-s805x-libretech-ac.dtb
    meson-sm1-odroid-c4.dtb
meson-g12b-gtking-pro.dtb          meson-gxl-s905d-libretech-pc.dtb
    meson-sm1-odroid-hc4.dtb
meson-g12b-odroid-go-ultra.dtb
meson-gxl-s905w-jethome-jethub-j80.dtb  meson-sm1-sei610.dtb
meson-g12b-odroid-n2.dtb           meson-gxl-s905x-khadas-vim.dtb
$
With this series (sort of, since I am really not sure how to
cherry-pick the commits from the PR) I see nothing:
$ ls /tmp/b/odroid-c2/arch/arm/dts/
$

This shows some of the files:

$ find /tmp/b/odroid-c2/ -name "*.dtb"
/tmp/b/odroid-c2/dts/dt.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-odroidc2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-nanopi-k2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-play2.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-kii-pro.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p200.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-p201.dtb
/tmp/b/odroid-c2/dts/arch/arm64/amlogic/meson-gxbb-wetek-hub.dtb
/tmp/b/odroid-c2/u-boot.dtb

but where are the rest? Also, is it possible to put the output .dtb files into the same directory? Otherwise we may have some pain with binman.

Quoted 7 lines
Quoted 4 lines

What do you mean by same directory? But maybe also, what's an example of a board you think might end up having problems? Converting that in a follow-up series is likely a good idea, to highlight and address these issues sooner rather than later.#

Today the .dtb files go into arch/arm/dts - so it would be easier if this series could do the same.

Quoted 6 lines

The kbuild infrastructure keeps the dtb alongside dts files which is the preferred way too as otherwise it would be complicated to locate DT files for the users. Also, we have to move towards Linux DT directory structure and thereby the tools like binman have to be adjusted. I will do that when I get to migrating SoCs supporting binman.

OK, I want to stop here and rethink this. This is the path taken so far, I believe:

1. We want to use devicetree files taken from Linux and devicetree-rebasing provides these

Quoted 6 lines
Quoted 6 lines

Yes.

Quoted 2 lines

2. We want to use 'git subtree' to avoid needing a script to do the sync / create a commit

No. We want to use 'git subtree' to avoid having to use git submodules.

Well that is what I understood from Sumit, when I asked about a script. I imagine a 100-line Python script could do the same as:

   git subtree pull --prefix devicetree-rebasing

git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
<release-tag> --squash

Quoted 7 lines
Quoted 1 line

and it could also put the files in the right place for U-Boot.

I've been saying in various places for years that I want to move away from arch/*/dts being where we have the "just a copy" dts files and have them somewhere else so they are easier to manage and differentiate our changes / additions. So arch/*/dts cannot be some hard-coded "right" path.

OK

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

3. But this leaves us with a directory structure which doesn't match U-Boot (no script to fix it up)

No. We intentionally abandon arch/*/dts because it's so full of out of date files and never fully re-synced, only re-synced ad-hoc.

I mean that the dir structure doesn't match. I am not worried about keeping arch/*/dts but I want the same structure somewhere else, e.g. dtr/arch/*/dts

Quoted 6 lines

And what I want here is to match the same structure everyone that's not U-Boot uses. For better or worse no one else seems to have gone with "treat aarch64 as just another ARM", and then the vendor directory structure only makes that more obviously a mismatch. We need to follow what everyone else uses, and developers familiar with other projects will expect to see.

So you are saying that U-Boot should move to what Linux uses. I agree that seems like the best approach, so let's do it.

Quoted 72 lines
Quoted 61 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. So we deal with that by skipping the build rules and using CONFIG options to select what is built
5. So now we cannot build all the files for an SoC, just the ones that are in the CONFIG options
6. Linux doesn't actually use devicetree-rebasing itself, so doesn't have this problem

Quoted 6 lines
Quoted 6 lines

No. devicetree-rebasing skips the Makefiles because they're part of the kernel. We couldn't re-use them ourselves because we don't have the same CONFIG names the kernel does. And Sumit has not replicated the logic we have under arch/*/dts/Makefile today because I've asked him not to, and we'll figure out what subsets of that logic make sense to add back in as a second step not a first step.

Again, you are missing my point. I am not suggesting using Linux's build rules, just explaining why Linux doesn't have the problem we would be creating here.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

So this is heading in the wrong direction. Nor is it clear that this would just be a temporary problem.

A previous iteration of this series built all of the dtb files for the SoC that Sumit has migrated with this series, but then dropped it.

Oh.

Quoted 7 lines
Quoted 7 lines

[snip]

Quoted 4 lines

I would like to do this series properly, maintaining the SoC-specific build rules, not removing what I see as an important feature. It should not be that difficult to figure out and I am happy to help with it.

Quoted 7 lines
Quoted 7 lines

The problem is that the rest of us do not understand the use case you're describing where a dtb file that would be useful in a build is not already in the list to build. The only one of those use cases I understand thus far is the exynos4 (iirc) case you mentioned previously where yes, really, one defconfig + appending board.dtb is fine, or fine enough. It's not that far off of the SPL_LOAD_FIT case, but there we know what to build already.

Perhaps the problem is that the rest of you think of the build as all happening in U-Boot, similar to the proposed 'make image.fit' that I am trying to add to Linux.

But packaging can be (and often is) a separate step from building. Linux has no packaging mechanism today...it just builds everything (including all DTs) and stops.

We should be able to pick up whatever .dtb files we want and use them in an image.

Quoted 7 lines
Quoted 7 lines

And I guess trying to tie things up, that's my puzzle. SPL_LOAD_FIT is how I see the use case you talk about being solved, if a full U-Boot is generic enough for N boards, SPL_LOAD_FIT does the right thing (in this non-bloblist DTB, non-reusing-OS-inntended DTB world). I really don't knnow how many modern SoCs can take a literal concatenated DTB and even in those cases I don't get why that's the win we want now? 1 build to N binaries?

Quoted 3 lines

Yes SPL_LOAD_FIT is fine although in practice we will likely need SPL to use the correct DT as well, so the DT will need to be determined in TPL, perhaps.

I mean, SPL_LOAD_FIT still can handle this case, with a call to the function to re-parse the tree, when needed. I thought we did this today even, but perhaps I'm confusing my options here.

Quoted 3 lines

But anyway, this works OK with rk3399, for example. We need to support this use case.

Quoted 8 lines
Quoted 3 lines

Also, it is pretty easy. We just need to stick with the dir structure we have today and copy our existing Makefiles into that dir. Or change to the kernel dir structure and use that. Or do one, then the other.

I'm sorry, I don't understand what directory structure has to do with "build more dtbs". For the cases where it makes sense to, yes, we can build more dtbs, based on the SoC. I'm setting aside entirely the discussion on what SoCs that works for, for another thread.

Well you said above that we should switch to the kernel dir structure, so I believe that issue is resolved.

'build more dtbs' means build all the DTBs for an SoC, not just a selection that a particular board vendor decided on.

Quoted 7 lines

Perhaps an issue here is that much like the kernel "install" target, we need an "install" target too, so that whatever dtbs we build can be more easily found for external packaging, but whatever tooling it is that wants it? And perhaps this is part of the problem, tooling that expects to pull things out of the object directory rather than an "installed" directory?

This is where binman comes in. It can run as part of U-Boot build, to build a few default firmware images. Then it can be run *later*, outside the U-Boot build, with an augmented or more targeted image definition, with mostly the same input files, to pull together images for specific uses. As you say, the input files need to be in a defined location, which they are today, for the most part.

Quoted 15 lines

So even if a particular board only uses one DT, all the DTs for that SoC are built and so can be used in that final-packaging step. Without that build, there is no way to get the required .dtb files, other than building every board one by one and then pulling out the .dtb files or something weird like that.

Note that this works independently of whether OF_LIST is used, etc.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

But even then, I don't object to adding those rules to the Makefiles. If it works it works. I object to adding them when they don't work.

What do you mean by 'work'? With this series as is, it simply isn't possible to add Makefile rules, as they are ignored. Am I missing something?

That's not correct. Just to demonstrate this I have gone a step further to switch all Amlogic SoCs to use DT rebasing tree here [1]. As I have said before, the Makefile rules were just dropped based on Tom's feedback. However, if they really serve the existing tools from a packaging perspective I am open to migrate them as demonstrated here [2]. As before it will build all the DTBs corresponding to all the Amlogic SoCs supported in U-Boot for a single board defconfig.

[1] https://github.com/b49020/u-boot/commits/dt_for_test/
[2] https://github.com/b49020/u-boot/commit/ca5525673cdcafd71b51b48fe33c076f97a287fe

Quoted 6 lines
Quoted 5 lines

Yes, I think you're missing something. Perhaps you need to publish a WIP tree somewhere so someone can see what you're doing as it sounds like you're not able to add another SoC of any type on top of Sumit's tree and have it work.

Quoted 7 lines

The current -next source builds dtb files based on the SoC, for the most part. I sent a series to clean that up a bit[1], but it is mostly there.

From the above it seems like the plan could be:
1. Move arm64 .dts files to arch/arm64/dts/<vendor>/... and adjust Makefiles accordingly

As I said before it will be a redundant effort when you can just drop them in favour of dts/arch/arm64/<vendor>/.. We just have to maintain the *-u-boot.dtsi file in arch/*/dts/.

Quoted 3 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'.

Actually as part of this patch-set we try to reuse the U-Boot 'dts' directory (via dts/arch/arm64/<vendor> soft links) since it was already taken for U-Boot specific DT Makefile. However, I am open to renaming 'devicetree-rebasing' but to me that sounds more clear that we maintain a specific subtree within U-Boot.

Quoted 2 lines

Actually barebox even seems to have
scripts for handling all of this [2]??

That script is just doing the same thing as the DTC import script. git subtree is just another standardized way to do it.

[1] https://www.barebox.org/doc/latest/devicetree/index.html#barebox-device-trees

Quoted 5 lines

3. Adjust the build system to use the dts/ directory for .dts files when OF_UPSTREAM is enabled

Then it will be easy. People can enable OF_UPSTREAM for an SoC (without changing DEFAULT_DEVICE_TREE)

I am still not sure what we will gain via keeping DEFAULT_DEVICE_TREE the same. However, without a per vendor directory Makefile like:
dts/arch/arm64/<vendor>/Makefile it won't be possible. But to do that we won't be able to softlink vendor directories from DT rebasing tree but rather have to softlink every board DTS file which is much more painful.

Quoted 4 lines

and will get the same behaviour
as now, just with upstream .dts files. All the .dts files for an SoC are built, as now, just as Linux does. We can continue cleaning up the DT build rules as time permits.

I will reiterate here, we can decide to add Makefile rules on a case by case basis. If there is a need (from packaging perspective or a particular SoC supports a generic U-Boot image) then we should be able to add them. The cleanup would be automatically part of the process as we switch SoCs to OF_UPSTREAM.

-Sumit

Quoted 6 lines

Regards,
Simon

[1] http://patchwork.ozlabs.org/project/uboot/list/?series=388154
[2] https://git.pengutronix.de/cgit/barebox/tree/dts

#31 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 1 line · Sumit Garg

On Tue, 2 Jan 2024 at 19:36, Simon Glass <[email protected]> wrote:

[snip]

Quoted 9 lines
Quoted 3 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'.

Actually as part of this patch-set we try to reuse the U-Boot 'dts' directory (via dts/arch/arm64/<vendor> soft links) since it was already taken for U-Boot specific DT Makefile. However, I am open to renaming 'devicetree-rebasing' but to me that sounds more clear that we maintain a specific subtree within U-Boot.

Looking at what little is in dts/ here today could we just use subtree and pop the contents under there, and basically ignore the project-provided Makefile? Or is that not really worth it?

Signature · 1 line
Tom
author
#32 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 1 line · Sumit Garg

On Tue, 2 Jan 2024 at 19:36, Simon Glass <[email protected]> wrote:

[snip]

Quoted 9 lines
Quoted 3 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'.

Actually as part of this patch-set we try to reuse the U-Boot 'dts' directory (via dts/arch/arm64/<vendor> soft links) since it was already taken for U-Boot specific DT Makefile. However, I am open to renaming 'devicetree-rebasing' but to me that sounds more clear that we maintain a specific subtree within U-Boot.

Quoted 4 lines

Looking at what little is in dts/ here today could we just use subtree and pop the contents under there, and basically ignore the project-provided Makefile? Or is that not really worth it?

If we really want to avoid soft links then I did try to add the subree with the prefix as dts/upstream here [1]. It works well with the downside that we will pollute the subtree source code with U-Boot specific Makefiles [2]. However, the subtree pull works fine still. If this sounds better to you and Simon then let me know I will use this approach for v4.

[1] https://github.com/b49020/u-boot/commits/use_dts_dir/
[2] https://github.com/b49020/u-boot/commit/90eabe614e77bc30a437e7d5559c1ac414ac07b3

-Sumit

Quoted 2 lines

--
Tom

#33 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Quoted 29 lines · Sumit Garg

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 1 line · Sumit Garg

On Tue, 2 Jan 2024 at 19:36, Simon Glass <[email protected]> wrote:

[snip]

Quoted 9 lines
Quoted 3 lines

2. Choose a directory target for devicetree-rebasing. I see that 'barebox' uses 'dts' which seems better to me than 'devicetree-rebasing/src/'.

Actually as part of this patch-set we try to reuse the U-Boot 'dts' directory (via dts/arch/arm64/<vendor> soft links) since it was already taken for U-Boot specific DT Makefile. However, I am open to renaming 'devicetree-rebasing' but to me that sounds more clear that we maintain a specific subtree within U-Boot.

Quoted 4 lines

Looking at what little is in dts/ here today could we just use subtree and pop the contents under there, and basically ignore the project-provided Makefile? Or is that not really worth it?

If we really want to avoid soft links then I did try to add the subree with the prefix as dts/upstream here [1]. It works well with the downside that we will pollute the subtree source code with U-Boot specific Makefiles [2]. However, the subtree pull works fine still. If this sounds better to you and Simon then let me know I will use this approach for v4.

Quoted 2 lines

[1] https://github.com/b49020/u-boot/commits/use_dts_dir/
[2] https://github.com/b49020/u-boot/commit/90eabe614e77bc30a437e7d5559c1ac414ac07b3

I think the symlink stuff was part of what was making it more confusing to add new SoCs to OF_UPSTREAM so yes this looks good to me, and I appreciate the demo commit showing an update is still easy. Thanks!

Signature · 1 line
Tom
author
#34 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

In reply to Sumit Garg
Quoted 2 lines · Sumit Garg

On Tue, 2 Jan 2024 at 19:36, Simon Glass <[email protected]> wrote:

<snip>

Quoted 7 lines
Quoted 6 lines

3. Adjust the build system to use the dts/ directory for .dts files when OF_UPSTREAM is enabled

Then it will be easy. People can enable OF_UPSTREAM for an SoC (without changing DEFAULT_DEVICE_TREE)

Quoted 6 lines

I am still not sure what we will gain via keeping DEFAULT_DEVICE_TREE the same. However, without a per vendor directory Makefile like:
dts/arch/arm64/<vendor>/Makefile it won't be possible. But to do that we won't be able to softlink vendor directories from DT rebasing tree but rather have to softlink every board DTS file which is much more painful.

Even after this you have to tell <vendor> name via DEFAULT_DEVICE_TREE because the DTB path is constructed via:

DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%) ifeq ($(DEVICE_TREE),)
DEVICE_TREE := unset
endif

ifeq ($(CONFIG_OF_UPSTREAM),y)
ifeq ($(CONFIG_ARM64),y)
dt_dir := dts/arch/arm64
else
dt_dir := dts/arch/$(ARCH)
endif
else
dt_dir := arch/$(ARCH)/dts
endif

ifneq ($(EXT_DTB),)
DTB := $(EXT_DTB)
else
DTB := $(dt_dir)/$(DEVICE_TREE).dtb
endif

So with a move to Linux directory structure for dts directory, DEFAULT_DEVICE_TREE have to specify <vendor>/<name> as DT filename.

-Sumit

Quoted 20 lines
Quoted 5 lines

and will get the same behaviour
as now, just with upstream .dts files. All the .dts files for an SoC are built, as now, just as Linux does. We can continue cleaning up the DT build rules as time permits.

I will reiterate here, we can decide to add Makefile rules on a case by case basis. If there is a need (from packaging perspective or a particular SoC supports a generic U-Boot image) then we should be able to add them. The cleanup would be automatically part of the process as we switch SoCs to OF_UPSTREAM.

-Sumit

Quoted 6 lines

Regards,
Simon

[1] http://patchwork.ozlabs.org/project/uboot/list/?series=388154
[2] https://git.pengutronix.de/cgit/barebox/tree/dts

#35 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

In reply to Simon Glass

[snip]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines

However, I am very much in favour of having a generalized U-Boot image. This might become true in some cases like U-Boot acts as a second stage bootloader for a particular SoC which is a unified image where the prior stage passes the DT to it. The Qcom effort in this direction can be an example here.

Not relevant to the topic at hand, perhaps, but Qualcomm uses a closed-source blob to jump to U-Boot and is certainly not an example we should emulate. But yes, passing a DT to U-Boot proper can be useful.

Just to chime in here, this limitation is true for production Qualcomm devices where all of the bootloader blobs are signed by the OEM (true for most phones). But for development platforms we can do better. I expect this is a topic we will keep on coming back to, so I'd like to just take the time to explain some of the technical details on Qualcomm platforms, as there is a lot more nuance than you might be aware of.

The modern Qualcomm boot chain is (roughly) PBL (bootrom) -> TZ/el3 -> sbl1 (secondary bootloader) -> hypervisor -> XBL_Core (UEFI impl) -> ABL (LinuxLoader.efi app) -> Linux

On production devices the best we can do is replace "Linux" with U-Boot, and if we're lucky then we can leverage features of ABL to simplify things like DTB selection (it supports picking from a bunch of concatenated DTBs, but we can just as easily implement some similar feature in U-Boot ourselves).

On a development board I have been successful in replacing the hypervisor with a stub and replacing XBL_Core with U-Boot - giving us EL2 and removing the entire proprietary UEFI stack. There is no reason that we can't go further than this.

The Qualcomm Chromebooks all run Coreboot, for sure on those it would be possible to use U-Boot much earlier (although there is still the proprietary XBL_Sec TZ blob).

The Dragonboard410c (and MSM8916 SoC overall) has been pretty much entirely ripped open thanks to Stephan Gerhold and the msm8916-mainline project. On these devices it is easily possible to run U-Boot as a first-stage bootloader (at least to the same extent one can on the more open ARM platforms, or even more open if you wish). Although the bootloader of choice for most of these devices is a home-grown fork of lk.

For new SoCs, with the number of Qualcomm devices out there, and communities like postmarketOS enabling support on so many of them... My hope is that we will quickly see phones being the most common Qualcomm devices supported by U-Boot. While it is indeed extremely unfortunate that we can't replace the bootloader entirely, using U-Boot as a fresh slate is still extremely liberating (EFI! Firmware updates! No need for distro hacks to update the kernel! Multi-boot! etc...). I wish we could focus more on how U-Boot will make supporting Linux on these devices SO SO much easier, and less on how broken the (usually impossible to modify) bootloader they shipped with is.

While almost all of the boot chain I explained above is proprietary, the ABL source code is publicly available (although most device vendors don't publish their modified production version, I suppose for fear of embarrassment). The statement "Qualcomm uses a closed-source blob to jump to U-Boot" is at the very least an oversimplification.

To be contrarian, here is an example of a phone vendor who do publish their ABL source code, here is the code that runs Linux (or U-Boot in our case).

https://github.com/SHIFTPHONES/android_bootable_bootloader_edk2/blob/sos-3.x/QcomModulePkg/Library/BootLib/BootLinux.c#L1039

My point is, there is a lot of nuance and complexity here, and we need to be careful about what exactly we're referring to.

Kind regards,
Caleb

Quoted 34 lines
Quoted 15 lines
Quoted 9 lines

It's a very valid use case we need to continue to support. And to save Mark from having to repeat himself, again, it's intentionally and not changing, how the Apple M1/M2/etc platforms boot. I'm pretty sure the fact that one can use U-Boot this way is part of how engineers get proof of concept work done to show that if they had U-Boot available then they could also support X/Y/Z easier. And maybe they'll be able to longer term push internally to use bloblist to pass things along.

Quoted 5 lines

Heck, trying to not go too far off on a tangent, maybe the m1n1 loader can implement both conventions, as both Linux Kernel[0] and Bloblist[1] use x0 for device tree, but bloblist has x1 non-zero and Linux does not, so both could be present here? Or is there some incompatibility I don't see on quick skimming?

Quoted 6 lines

Right. Some time ago I suggested Simon to lobby the Linux kernel folks to change the arm64 Linux kernel entry convention to state that x1 can be non-zero in which case it points at a bloblist. If that happened I'd probably do the work to make m1n1 pass a bloblist. And it would probably make the folks who want to directly boot a Linux kernel from TF-A (without going through U-Boot) happy as well.

I got a lot of push-back on that. Perhaps there might be some willingness if it is explained that Linux doesn't need to understand the bloblist, just tolerate it being there. There are probably other people who will be more successful at pushing for kernel changes.

As you know, the handoff protocol is designed such that you don't need to decode the bloblist to find the devicetree. BTW I would like to put the ACPI/SMBIOS tables in the bloblist as well (with EFI we would provide pointers into the bloblist for Linux to use)

Regards,
Simon

Signature · 1 line
// Caleb (they/them)
#36 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

Hi Caleb,

Quoted 64 lines · Caleb Connolly

[snip]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines

However, I am very much in favour of having a generalized U-Boot image. This might become true in some cases like U-Boot acts as a second stage bootloader for a particular SoC which is a unified image where the prior stage passes the DT to it. The Qcom effort in this direction can be an example here.

Not relevant to the topic at hand, perhaps, but Qualcomm uses a closed-source blob to jump to U-Boot and is certainly not an example we should emulate. But yes, passing a DT to U-Boot proper can be useful.

Just to chime in here, this limitation is true for production Qualcomm devices where all of the bootloader blobs are signed by the OEM (true for most phones). But for development platforms we can do better. I expect this is a topic we will keep on coming back to, so I'd like to just take the time to explain some of the technical details on Qualcomm platforms, as there is a lot more nuance than you might be aware of.

The modern Qualcomm boot chain is (roughly) PBL (bootrom) -> TZ/el3 -> sbl1 (secondary bootloader) -> hypervisor -> XBL_Core (UEFI impl) -> ABL (LinuxLoader.efi app) -> Linux

On production devices the best we can do is replace "Linux" with U-Boot, and if we're lucky then we can leverage features of ABL to simplify things like DTB selection (it supports picking from a bunch of concatenated DTBs, but we can just as easily implement some similar feature in U-Boot ourselves).

On a development board I have been successful in replacing the hypervisor with a stub and replacing XBL_Core with U-Boot - giving us EL2 and removing the entire proprietary UEFI stack. There is no reason that we can't go further than this.

The Qualcomm Chromebooks all run Coreboot, for sure on those it would be possible to use U-Boot much earlier (although there is still the proprietary XBL_Sec TZ blob).

The Dragonboard410c (and MSM8916 SoC overall) has been pretty much entirely ripped open thanks to Stephan Gerhold and the msm8916-mainline project. On these devices it is easily possible to run U-Boot as a first-stage bootloader (at least to the same extent one can on the more open ARM platforms, or even more open if you wish). Although the bootloader of choice for most of these devices is a home-grown fork of lk.

For new SoCs, with the number of Qualcomm devices out there, and communities like postmarketOS enabling support on so many of them... My hope is that we will quickly see phones being the most common Qualcomm devices supported by U-Boot. While it is indeed extremely unfortunate that we can't replace the bootloader entirely, using U-Boot as a fresh slate is still extremely liberating (EFI! Firmware updates! No need for distro hacks to update the kernel! Multi-boot! etc...). I wish we could focus more on how U-Boot will make supporting Linux on these devices SO SO much easier, and less on how broken the (usually impossible to modify) bootloader they shipped with is.

While almost all of the boot chain I explained above is proprietary, the ABL source code is publicly available (although most device vendors don't publish their modified production version, I suppose for fear of embarrassment). The statement "Qualcomm uses a closed-source blob to jump to U-Boot" is at the very least an oversimplification.

Quoted 8 lines

To be contrarian, here is an example of a phone vendor who do publish their ABL source code, here is the code that runs Linux (or U-Boot in our case).

https://github.com/SHIFTPHONES/android_bootable_bootloader_edk2/blob/sos-3.x/QcomModulePkg/Library/BootLib/BootLinux.c#L1039

My point is, there is a lot of nuance and complexity here, and we need to be careful about what exactly we're referring to.

Thank you very much for the information, it is a great read. Yes my comment was wide of the mark and I am pleased to hear it.

BTW, I would very much like to see Linaro ensuring that new 96boards have open source firmware before they are released. Before release seems to be the only time that the vendor can devote time to it.

Regards,
Simon

author
#37 lore raw

Re: [PATCH v3 4/8] dts: Add alternative location for upstream DTB builds

In reply to Simon Glass

Hi Simon,

Quoted 95 lines · Simon Glass

Hi Tom, Sumit,

Quoted 91 lines · Tom Rini
Quoted 52 lines · Simon Glass

Hi Sumit,

Quoted 34 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---

Changes in v3:
--------------
- Minor commit message update

Changes in v2:
--------------
- s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/

 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..e58c1c6f2ab 100644
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 

dts/Kconfig config OF_LIVE · line 97

Quoted 10 lines
dts/Kconfig +10 -0
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-Boot platforms used to have their custom devicetree
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

My only other suggestion here is to mention that this should be set in Kconfig, for the SoC as a whole. So I believe that means that it should be hidden, with no string for the 'bool':

Quoted 1 line

bool # Enable use of devicetree imported from Linux kernel release

I think we can just keep prompting for it now, to make the transition easier, before this option just goes away in time, hopefully.

Quoted 32 lines

Also, this doesn't seem to work for me. Before this series I get these files when building firefly-rk3399:

rk3399-eaidk-610.dtb rk3399-khadas-edge-v.dtb
rk3399-orangepi.dtb rk3399-rock-pi-4a.dtb
rk3399-evb.dtb rk3399-leez-p710.dtb
rk3399-pinebook-pro.dtb rk3399-rock-pi-4c.dtb
rk3399-ficus.dtb rk3399-nanopc-t4.dtb
rk3399-pinephone-pro.dtb rk3399-rockpro64.dtb
rk3399-firefly.dtb rk3399-nanopi-m4-2gb.dtb
rk3399pro-rock-pi-n10.dtb rk3399-roc-pc.dtb
rk3399-gru-bob.dtb rk3399-nanopi-m4b.dtb
rk3399-puma-haikou.dtb rk3399-roc-pc-mezzanine.dtb
rk3399-gru-kevin.dtb rk3399-nanopi-m4.dtb
rk3399-rock-4c-plus.dtb

rk3399-khadas-edge-captain.dtb  rk3399-nanopi-neo4.dtb    rk3399-rock-4se.dtb
rk3399-khadas-edge.dtb          rk3399-nanopi-r4s.dtb     rk3399-rock960.dtb

Afterwards I get this:

make[3]: *** No rule to make target 'dts/arch/arm64/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

So I set this manually for that one board:

CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"

and get:

make[3]: *** No rule to make target 'dts/arch/arm64/rockchip/rk3399-firefly.dtb', needed by 'dtbs'. Stop.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I am not sure how to fix this, nor how this can be made to build all the DTs for rk3399, as it does today.

Looking at the patch for amlogic boards, you need to make the link to devicetree-rebasing inside dts/...

OK, let me give up on rk3399 for now...that doesn't seem to work even with the link.

I went ahead to debug this rk3399 issue. It turned out to be a subtle Makefile dependency corner case that I missed in v3. Following change should fix the issue, I will incorporate it in v4. However, while switching rk3399 to upstream DT I noticed many gaps from upstream DT, one that occured to me was difference in clk id SCLK_DDRCLK (U-Boot) vs SCLK_DDRC (upstream DT).

scripts/Makefile.lib +0 -1
index bdc1da43e7a..9526eb073f1 100644
@@ -358,7 +359,7 @@ ifdef CONFIG_EFI_CAPSULE_AUTHENTICATE
 dtsi_include_list += $(capsule_esl_dtsi)
 endif
 
-dtsi_include_list_deps = $(addprefix $(obj)/,$(subst

$(quote),,$(dtsi_include_list))) +dtsi_include_list_deps = $(addprefix $(u_boot_dtsi_loc)/,$(subst $(quote),,$(dtsi_include_list)))

ifneq ($(CHECK_DTBS),)
DT_CHECKER ?= dt-validate

-Sumit

author
#38 lore raw

PATCH v3 5/8 doc: devicetree: Updates for devicetree-rebasing subtree

In reply to Sumit Garg

Encourage SoC/board maintainers to migrate to using devicetree-rebasing subtree and maintain a regular sync with Linux kernel devicetree files and bindings.

Along with that add documentation regarding how to run DT bindings schema checks.

---

Changes in v3:
--------------
- Replace CONFIG_* with Kconfig options

Changes in v2:
--------------
- s/U-boot/U-Boot/

 doc/develop/devicetree/control.rst | 131 +++++++++++++++++++++--------
 1 file changed, 96 insertions(+), 35 deletions(-)
doc/develop/devicetree/control.rst +96 -35
index cbb65c9b177..65180d33e8d 100644
@@ -1,5 +1,6 @@
 .. SPDX-License-Identifier: GPL-2.0+
 .. sectionauthor:: Copyright 2011 The Chromium OS Authors
+.. Copyright 2023 Linaro Ltd.
 
 Devicetree Control in U-Boot
 ============================
@@ -22,14 +23,13 @@ for three reasons:
   hierarchical format
 - It is fairly efficient to read incrementally
 
-The arch/<arch>/dts directories contains a Makefile for building the devicetree
-blob and embedding it in the U-Boot image. This is useful since it allows
-U-Boot to configure itself according to what it finds there. If you have
-a number of similar boards with different peripherals, you can describe
-the features of each board in the devicetree file, and have a single
-generic source base.
+The U-Boot Makefile infrastructure allows for building the devicetree blob
+and embedding it in the U-Boot image. This is useful since it allows U-Boot
+to configure itself according to what it finds there. If you have a number
+of similar boards with different peripherals, you can describe the features
+of each board in the devicetree file, and have a single generic source base.
 
-To enable this feature, add CONFIG_OF_CONTROL to your board config file.
+To enable this feature, select `OF_CONTROL` via Kconfig.
 
 
 What is a Flattened Devicetree?
@@ -68,8 +68,21 @@ a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file.
 Where do I get a devicetree file for my board?
 ----------------------------------------------
 
-You may find that the Linux kernel has a suitable file. Look in the
-kernel source in arch/<arch>/boot/dts.
+Linux kernel Git repository has been the place where devicetree files along
+with devicetree bindings are stored and maintained. There is devicetee-rebasing
+(dtrepo_) which maintains a forked copy of devicetree files along with bindings
+at every Linux kernel major release or intermideate release candidates.
+
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash
+
+You may find that the `devicetee-rebasing/` sub-directory has a suitable
+devicetree file for your board. Look in `devicetree-rebasing/src/<arch>/`.
 
 If not you might find other boards with suitable files that you can
 modify to your needs. Look in the board directories for files with a
@@ -81,34 +94,34 @@ Failing that, you could write one from scratch yourself!
 Configuration
 -------------
 
-Use::
+Traditionally, U-Boot placed copies of devicetree source files from Linux
+kernel into `arch/<arch>/dts/<name>.dts` which can be selected via setting
+"<name>" when prompted for `DEFAULT_DEVICE_TREE` by Kconfig.
 
-   #define CONFIG_DEFAULT_DEVICE_TREE	"<name>"
+However, it has become combersome over time for each SoC/board maintainer to
+keep devicetree files in sync with Linux kernel. Thereby, SoC/board maintainers
+are encouraged to migrate to use mirrored copies from `devicetree-rebasing/`
+into `dts/arch/<arch>/<vendor>`. To do that enable `OF_UPSTREAM` via Kconfig and
+set up "<vendor>/<name>" when prompted for `DEFAULT_DEVICE_TREE` by Kconfig.
 
-to set the filename of the devicetree source. Then put your devicetree
-file into::
+This should include your CPU or SOC's devicetree file. On top of that any U-Boot
+specific tweaks (see: dttweaks_) can be made for your board.
 
-   arch/<arch>/dts/<name>.dts
-
-This should include your CPU or SOC's devicetree file, placed in
-`arch/<arch>/dts`, and then make any adjustments required using a u-boot-dtsi
-file for your board.
-
-If CONFIG_OF_EMBED is defined, then it will be picked up and built into
+If `OF_EMBED` is selected by Kconfig, then it will be picked up and built into
 the U-Boot image (including u-boot.bin). This is suitable for debugging
 and development only and is not recommended for production devices.
 
-If CONFIG_OF_SEPARATE is defined, then it will be built and placed in
+If `OF_SEPARATE` is selected by Kconfig, then it will be built and placed in
 a u-boot.dtb file alongside u-boot-nodtb.bin with the combined result placed
-in u-boot.bin so you can still just flash u-boot.bin onto your board. If you are
-using CONFIG_SPL_FRAMEWORK, then u-boot.img will be built to include the device
-tree binary.
+in u-boot.bin so you can still just flash u-boot.bin onto your board. If Kconfig
+option `SPL_FRAMEWORK` is enabled, then u-boot.img will be built to include the
+device tree binary.
 
-If CONFIG_OF_BOARD is defined, a board-specific routine will provide the
+If `OF_BOARD` is selected by Kconfig, a board-specific routine will provide the
 devicetree at runtime, for example if an earlier bootloader stage creates
 it and passes it to U-Boot.
 
-If CONFIG_SANDBOX is defined, then it will be read from a file on
+If `SANDBOX` is selected by Kconfig, then it will be read from a file on
 startup. Use the -d flag to U-Boot to specify the file to read, -D for the
 default and -T for the test devicetree, used to run sandbox unit tests.
 
@@ -142,7 +155,7 @@ Build:
 After the board configuration is done, fdt supported u-boot can be built in two
 ways:
 
-#  build the default dts which is defined from CONFIG_DEFAULT_DEVICE_TREE::
+#  build the default dts which is selected by DEFAULT_DEVICE_TREE Kconfig::
 
     $ make
 
@@ -156,8 +169,9 @@ ways:
 Adding tweaks for U-Boot
 ------------------------
 
-It is strongly recommended that devicetree files in U-Boot are an exact copy of
-those in Linux, so that it is easy to sync them up from time to time.
+With devicetee-rebasing Git subtree, it is ensured that devicetree files in
+U-Boot are an exact copy of those in Linux kernel via mirroring into
+`dts/arch/<arch>/<vendor>`.
 
 U-Boot is of course a very different project from Linux, e.g. it operates under
 much more restrictive memory and code-size constraints. Where Linux may use a
@@ -170,8 +184,8 @@ constraints are even more extreme and the devicetree is shrunk to remove
 unwanted nodes, or even turned into C code to avoid access overhead.
 
 U-Boot automatically looks for and includes a file with updates to the standard
-devicetree for your board, searching for them in the same directory as the
-main file, in this order::
+devicetree for your board, searching for them in `arch/<arch>/dts/` in this
+order::
 
    <orig_filename>-u-boot.dtsi
    <CONFIG_SYS_SOC>-u-boot.dtsi
@@ -195,11 +209,57 @@ As mentioned above, the U-Boot build system automatically includes a
 `*-u-boot.dtsi` file, if found, containing U-Boot specific
 quirks. However, some data, such as the mentioned public keys, are not
 appropriate for upstream U-Boot but are better kept and maintained
-outside the U-Boot repository. You can use CONFIG_DEVICE_TREE_INCLUDES
-to specify a list of .dtsi files that will also be included when
+outside the U-Boot repository. You can use `DEVICE_TREE_INCLUDES` Kconfig
+option to specify a list of .dtsi files that will also be included when
 building .dtb files.
 
 
+Devicetree bindings schema checks
+---------------------------------
+
+With devicetee-rebasing Git subtree, the devicetree bindings are also regularly
+synced with Linux kernel as `devicetree-rebasing/Bindings/` sub-directory. This
+allows U-Boot to run devicetree bindings schema checks which will bring
+compliance to U-Boot core/drivers regarding usage of devicetree.
+
+Dependencies
+~~~~~~~~~~~~
+
+The DT schema project must be installed in order to validate the DT schema
+binding documents and validate DTS files using the DT schema. The DT schema
+project can be installed with pip::
+
+    pip3 install dtschema
+
+Note that 'dtschema' installation requires 'swig' and Python development files
+installed first. On Debian/Ubuntu systems::
+
+    apt install swig python3-dev
+
+Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be
+installed. Ensure they are in your PATH (~/.local/bin by default).
+
+Recommended is also to install yamllint (used by dtschema when present).
+
+Running checks
+~~~~~~~~~~~~~~
+
+In order to perform validation of DTB files, use the ``dtbs_check`` target::
+
+    make dtbs_check
+
+It is also possible to run checks with a subset of matching schema files by
+setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or
+patterns (partial match of a fixed string). Each file or pattern should be
+separated by ':'.
+
+::
+
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
+    make dtbs_check DT_SCHEMA_FILES=/gpio/
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml
+
+
 Relocation, SPL and TPL
 -----------------------
 
@@ -261,8 +321,9 @@ used it before Linux (e.g. snow). The two projects developed in parallel
 and there are still some differences in the bindings for certain boards.
 While there has been discussion of having a separate repository for devicetree
 files, in practice the Linux kernel Git repository has become the place where
-these are stored, with U-Boot taking copies and adding tweaks with u-boot.dtsi
-files.
+these are stored, with U-Boot taking copies via devicetree-rebasing repo
+(see: dtrepo_) and adding tweaks with u-boot.dtsi files.
 
 .. _dtspec: https://www.devicetree.org/specifications/
 .. _dtlist: https://www.spinics.net/lists/devicetree-compiler/
+.. _dtrepo: https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
Signature · 1 line
2.34.1
Reviewed-by on v3 5/8
#39 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 8 lines · Sumit Garg

Encourage SoC/board maintainers to migrate to using devicetree-rebasing subtree and maintain a regular sync with Linux kernel devicetree files and bindings.

Along with that add documentation regarding how to run DT bindings schema checks.

Thanks for the related cleanups in there.

Signature · 1 line
Tom
#40 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

In reply to Sumit Garg

Hi Sumit,

Quoted 41 lines · Sumit Garg

Encourage SoC/board maintainers to migrate to using devicetree-rebasing subtree and maintain a regular sync with Linux kernel devicetree files and bindings.

Along with that add documentation regarding how to run DT bindings schema checks.

---

Changes in v3:
--------------
- Replace CONFIG_* with Kconfig options

Changes in v2:
--------------
- s/U-boot/U-Boot/

 doc/develop/devicetree/control.rst | 131 +++++++++++++++++++++--------
 1 file changed, 96 insertions(+), 35 deletions(-)
doc/develop/devicetree/control.rst +1 -4
index cbb65c9b177..65180d33e8d 100644
@@ -1,5 +1,6 @@
 .. SPDX-License-Identifier: GPL-2.0+
 .. sectionauthor:: Copyright 2011 The Chromium OS Authors
+.. Copyright 2023 Linaro Ltd.
 
 Devicetree Control in U-Boot
 ============================
@@ -22,14 +23,13 @@ for three reasons:
   hierarchical format
 - It is fairly efficient to read incrementally
 
-The arch/<arch>/dts directories contains a Makefile for building the devicetree
-blob and embedding it in the U-Boot image. This is useful since it allows
-U-Boot to configure itself according to what it finds there. If you have
-a number of similar boards with different peripherals, you can describe

doc/develop/devicetree/control.rst for three reasons: · line 32

Quoted 10 lines
doc/develop/devicetree/control.rst +6 -3
-the features of each board in the devicetree file, and have a single
-generic source base.
+The U-Boot Makefile infrastructure allows for building the devicetree blob
+and embedding it in the U-Boot image. This is useful since it allows U-Boot
+to configure itself according to what it finds there. If you have a number
+of similar boards with different peripherals, you can describe the features
+of each board in the devicetree file, and have a single generic source base.
 
-To enable this feature, add CONFIG_OF_CONTROL to your board config file.
+To enable this feature, select `OF_CONTROL` via Kconfig.

These changes to remove CONFIG_ are good, but I think they should be in a separate, prior patch.

Quoted 12 lines
doc/develop/devicetree/control.rst +3 -2
 What is a Flattened Devicetree?
@@ -68,8 +68,21 @@ a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file.
 Where do I get a devicetree file for my board?
 ----------------------------------------------
 
-You may find that the Linux kernel has a suitable file. Look in the
-kernel source in arch/<arch>/boot/dts.
+Linux kernel Git repository has been the place where devicetree files along
+with devicetree bindings are stored and maintained. There is devicetee-rebasing
+(dtrepo_) which maintains a forked copy of devicetree files along with bindings

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 83

Quoted 10 lines
doc/develop/devicetree/control.rst +10 -0
+at every Linux kernel major release or intermideate release candidates.
+
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash
+

This is an internal detail and I believe it will confuse people. Can you put this in a section like 'Resyncing with devicetree-rebasing' and explain when this might be needed?...almost enver, right?

Quoted 6 lines
doc/develop/devicetree/control.rst +2 -0
+You may find that the `devicetee-rebasing/` sub-directory has a suitable
+devicetree file for your board. Look in `devicetree-rebasing/src/<arch>/`.
 
 If not you might find other boards with suitable files that you can
 modify to your needs. Look in the board directories for files with a

doc/develop/devicetree/control.rst Failing that, you could write one from scratch yourself! · line 101

Quoted 10 lines
doc/develop/devicetree/control.rst +4 -2
@@ -81,34 +94,34 @@ Failing that, you could write one from scratch yourself!
 Configuration
 -------------
 
-Use::
+Traditionally, U-Boot placed copies of devicetree source files from Linux
+kernel into `arch/<arch>/dts/<name>.dts` which can be selected via setting
+"<name>" when prompted for `DEFAULT_DEVICE_TREE` by Kconfig.
 
-   #define CONFIG_DEFAULT_DEVICE_TREE  "<name>"
+However, it has become combersome over time for each SoC/board maintainer to

spelling

doc/develop/devicetree/control.rst Failing that, you could write one from scratch yourself! · line 102

Quoted 1 line
doc/develop/devicetree/control.rst +1 -0
+keep devicetree files in sync with Linux kernel. Thereby, SoC/board maintainers

s/Thereby/Therefore/

doc/develop/devicetree/control.rst Failing that, you could write one from scratch yourself! · line 104

Quoted 2 lines
doc/develop/devicetree/control.rst +2 -0
+are encouraged to migrate to use mirrored copies from `devicetree-rebasing/`
+into `dts/arch/<arch>/<vendor>`. To do that enable `OF_UPSTREAM` via Kconfig

for the SoC being used

Quoted 28 lines

and

doc/develop/devicetree/control.rst +8 -13
+set up "<vendor>/<name>" when prompted for `DEFAULT_DEVICE_TREE` by Kconfig.
 
-to set the filename of the devicetree source. Then put your devicetree
-file into::
+This should include your CPU or SOC's devicetree file. On top of that any U-Boot
+specific tweaks (see: dttweaks_) can be made for your board.
 
-   arch/<arch>/dts/<name>.dts
-
-This should include your CPU or SOC's devicetree file, placed in
-`arch/<arch>/dts`, and then make any adjustments required using a u-boot-dtsi
-file for your board.
-
-If CONFIG_OF_EMBED is defined, then it will be picked up and built into
+If `OF_EMBED` is selected by Kconfig, then it will be picked up and built into
 the U-Boot image (including u-boot.bin). This is suitable for debugging
 and development only and is not recommended for production devices.
 
-If CONFIG_OF_SEPARATE is defined, then it will be built and placed in
+If `OF_SEPARATE` is selected by Kconfig, then it will be built and placed in
 a u-boot.dtb file alongside u-boot-nodtb.bin with the combined result placed
-in u-boot.bin so you can still just flash u-boot.bin onto your board. If you are
-using CONFIG_SPL_FRAMEWORK, then u-boot.img will be built to include the device
-tree binary.
+in u-boot.bin so you can still just flash u-boot.bin onto your board. If Kconfig
+option `SPL_FRAMEWORK` is enabled, then u-boot.img will be built to include the
+device tree binary.

doc/develop/devicetree/control.rst Failing that, you could write one from scratch yourself! · line 126

Quoted 10 lines
doc/develop/devicetree/control.rst +2 -2
 
-If CONFIG_OF_BOARD is defined, a board-specific routine will provide the
+If `OF_BOARD` is selected by Kconfig, a board-specific routine will provide the
 devicetree at runtime, for example if an earlier bootloader stage creates
 it and passes it to U-Boot.
 
-If CONFIG_SANDBOX is defined, then it will be read from a file on
+If `SANDBOX` is selected by Kconfig, then it will be read from a file on
 startup. Use the -d flag to U-Boot to specify the file to read, -D for the
 default and -T for the test devicetree, used to run sandbox unit tests.

As above, please move the CONFIG changes into a prior patch.

Quoted 55 lines
doc/develop/devicetree/control.rst +19 -7
@@ -142,7 +155,7 @@ Build:
 After the board configuration is done, fdt supported u-boot can be built in two
 ways:
 
-#  build the default dts which is defined from CONFIG_DEFAULT_DEVICE_TREE::
+#  build the default dts which is selected by DEFAULT_DEVICE_TREE Kconfig::
 
     $ make
 
@@ -156,8 +169,9 @@ ways:
 Adding tweaks for U-Boot
 ------------------------
 
-It is strongly recommended that devicetree files in U-Boot are an exact copy of
-those in Linux, so that it is easy to sync them up from time to time.
+With devicetee-rebasing Git subtree, it is ensured that devicetree files in
+U-Boot are an exact copy of those in Linux kernel via mirroring into
+`dts/arch/<arch>/<vendor>`.
 
 U-Boot is of course a very different project from Linux, e.g. it operates under
 much more restrictive memory and code-size constraints. Where Linux may use a
@@ -170,8 +184,8 @@ constraints are even more extreme and the devicetree is shrunk to remove
 unwanted nodes, or even turned into C code to avoid access overhead.
 
 U-Boot automatically looks for and includes a file with updates to the standard
-devicetree for your board, searching for them in the same directory as the
-main file, in this order::
+devicetree for your board, searching for them in `arch/<arch>/dts/` in this
+order::
 
    <orig_filename>-u-boot.dtsi
    <CONFIG_SYS_SOC>-u-boot.dtsi
@@ -195,11 +209,57 @@ As mentioned above, the U-Boot build system automatically includes a
 `*-u-boot.dtsi` file, if found, containing U-Boot specific
 quirks. However, some data, such as the mentioned public keys, are not
 appropriate for upstream U-Boot but are better kept and maintained
-outside the U-Boot repository. You can use CONFIG_DEVICE_TREE_INCLUDES
-to specify a list of .dtsi files that will also be included when
+outside the U-Boot repository. You can use `DEVICE_TREE_INCLUDES` Kconfig
+option to specify a list of .dtsi files that will also be included when
 building .dtb files.
 
 
+Devicetree bindings schema checks
+---------------------------------
+
+With devicetee-rebasing Git subtree, the devicetree bindings are also regularly
+synced with Linux kernel as `devicetree-rebasing/Bindings/` sub-directory. This
+allows U-Boot to run devicetree bindings schema checks which will bring
+compliance to U-Boot core/drivers regarding usage of devicetree.
+
+Dependencies
+~~~~~~~~~~~~
+

doc/develop/devicetree/control.rst As mentioned above, the U-Boot build system automatically includes a · line 237

Quoted 10 lines
doc/develop/devicetree/control.rst +10 -0
+The DT schema project must be installed in order to validate the DT schema
+binding documents and validate DTS files using the DT schema. The DT schema
+project can be installed with pip::
+
+    pip3 install dtschema
+
+Note that 'dtschema' installation requires 'swig' and Python development files
+installed first. On Debian/Ubuntu systems::
+
+    apt install swig python3-dev

These two are already in doc/build/gcc.rst so please reference that here, rather than repeating it.

doc/develop/devicetree/control.rst As mentioned above, the U-Boot build system automatically includes a · line 242

Quoted 5 lines
doc/develop/devicetree/control.rst +5 -0
+
+Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be
+installed. Ensure they are in your PATH (~/.local/bin by default).
+
+Recommended is also to install yamllint (used by dtschema when present).

How?

Quoted 36 lines
doc/develop/devicetree/control.rst +23 -3
+
+Running checks
+~~~~~~~~~~~~~~
+
+In order to perform validation of DTB files, use the ``dtbs_check`` target::
+
+    make dtbs_check
+
+It is also possible to run checks with a subset of matching schema files by
+setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or
+patterns (partial match of a fixed string). Each file or pattern should be
+separated by ':'.
+
+::
+
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
+    make dtbs_check DT_SCHEMA_FILES=/gpio/
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml
+
+
 Relocation, SPL and TPL
 -----------------------
 
@@ -261,8 +321,9 @@ used it before Linux (e.g. snow). The two projects developed in parallel
 and there are still some differences in the bindings for certain boards.
 While there has been discussion of having a separate repository for devicetree
 files, in practice the Linux kernel Git repository has become the place where
-these are stored, with U-Boot taking copies and adding tweaks with u-boot.dtsi
-files.
+these are stored, with U-Boot taking copies via devicetree-rebasing repo
+(see: dtrepo_) and adding tweaks with u-boot.dtsi files.
 
 .. _dtspec: https://www.devicetree.org/specifications/
 .. _dtlist: https://www.spinics.net/lists/devicetree-compiler/
+.. _dtrepo: https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
--
Quoted 2 lines

2.34.1

Regards,
Simon

#41 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 3 lines · Simon Glass

Hi Sumit,

On Thu, Dec 28, 2023 at 11:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 15 lines
Quoted 15 lines
doc/develop/devicetree/control.rst +9 -2
@@ -68,8 +68,21 @@ a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file.
 Where do I get a devicetree file for my board?
 ----------------------------------------------
 
-You may find that the Linux kernel has a suitable file. Look in the
-kernel source in arch/<arch>/boot/dts.
+Linux kernel Git repository has been the place where devicetree files along
+with devicetree bindings are stored and maintained. There is devicetee-rebasing
+(dtrepo_) which maintains a forked copy of devicetree files along with bindings
+at every Linux kernel major release or intermideate release candidates.
+
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::
+
Quoted 8 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 83

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash
+

This is an internal detail and I believe it will confuse people. Can you put this in a section like 'Resyncing with devicetree-rebasing' and explain when this might be needed?...almost enver, right?

I think this means the wording and sections need to be clearer, in the document. It's unlikely most users would need this (but I can see downstream cases), but I need to do this at least once a U-Boot release cycle, and I want to make sure it's documented on how to do it.

Signature · 1 line
Tom
#42 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

In reply to Sumit Garg
Quoted 55 lines · Sumit Garg

Encourage SoC/board maintainers to migrate to using devicetree-rebasing subtree and maintain a regular sync with Linux kernel devicetree files and bindings.

Along with that add documentation regarding how to run DT bindings schema checks.

---

Changes in v3:
--------------
- Replace CONFIG_* with Kconfig options

Changes in v2:
--------------
- s/U-boot/U-Boot/

 doc/develop/devicetree/control.rst | 131 +++++++++++++++++++++--------
 1 file changed, 96 insertions(+), 35 deletions(-)
doc/develop/devicetree/control.rst +7 -7
index cbb65c9b177..65180d33e8d 100644
@@ -1,5 +1,6 @@
 .. SPDX-License-Identifier: GPL-2.0+
 .. sectionauthor:: Copyright 2011 The Chromium OS Authors
+.. Copyright 2023 Linaro Ltd.
 
 Devicetree Control in U-Boot
 ============================
@@ -22,14 +23,13 @@ for three reasons:
   hierarchical format
 - It is fairly efficient to read incrementally
 
-The arch/<arch>/dts directories contains a Makefile for building the devicetree
-blob and embedding it in the U-Boot image. This is useful since it allows
-U-Boot to configure itself according to what it finds there. If you have
-a number of similar boards with different peripherals, you can describe
-the features of each board in the devicetree file, and have a single
-generic source base.
+The U-Boot Makefile infrastructure allows for building the devicetree blob
+and embedding it in the U-Boot image. This is useful since it allows U-Boot
+to configure itself according to what it finds there. If you have a number
+of similar boards with different peripherals, you can describe the features
+of each board in the devicetree file, and have a single generic source base.
 
-To enable this feature, add CONFIG_OF_CONTROL to your board config file.
+To enable this feature, select `OF_CONTROL` via Kconfig.
 
 
 What is a Flattened Devicetree?

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 74

Quoted 9 lines
doc/develop/devicetree/control.rst +4 -2
@@ -68,8 +68,21 @@ a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file.
 Where do I get a devicetree file for my board?
 ----------------------------------------------
 
-You may find that the Linux kernel has a suitable file. Look in the
-kernel source in arch/<arch>/boot/dts.
+Linux kernel Git repository has been the place where devicetree files along
+with devicetree bindings are stored and maintained. There is devicetee-rebasing
+(dtrepo_) which maintains a forked copy of devicetree files along with bindings
+at every Linux kernel major release or intermideate release candidates.

Typo.

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 78

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 82

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 3 lines
doc/develop/devicetree/control.rst +3 -0
+
+You may find that the `devicetee-rebasing/` sub-directory has a suitable
+devicetree file for your board. Look in `devicetree-rebasing/src/<arch>/`.
#43 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 78

Quoted 3 lines
doc/develop/devicetree/control.rst +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 82

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Signature · 1 line
Tom
author
#44 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 10 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 6 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 78

Quoted 3 lines
doc/develop/devicetree/control.rst +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

Sure, as Tom pointed out below that we would shift to put subtree as dts/upstream for v4. Does that make sense to you?

Quoted 4 lines
Quoted 4 lines

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Yeah we just need to modify the prefix as:

git subtree pull --prefix dts/upstream \
git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git

\
       <release-tag> --squash
Quoted 8 lines
Quoted 8 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 82

Quoted 5 lines
doc/develop/devicetree/control.rst +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Sure, I will do that for v4.

Quoted 9 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead?

I am happy for you to do that. I am happy to assist in case any conflicts occur.

Quoted 5 lines

The second thing is that if we
move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

IMO, we should give subtree a try and later if it becomes complex to manage then we can switch to a custom script as well. It is essentially a sub-directory which we start initially to manage via a subtree approach but later we can switch to a custom script to sync that subdirectory if there is a need.

-Sumit

Quoted 3 lines

--
Tom

#45 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

In reply to Tom Rini
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 78

Quoted 3 lines
doc/develop/devicetree/control.rst +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 82

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful. I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Thanks,
Michal

author
#46 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 78

Quoted 3 lines
doc/develop/devicetree/control.rst +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 82

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

    Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

-Sumit

Quoted 3 lines

Thanks,
Michal

#47 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 60 lines · Sumit Garg

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 78

Quoted 3 lines
doc/develop/devicetree/control.rst +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 82

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

Quoted 5 lines
    Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

There's two cases. The first and uncommon case is that if you want to do something like:
- Branch next
- Add this subtree, do a few subtree updates on it (like my experiment of starting with v6.1-dts and merging up to v6.6-dts)
- Wait a while, have changes happen in next
- Rebase on to current next

It gets painful and odd, but I don't know that this will ever really happen.

The second, common case is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make change in your new local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch

In this case things work as expected. Even if "next" in that case gets a new subtree merge that you need to rebase in.

A third case that I'm not sure if really will happen or is a case where the custodian should rework their tree instead (to drop the subtree merge) is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make a subtree merge+squash in your local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch.

This will then make you try and resolve some conflicts from that subtree merge. But is this a valid use case? Yes, I can see wanting to get a start on testing a dts merge before it happens, but is this a tree which needs to be rebased, or just re-created as needed, if the parent branch moves forward?

Can you explain a bit more your case Michal since it sounded to me like you had a problem that happened rather than a worry about what might happen?

Signature · 1 line
Tom
#48 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Hi Tom,

Quoted 103 lines · Tom Rini
Quoted 60 lines · Sumit Garg

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 78

Quoted 3 lines
doc/develop/devicetree/control.rst +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

doc/develop/devicetree/control.rst a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file. · line 82

Quoted 4 lines
doc/develop/devicetree/control.rst +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

Quoted 5 lines
     Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

There's two cases. The first and uncommon case is that if you want to do something like:
- Branch next
- Add this subtree, do a few subtree updates on it (like my experiment of starting with v6.1-dts and merging up to v6.6-dts)
- Wait a while, have changes happen in next
- Rebase on to current next

It gets painful and odd, but I don't know that this will ever really happen.

The second, common case is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make change in your new local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch

In this case things work as expected. Even if "next" in that case gets a new subtree merge that you need to rebase in.

A third case that I'm not sure if really will happen or is a case where the custodian should rework their tree instead (to drop the subtree merge) is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make a subtree merge+squash in your local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch.

This will then make you try and resolve some conflicts from that subtree merge. But is this a valid use case? Yes, I can see wanting to get a start on testing a dts merge before it happens, but is this a tree which needs to be rebased, or just re-created as needed, if the parent branch moves forward?

Quoted 3 lines

Can you explain a bit more your case Michal since it sounded to me like you had a problem that happened rather than a worry about what might happen?

I remember couple of bisects which I was doing and it works fine on the tree till the point you have 2 issues to deal with. It means pretty much you have config change/fix which has to be applied to see second issue.

The normal way what I have done was simply find major version apply that fix and then take the latest tree and rebase latest on the top of it. There were normally not so many conflicts to resolved (or easy to resolve/ignore). Then because the first fix is present all the time bisect is able to help me to find second issue.

If there is subtree update the whole rebase will horribly fail.

I see that Rob and you in DTC case just simply do c&p and create regular commit with all changes inside. From my perspective this is more straightforward to deal with which will handle all cases and it is also proven over that years.

Thanks,
Michal

#49 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 120 lines · Michal Simek

Hi Tom,

Quoted 103 lines · Tom Rini
Quoted 60 lines · Sumit Garg

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

Quoted 5 lines
     Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

There's two cases. The first and uncommon case is that if you want to do something like:
- Branch next
- Add this subtree, do a few subtree updates on it (like my experiment of starting with v6.1-dts and merging up to v6.6-dts)
- Wait a while, have changes happen in next
- Rebase on to current next

It gets painful and odd, but I don't know that this will ever really happen.

The second, common case is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make change in your new local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch

In this case things work as expected. Even if "next" in that case gets a new subtree merge that you need to rebase in.

A third case that I'm not sure if really will happen or is a case where the custodian should rework their tree instead (to drop the subtree merge) is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make a subtree merge+squash in your local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch.

This will then make you try and resolve some conflicts from that subtree merge. But is this a valid use case? Yes, I can see wanting to get a start on testing a dts merge before it happens, but is this a tree which needs to be rebased, or just re-created as needed, if the parent branch moves forward?

Quoted 3 lines

Can you explain a bit more your case Michal since it sounded to me like you had a problem that happened rather than a worry about what might happen?

I remember couple of bisects which I was doing and it works fine on the tree till the point you have 2 issues to deal with. It means pretty much you have config change/fix which has to be applied to see second issue.

The normal way what I have done was simply find major version apply that fix and then take the latest tree and rebase latest on the top of it. There were normally not so many conflicts to resolved (or easy to resolve/ignore). Then because the first fix is present all the time bisect is able to help me to find second issue.

Quoted 6 lines

If there is subtree update the whole rebase will horribly fail.

I see that Rob and you in DTC case just simply do c&p and create regular commit with all changes inside. From my perspective this is more straightforward to deal with which will handle all cases and it is also proven over that years.

Ah, bisecting. Maybe the (annoying) answer is to turn that merge commit in to a regular commit in the bisect branch? This is a good point, and I need to go and construct a bigger example tree and check around at what happens.

Signature · 1 line
Tom
#50 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 128 lines · Tom Rini
Quoted 120 lines · Michal Simek

Hi Tom,

Quoted 103 lines · Tom Rini
Quoted 60 lines · Sumit Garg

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

Quoted 5 lines
      Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

There's two cases. The first and uncommon case is that if you want to do something like:
- Branch next
- Add this subtree, do a few subtree updates on it (like my experiment of starting with v6.1-dts and merging up to v6.6-dts)
- Wait a while, have changes happen in next
- Rebase on to current next

It gets painful and odd, but I don't know that this will ever really happen.

The second, common case is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make change in your new local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch

In this case things work as expected. Even if "next" in that case gets a new subtree merge that you need to rebase in.

A third case that I'm not sure if really will happen or is a case where the custodian should rework their tree instead (to drop the subtree merge) is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make a subtree merge+squash in your local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch.

This will then make you try and resolve some conflicts from that subtree merge. But is this a valid use case? Yes, I can see wanting to get a start on testing a dts merge before it happens, but is this a tree which needs to be rebased, or just re-created as needed, if the parent branch moves forward?

Quoted 3 lines

Can you explain a bit more your case Michal since it sounded to me like you had a problem that happened rather than a worry about what might happen?

I remember couple of bisects which I was doing and it works fine on the tree till the point you have 2 issues to deal with. It means pretty much you have config change/fix which has to be applied to see second issue.

The normal way what I have done was simply find major version apply that fix and then take the latest tree and rebase latest on the top of it. There were normally not so many conflicts to resolved (or easy to resolve/ignore). Then because the first fix is present all the time bisect is able to help me to find second issue.

Quoted 6 lines

If there is subtree update the whole rebase will horribly fail.

I see that Rob and you in DTC case just simply do c&p and create regular commit with all changes inside. From my perspective this is more straightforward to deal with which will handle all cases and it is also proven over that years.

Quoted 4 lines

Ah, bisecting. Maybe the (annoying) answer is to turn that merge commit in to a regular commit in the bisect branch? This is a good point, and I need to go and construct a bigger example tree and check around at what happens.

Sure you can do whatever you like. But I expect that at the end if this started to be used you will have subtree for devicetree, dtc, lwip and maybe something else. It means you have to start to keep track where that subtree are and what version is used at what time. Because dt binding is extending often likely you will need to merge it every Linux release. It means you would have to do it multiple times depends on how many releases you are going over.

I know that Qemu is using gitmodules that's definitely another option but not sure if better or worse.

I can also imagine that companies with SR IR certified firmware would keep downstream version where they want to just take code fixes, DT fixes and devicetree-rebasing tree to make sure that they are still aligned with DT schema. Can you simply just cherry pick that merged commit without any side effect?

Back to my point. At the end what we need to is to document it properly how to deal with it.

Thanks,
Michal

#51 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 136 lines · Michal Simek
Quoted 128 lines · Tom Rini
Quoted 120 lines · Michal Simek

Hi Tom,

Quoted 103 lines · Tom Rini
Quoted 60 lines · Sumit Garg

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

Quoted 5 lines
      Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

There's two cases. The first and uncommon case is that if you want to do something like:
- Branch next
- Add this subtree, do a few subtree updates on it (like my experiment of starting with v6.1-dts and merging up to v6.6-dts)
- Wait a while, have changes happen in next
- Rebase on to current next

It gets painful and odd, but I don't know that this will ever really happen.

The second, common case is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make change in your new local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch

In this case things work as expected. Even if "next" in that case gets a new subtree merge that you need to rebase in.

A third case that I'm not sure if really will happen or is a case where the custodian should rework their tree instead (to drop the subtree merge) is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make a subtree merge+squash in your local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch.

This will then make you try and resolve some conflicts from that subtree merge. But is this a valid use case? Yes, I can see wanting to get a start on testing a dts merge before it happens, but is this a tree which needs to be rebased, or just re-created as needed, if the parent branch moves forward?

Quoted 3 lines

Can you explain a bit more your case Michal since it sounded to me like you had a problem that happened rather than a worry about what might happen?

I remember couple of bisects which I was doing and it works fine on the tree till the point you have 2 issues to deal with. It means pretty much you have config change/fix which has to be applied to see second issue.

The normal way what I have done was simply find major version apply that fix and then take the latest tree and rebase latest on the top of it. There were normally not so many conflicts to resolved (or easy to resolve/ignore). Then because the first fix is present all the time bisect is able to help me to find second issue.

Quoted 6 lines

If there is subtree update the whole rebase will horribly fail.

I see that Rob and you in DTC case just simply do c&p and create regular commit with all changes inside. From my perspective this is more straightforward to deal with which will handle all cases and it is also proven over that years.

Quoted 4 lines

Ah, bisecting. Maybe the (annoying) answer is to turn that merge commit in to a regular commit in the bisect branch? This is a good point, and I need to go and construct a bigger example tree and check around at what happens.

Quoted 4 lines

Sure you can do whatever you like. But I expect that at the end if this started to be used you will have subtree for devicetree, dtc, lwip and maybe something else. It means you have to start to keep track where that subtree are and what version is used at what time.

Yes, lwip would be a subtree too, dtc is trickier but I see and agree with your point.

Quoted 3 lines

Because dt binding is extending often likely you will need to merge it every Linux release. It means you would have to do it multiple times depends on how many releases you are going over.

Yes, the plan is to re-sync every time our next opens with the kernel release at the time (which maybe needs to be clearer in the docs).

Quoted 2 lines

I know that Qemu is using gitmodules that's definitely another option but not sure if better or worse.

Yeah, submodules is harder and we're not going that path.

Quoted 5 lines

I can also imagine that companies with SR IR certified firmware would keep downstream version where they want to just take code fixes, DT fixes and devicetree-rebasing tree to make sure that they are still aligned with DT schema. Can you simply just cherry pick that merged commit without any side effect?

Life downstream is always fun. Personally, I would re-run the "git subtree" command rather than cherry-pick from U-Boot itself in that case, but it should be no different than any other commit.

Quoted 3 lines

Back to my point. At the end what we need to is to document it properly how to deal with it.

So, here's the test I did. I went back to v2023.10, then added v6.1-dts as a subtree. I rebased v2024.01-rc1 on top of that, added a fake bad commit, synced up subtrees to v6.6, and then rebased the tags along the way to v2024.01-rc6. I then went for a bisect back to the fake bad commit. Everything went fine, git didn't have troubles rebasing things as it went.

But to re-iterate, yes, the policy around when dts and bindings will be resynced needs to be clear and documented. Does that cover it?

Signature · 1 line
Tom
#52 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 178 lines · Tom Rini
Quoted 136 lines · Michal Simek
Quoted 128 lines · Tom Rini
Quoted 120 lines · Michal Simek

Hi Tom,

Quoted 103 lines · Tom Rini
Quoted 60 lines · Sumit Garg

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

Quoted 5 lines
       Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

There's two cases. The first and uncommon case is that if you want to do something like:
- Branch next
- Add this subtree, do a few subtree updates on it (like my experiment of starting with v6.1-dts and merging up to v6.6-dts)
- Wait a while, have changes happen in next
- Rebase on to current next

It gets painful and odd, but I don't know that this will ever really happen.

The second, common case is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make change in your new local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch

In this case things work as expected. Even if "next" in that case gets a new subtree merge that you need to rebase in.

A third case that I'm not sure if really will happen or is a case where the custodian should rework their tree instead (to drop the subtree merge) is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make a subtree merge+squash in your local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch.

This will then make you try and resolve some conflicts from that subtree merge. But is this a valid use case? Yes, I can see wanting to get a start on testing a dts merge before it happens, but is this a tree which needs to be rebased, or just re-created as needed, if the parent branch moves forward?

Quoted 3 lines

Can you explain a bit more your case Michal since it sounded to me like you had a problem that happened rather than a worry about what might happen?

I remember couple of bisects which I was doing and it works fine on the tree till the point you have 2 issues to deal with. It means pretty much you have config change/fix which has to be applied to see second issue.

The normal way what I have done was simply find major version apply that fix and then take the latest tree and rebase latest on the top of it. There were normally not so many conflicts to resolved (or easy to resolve/ignore). Then because the first fix is present all the time bisect is able to help me to find second issue.

Quoted 6 lines

If there is subtree update the whole rebase will horribly fail.

I see that Rob and you in DTC case just simply do c&p and create regular commit with all changes inside. From my perspective this is more straightforward to deal with which will handle all cases and it is also proven over that years.

Quoted 4 lines

Ah, bisecting. Maybe the (annoying) answer is to turn that merge commit in to a regular commit in the bisect branch? This is a good point, and I need to go and construct a bigger example tree and check around at what happens.

Quoted 4 lines

Sure you can do whatever you like. But I expect that at the end if this started to be used you will have subtree for devicetree, dtc, lwip and maybe something else. It means you have to start to keep track where that subtree are and what version is used at what time.

Yes, lwip would be a subtree too, dtc is trickier but I see and agree with your point.

Quoted 3 lines

Because dt binding is extending often likely you will need to merge it every Linux release. It means you would have to do it multiple times depends on how many releases you are going over.

Yes, the plan is to re-sync every time our next opens with the kernel release at the time (which maybe needs to be clearer in the docs).

Quoted 2 lines

I know that Qemu is using gitmodules that's definitely another option but not sure if better or worse.

Yeah, submodules is harder and we're not going that path.

Quoted 5 lines

I can also imagine that companies with SR IR certified firmware would keep downstream version where they want to just take code fixes, DT fixes and devicetree-rebasing tree to make sure that they are still aligned with DT schema. Can you simply just cherry pick that merged commit without any side effect?

Life downstream is always fun. Personally, I would re-run the "git subtree" command rather than cherry-pick from U-Boot itself in that case, but it should be no different than any other commit.

Quoted 3 lines

Back to my point. At the end what we need to is to document it properly how to deal with it.

So, here's the test I did. I went back to v2023.10, then added v6.1-dts as a subtree. I rebased v2024.01-rc1 on top of that, added a fake bad commit, synced up subtrees to v6.6, and then rebased the tags along the way to v2024.01-rc6. I then went for a bisect back to the fake bad commit. Everything went fine, git didn't have troubles rebasing things as it went.

Quoted 2 lines

But to re-iterate, yes, the policy around when dts and bindings will be resynced needs to be clear and documented. Does that cover it?

I am fine with it when we have documentation around.

Thanks,
Michal

author
#53 lore raw

Re: [PATCH v3 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Quoted 149 lines · Michal Simek
Quoted 145 lines · Tom Rini
Quoted 136 lines · Michal Simek
Quoted 128 lines · Tom Rini
Quoted 120 lines · Michal Simek

Hi Tom,

Quoted 103 lines · Tom Rini
Quoted 60 lines · Sumit Garg

Hi Michal,

Quoted 39 lines · Michal Simek
Quoted 22 lines · Tom Rini
Quoted 1 line · Rob Herring

On Thu, Dec 28, 2023 at 4:59 AM Sumit Garg <[email protected]> wrote:

[snip]

Quoted 11 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+In order to maintain devicetree files sync, U-Boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::

I would suggest dropping "-rebasing" in the u-boot tree. (I wish we had in the original repo). I don't think it's relevant.

We're not likely to regenerate the tree, but any clue what 'git subtree pull' would do in this case? It could happen if we switched to git-filter-repo.

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash

I'd put this in a script to run. Documentation tends to be not quite correct. A script could also be smarter and figure out <release-tag>.

Quoted 12 lines

Since you had mentioned elsewhere moving the kernel scripts/dtc/ to something using subtree, I do hope to learn some lessons from what you do there. The first thing is that given the size/nature of the commits, I had figured I'd be the one doing this as a subtree pull+squash then push, rather than posting to the ML since it'll be huge and un-reviewable, but with a note sent off to the ML that people should be aware the next sync has been done and retest as needed. But Sumit, were you planning to do some of this instead? The second thing is that if we move the subtree part in to dts/ instead (where we will still have the Makefile/Kconfig we have today and then our Makefiles within the directories, this might get more complex and so really require a script to keep it from getting error prone?

Quoted 6 lines

I played with this series and didn't really have time to dig into subtree mechanics but one thing I see is that when squash and merge happens you can't do simple rebase anymore which is time to time very useful.
I see some different rebase strategies and --rebase-merges option but if this is adopted it should be properly described how to rebase u-boot tree which contains some subtrees.

Did you observe any specific difference with respect to subtree merge commits (Tom will likely do those in the beginning of next release cycle) when compared with normal merge commits when Tom pulls in code from different custodians like one example below? The same rebasing rules should apply to both types of merge commits.

commit dffa6d0210f57793f1e4e1e209d91ca5642e4d05 (origin/next)
Merge: 2b28c3b871c e266d273114
Author: Tom Rini <[email protected]>
Date: Mon Jan 1 12:38:15 2024 -0500

Quoted 5 lines
       Merge tag 'dm-next-1124' of

https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema align bloblist with v0.9 of Firmware Handoff spec

There's two cases. The first and uncommon case is that if you want to do something like:
- Branch next
- Add this subtree, do a few subtree updates on it (like my experiment of starting with v6.1-dts and merging up to v6.6-dts)
- Wait a while, have changes happen in next
- Rebase on to current next

It gets painful and odd, but I don't know that this will ever really happen.

The second, common case is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make change in your new local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch

In this case things work as expected. Even if "next" in that case gets a new subtree merge that you need to rebase in.

A third case that I'm not sure if really will happen or is a case where the custodian should rework their tree instead (to drop the subtree merge) is:
- Assume "next" already has this subtree + some merge commits in it.
- Make a new local branch.
- Make a subtree merge+squash in your local branch.
- This hypothetical "next" branch moves forward with changes
- Rebase your local branch on to this "next" branch.

This will then make you try and resolve some conflicts from that subtree merge. But is this a valid use case? Yes, I can see wanting to get a start on testing a dts merge before it happens, but is this a tree which needs to be rebased, or just re-created as needed, if the parent branch moves forward?

Quoted 3 lines

Can you explain a bit more your case Michal since it sounded to me like you had a problem that happened rather than a worry about what might happen?

I remember couple of bisects which I was doing and it works fine on the tree till the point you have 2 issues to deal with. It means pretty much you have config change/fix which has to be applied to see second issue.

The normal way what I have done was simply find major version apply that fix and then take the latest tree and rebase latest on the top of it. There were normally not so many conflicts to resolved (or easy to resolve/ignore). Then because the first fix is present all the time bisect is able to help me to find second issue.

Quoted 6 lines

If there is subtree update the whole rebase will horribly fail.

I see that Rob and you in DTC case just simply do c&p and create regular commit with all changes inside. From my perspective this is more straightforward to deal with which will handle all cases and it is also proven over that years.

Quoted 4 lines

Ah, bisecting. Maybe the (annoying) answer is to turn that merge commit in to a regular commit in the bisect branch? This is a good point, and I need to go and construct a bigger example tree and check around at what happens.

Quoted 4 lines

Sure you can do whatever you like. But I expect that at the end if this started to be used you will have subtree for devicetree, dtc, lwip and maybe something else. It means you have to start to keep track where that subtree are and what version is used at what time.

Yes, lwip would be a subtree too, dtc is trickier but I see and agree with your point.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Because dt binding is extending often likely you will need to merge it every Linux release. It means you would have to do it multiple times depends on how many releases you are going over.

Yes, the plan is to re-sync every time our next opens with the kernel release at the time (which maybe needs to be clearer in the docs).

I will clarify this further in the docs.

-Sumit

Quoted 34 lines
Quoted 27 lines
Quoted 3 lines

I know that Qemu is using gitmodules that's definitely another option but not sure if better or worse.

Yeah, submodules is harder and we're not going that path.

Quoted 5 lines

I can also imagine that companies with SR IR certified firmware would keep downstream version where they want to just take code fixes, DT fixes and devicetree-rebasing tree to make sure that they are still aligned with DT schema. Can you simply just cherry pick that merged commit without any side effect?

Life downstream is always fun. Personally, I would re-run the "git subtree" command rather than cherry-pick from U-Boot itself in that case, but it should be no different than any other commit.

Quoted 3 lines

Back to my point. At the end what we need to is to document it properly how to deal with it.

So, here's the test I did. I went back to v2023.10, then added v6.1-dts as a subtree. I rebased v2024.01-rc1 on top of that, added a fake bad commit, synced up subtrees to v6.6, and then rebased the tags along the way to v2024.01-rc6. I then went for a bisect back to the fake bad commit. Everything went fine, git didn't have troubles rebasing things as it went.

Quoted 2 lines

But to re-iterate, yes, the policy around when dts and bindings will be resynced needs to be clear and documented. Does that cover it?

I am fine with it when we have documentation around.

Thanks,
Michal

author
#54 lore raw

PATCH v3 6/8 MAINTAINERS: Add myself as devicetree-rebasing maintainer

In reply to Sumit Garg

---

Changes in v3:
--------------
- Picked up review tag

Changes in v2:
--------------
- Picked up review tag

 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 969514468cb..253092c345c 100644
@@ -951,6 +951,12 @@ F:	cmd/cyclic.c
 F:	common/cyclic.c
 F:	include/cyclic.h
 
+DEVICETREE REBASING SUBTREE
+M:	Sumit Garg <[email protected]>
+S:	Maintained
+F:	devicetree-rebasing/
+F:	dts/arch/
+
 DFU
 M:	Lukasz Majewski <[email protected]>
 M:	Mattijs Korpershoek <[email protected]>
Signature · 1 line
2.34.1
#55 lore raw

Re: [PATCH v3 6/8] MAINTAINERS: Add myself as devicetree-rebasing maintainer

Hi Sumit,

Quoted 1 line · Sumit Garg

Please can you add a commit message?

Quoted 8 lines

---

Changes in v3:
--------------
- Picked up review tag

BTW 'patman status' does this for you.

Quoted 26 lines

Changes in v2:
--------------
- Picked up review tag

 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -1
index 969514468cb..253092c345c 100644
@@ -951,6 +951,12 @@ F: cmd/cyclic.c
 F:     common/cyclic.c
 F:     include/cyclic.h
 
+DEVICETREE REBASING SUBTREE
+M:     Sumit Garg <[email protected]>
+S:     Maintained
+F:     devicetree-rebasing/
+F:     dts/arch/
+
 DFU
 M:     Lukasz Majewski <[email protected]>
 M:     Mattijs Korpershoek <[email protected]>
--
Quoted 2 lines

2.34.1

Regards,
Simon

author
#56 lore raw

PATCH v3 7/8 dts: meson-gxbb: Switch to using upstream DT

In reply to Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
 	bool "GXBB"
 	select MESON_GX
+	imply OF_UPSTREAM
 	help
 	  Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +1 -1
index 41dbf7981f8..2e1c756bf7a 100644
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/odroid-c2_defconfig +1 -1
index 5f9f323e06e..ce5eaec3cd2 100644
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p200_defconfig +1 -1
index cd579ef5f14..b6946034795 100644
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p200"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p200"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p201_defconfig +1 -1
index b2f0a0ccdb4..dcc1454be16 100644
@@ -7,7 +7,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p201"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p201"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/videostrong-kii-pro_defconfig +1 -1
index 3eda8f14a21..7a5af234471 100644
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-kii-pro"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-kii-pro"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-hub_defconfig +1 -1
index fd92b041e73..85cff73f50f 100644
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-hub"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-hub"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-play2_defconfig +1 -1
index b887419a6ba..efdf820165b 100644
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-play2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-play2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
dts/arch/arm64/amlogic new file +1 -0
new file mode 120000
index 00000000000..73f7c3e7bd0
@@ -0,0 +1 @@
+../../../devicetree-rebasing/src/arm64/amlogic/
\ No newline at end of file
Signature · 1 line
2.34.1
Reviewed-by on v3 7/8
#57 lore raw

Re: [PATCH v3 7/8] dts: meson-gxbb: Switch to using upstream DT

Hi Sumit,

Quoted 22 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

Quoted 12 lines
 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
Quoted 17 lines
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
        bool "GXBB"
        select MESON_GX
+       imply OF_UPSTREAM
        help
          Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +0 -0
index 41dbf7981f8..2e1c756bf7a 100644

configs/nanopi-k2_defconfig CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y · line 12

Quoted 8 lines
configs/nanopi-k2_defconfig +1 -1
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0

So now I am wondering if we can (later) have the SoC be implied when using OF_UPSTREAM so we can do:

CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"

and it will add the 'amlogic/' automatically?

Perhaps that might be a way to bridge the gap in terms of file layout?

[..]

Regards,
Simon

#58 lore raw

Re: [PATCH v3 7/8] dts: meson-gxbb: Switch to using upstream DT

Quoted 69 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

Quoted 12 lines
 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
Quoted 17 lines
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
        bool "GXBB"
        select MESON_GX
+       imply OF_UPSTREAM
        help
          Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +0 -0
index 41dbf7981f8..2e1c756bf7a 100644

configs/nanopi-k2_defconfig CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y · line 12

Quoted 8 lines
configs/nanopi-k2_defconfig +1 -1
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0

So now I am wondering if we can (later) have the SoC be implied when using OF_UPSTREAM so we can do:

Quoted 5 lines

CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"

and it will add the 'amlogic/' automatically?

Perhaps that might be a way to bridge the gap in terms of file layout?

That's going to start to look real ugly real quick I suspect and I'm not sure what it really gets us? It seems to me that the convention of "vendor/board" has already been well enough adapted outside of the kernel, with the odd sticking point being getting everyone used to whatever will be happening for 32bit boards long term. So I think hiding the vendor part of the string here will be more, not less, confusing long term.

Signature · 1 line
Tom
#59 lore raw

Re: [PATCH v3 7/8] dts: meson-gxbb: Switch to using upstream DT

Hi Tom,

Quoted 77 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

Quoted 12 lines
 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
Quoted 17 lines
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
        bool "GXBB"
        select MESON_GX
+       imply OF_UPSTREAM
        help
          Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +0 -0
index 41dbf7981f8..2e1c756bf7a 100644

configs/nanopi-k2_defconfig CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y · line 12

Quoted 8 lines
configs/nanopi-k2_defconfig +1 -1
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0

So now I am wondering if we can (later) have the SoC be implied when using OF_UPSTREAM so we can do:

Quoted 5 lines

CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"

and it will add the 'amlogic/' automatically?

Perhaps that might be a way to bridge the gap in terms of file layout?

Quoted 7 lines

That's going to start to look real ugly real quick I suspect and I'm not sure what it really gets us? It seems to me that the convention of "vendor/board" has already been well enough adapted outside of the kernel, with the odd sticking point being getting everyone used to whatever will be happening for 32bit boards long term. So I think hiding the vendor part of the string here will be more, not less, confusing long term.

Now that I dig in a bit, I see that the devicetree-rebasing tree does not have any Makefiles in it. How does Linux build with it? Does anyone have instructions?

Regards,
Simon

#60 lore raw

Re: [PATCH v3 7/8] dts: meson-gxbb: Switch to using upstream DT

Quoted 88 lines · Simon Glass

Hi Tom,

Quoted 77 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

Quoted 12 lines
 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
Quoted 17 lines
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
        bool "GXBB"
        select MESON_GX
+       imply OF_UPSTREAM
        help
          Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +0 -0
index 41dbf7981f8..2e1c756bf7a 100644

configs/nanopi-k2_defconfig CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y · line 12

Quoted 8 lines
configs/nanopi-k2_defconfig +1 -1
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0

So now I am wondering if we can (later) have the SoC be implied when using OF_UPSTREAM so we can do:

Quoted 5 lines

CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"

and it will add the 'amlogic/' automatically?

Perhaps that might be a way to bridge the gap in terms of file layout?

Quoted 7 lines

That's going to start to look real ugly real quick I suspect and I'm not sure what it really gets us? It seems to me that the convention of "vendor/board" has already been well enough adapted outside of the kernel, with the odd sticking point being getting everyone used to whatever will be happening for 32bit boards long term. So I think hiding the vendor part of the string here will be more, not less, confusing long term.

Quoted 3 lines

Now that I dig in a bit, I see that the devicetree-rebasing tree does not have any Makefiles in it. How does Linux build with it? Does anyone have instructions?

Linux doesn't build with it, it's the relevant parts of the kernel tree extracted for other projects to more easily use (more or less).

Signature · 1 line
Tom
#61 lore raw

Re: [PATCH v3 7/8] dts: meson-gxbb: Switch to using upstream DT

Hi Tom,

Quoted 90 lines · Tom Rini
Quoted 88 lines · Simon Glass

Hi Tom,

Quoted 84 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

Quoted 12 lines
 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
Quoted 17 lines
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
        bool "GXBB"
        select MESON_GX
+       imply OF_UPSTREAM
        help
          Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +0 -0
index 41dbf7981f8..2e1c756bf7a 100644

configs/nanopi-k2_defconfig CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y · line 12

Quoted 8 lines
configs/nanopi-k2_defconfig +1 -1
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0

So now I am wondering if we can (later) have the SoC be implied when using OF_UPSTREAM so we can do:

Quoted 5 lines

CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"

and it will add the 'amlogic/' automatically?

Perhaps that might be a way to bridge the gap in terms of file layout?

That's going to start to look real ugly real quick I suspect and I'm not sure what it really gets us? It seems to me that the convention of "vendor/board" has already been well enough adapted outside of the kernel, with the odd sticking point being getting everyone used to whatever will be happening for 32bit boards long term. So I think hiding the vendor part of the string here will be more, not less, confusing long term.

Quoted 6 lines
Quoted 3 lines

Now that I dig in a bit, I see that the devicetree-rebasing tree does not have any Makefiles in it. How does Linux build with it? Does anyone have instructions?

Linux doesn't build with it, it's the relevant parts of the kernel tree extracted for other projects to more easily use (more or less).

Hmmm, in that case can we add Makefiles into the U-Boot version of the tree, for U-Boot use?

Regards,
Simon

#62 lore raw

Re: [PATCH v3 7/8] dts: meson-gxbb: Switch to using upstream DT

Quoted 97 lines · Simon Glass

Hi Tom,

Quoted 94 lines · Tom Rini
Quoted 91 lines · Simon Glass

Hi Tom,

Quoted 77 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

Quoted 12 lines
 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
Quoted 17 lines
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
        bool "GXBB"
        select MESON_GX
+       imply OF_UPSTREAM
        help
          Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +0 -0
index 41dbf7981f8..2e1c756bf7a 100644

configs/nanopi-k2_defconfig CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y · line 12

Quoted 8 lines
configs/nanopi-k2_defconfig +1 -1
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0

So now I am wondering if we can (later) have the SoC be implied when using OF_UPSTREAM so we can do:

Quoted 5 lines

CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"

and it will add the 'amlogic/' automatically?

Perhaps that might be a way to bridge the gap in terms of file layout?

Quoted 7 lines

That's going to start to look real ugly real quick I suspect and I'm not sure what it really gets us? It seems to me that the convention of "vendor/board" has already been well enough adapted outside of the kernel, with the odd sticking point being getting everyone used to whatever will be happening for 32bit boards long term. So I think hiding the vendor part of the string here will be more, not less, confusing long term.

Now that I dig in a bit, I see that the devicetree-rebasing tree does not have any Makefiles in it. How does Linux build with it? Does anyone have instructions?

Quoted 5 lines
Quoted 2 lines

Linux doesn't build with it, it's the relevant parts of the kernel tree extracted for other projects to more easily use (more or less).

Hmmm, in that case can we add Makefiles into the U-Boot version of the tree, for U-Boot use?

No? Why would we do that? I think you're missing how the amlogic conversion works.

Signature · 1 line
Tom
#63 lore raw

Re: [PATCH v3 7/8] dts: meson-gxbb: Switch to using upstream DT

Hi Tom,

Quoted 99 lines · Tom Rini
Quoted 97 lines · Simon Glass

Hi Tom,

Quoted 94 lines · Tom Rini
Quoted 91 lines · Simon Glass

Hi Tom,

Quoted 77 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---

Changes in v3:
--------------
- Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.

Changes in v2:
--------------
- Picked up review tag

Quoted 12 lines
 arch/arm/mach-meson/Kconfig           | 1 +
 configs/nanopi-k2_defconfig           | 2 +-
 configs/odroid-c2_defconfig           | 2 +-
 configs/p200_defconfig                | 2 +-
 configs/p201_defconfig                | 2 +-
 configs/videostrong-kii-pro_defconfig | 2 +-
 configs/wetek-hub_defconfig           | 2 +-
 configs/wetek-play2_defconfig         | 2 +-
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 9 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
Quoted 17 lines
arch/arm/mach-meson/Kconfig +1 -0
index d6c89058061..8ddb59161a0 100644
@@ -25,6 +25,7 @@ choice
 config MESON_GXBB
        bool "GXBB"
        select MESON_GX
+       imply OF_UPSTREAM
        help
          Select this if your SoC is an S905
 
configs/nanopi-k2_defconfig +0 -0
index 41dbf7981f8..2e1c756bf7a 100644

configs/nanopi-k2_defconfig CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y · line 12

Quoted 8 lines
configs/nanopi-k2_defconfig +1 -1
@@ -6,7 +6,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0

So now I am wondering if we can (later) have the SoC be implied when using OF_UPSTREAM so we can do:

Quoted 5 lines

CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"

and it will add the 'amlogic/' automatically?

Perhaps that might be a way to bridge the gap in terms of file layout?

Quoted 7 lines

That's going to start to look real ugly real quick I suspect and I'm not sure what it really gets us? It seems to me that the convention of "vendor/board" has already been well enough adapted outside of the kernel, with the odd sticking point being getting everyone used to whatever will be happening for 32bit boards long term. So I think hiding the vendor part of the string here will be more, not less, confusing long term.

Now that I dig in a bit, I see that the devicetree-rebasing tree does not have any Makefiles in it. How does Linux build with it? Does anyone have instructions?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Linux doesn't build with it, it's the relevant parts of the kernel tree extracted for other projects to more easily use (more or less).

Hmmm, in that case can we add Makefiles into the U-Boot version of the tree, for U-Boot use?

No? Why would we do that? I think you're missing how the amlogic conversion works.

I will reply on the other thread about this.

Regards,
Simon

author
#64 lore raw

PATCH v3 8/8 dts: meson-gxbb: Drop redundant devicetree files

In reply to Sumit Garg

Since meson-gxbb based boards switched to using upstream DT, so drop redundant files from arch/arm/dts directory. Only *-u-boot.dtsi files kept in arch/arm/dts directory for these boards.

---

Changes in v3:
--------------
- Picked up review tag

Changes in v2:
--------------
- None

 arch/arm/dts/Makefile                   |   8 -
 arch/arm/dts/meson-gxbb-kii-pro.dts     | 140 ----
 arch/arm/dts/meson-gxbb-nanopi-k2.dts   | 415 ------------
 arch/arm/dts/meson-gxbb-odroidc2.dts    | 418 ------------
 arch/arm/dts/meson-gxbb-p200.dts        | 100 ---
 arch/arm/dts/meson-gxbb-p201.dts        |  26 -
 arch/arm/dts/meson-gxbb-p20x.dtsi       | 250 -------
 arch/arm/dts/meson-gxbb-wetek-hub.dts   |  58 --
 arch/arm/dts/meson-gxbb-wetek-play2.dts | 119 ----
 arch/arm/dts/meson-gxbb-wetek.dtsi      | 292 --------
 arch/arm/dts/meson-gxbb.dtsi            | 856 ------------------------
 11 files changed, 2682 deletions(-)
 delete mode 100644 arch/arm/dts/meson-gxbb-kii-pro.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-nanopi-k2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p200.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p201.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p20x.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb.dtsi
arch/arm/dts/Makefile +0 -8
index 5fc888680b3..45bd1166029 100644
@@ -212,14 +212,6 @@ dtb-$(CONFIG_ARCH_MESON) += \
 	meson-a1-ad401.dtb \
 	meson-axg-s400.dtb \
 	meson-axg-jethome-jethub-j100.dtb \
-	meson-gxbb-kii-pro.dtb \
-	meson-gxbb-nanopi-k2.dtb \
-	meson-gxbb-odroidc2.dtb \
-	meson-gxbb-nanopi-k2.dtb \
-	meson-gxbb-p200.dtb \
-	meson-gxbb-p201.dtb \
-	meson-gxbb-wetek-hub.dtb \
-	meson-gxbb-wetek-play2.dtb \
 	meson-gxl-s805x-libretech-ac.dtb \
 	meson-gxl-s905d-libretech-pc.dtb \
 	meson-gxl-s905w-jethome-jethub-j80.dtb \
arch/arm/dts/meson-gxbb-kii-pro.dts deleted +0 -140

140 lines not on this page · raw message

arch/arm/dts/meson-gxbb-nanopi-k2.dts deleted +0 -415

415 lines not on this page · raw message

arch/arm/dts/meson-gxbb-odroidc2.dts deleted +0 -418

418 lines not on this page · raw message

arch/arm/dts/meson-gxbb-p200.dts deleted +0 -100

100 lines not on this page · raw message

arch/arm/dts/meson-gxbb-p201.dts deleted +0 -26
deleted file mode 100644
index 150a82f3b2d..00000000000
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-/*
- * Copyright (c) 2016 Andreas Färber
- * Copyright (c) 2016 BayLibre, Inc.
- * Author: Kevin Hilman <[email protected]>
- */
-
-/dts-v1/;
-
-#include "meson-gxbb-p20x.dtsi"
-
-/ {
-	compatible = "amlogic,p201", "amlogic,meson-gxbb";
-	model = "Amlogic Meson GXBB P201 Development Board";
-};
-
-&ethmac {
-	status = "okay";
-	pinctrl-0 = <&eth_rmii_pins>;
-	pinctrl-names = "default";
-	phy-mode = "rmii";
-
-	snps,reset-gpio = <&gpio GPIOZ_14 0>;
-	snps,reset-delays-us = <0>, <10000>, <1000000>;
-	snps,reset-active-low;
-};
arch/arm/dts/meson-gxbb-p20x.dtsi deleted +0 -250

250 lines not on this page · raw message

arch/arm/dts/meson-gxbb-wetek-hub.dts deleted +0 -58

58 lines not on this page · raw message

arch/arm/dts/meson-gxbb-wetek-play2.dts deleted +0 -119

119 lines not on this page · raw message

arch/arm/dts/meson-gxbb-wetek.dtsi deleted +0 -292

292 lines not on this page · raw message

arch/arm/dts/meson-gxbb.dtsi deleted +0 -856

856 lines not on this page · raw message

Signature · 1 line
2.34.1
#65 lore raw
In reply to Sumit Garg
Quoted 107 lines · Sumit Garg

Changes in v3:
--------------
- Patch #4: Minor commit message update
- Patch #5: Replace CONFIG_* with Kconfig options
- Patch #7: Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.
- Patch #1, #3, #6 and #8: Picked up review tags

Changes in v2:
--------------
- Patch #1: excluded gitab CI config check and added commit description.
- Patch #3: s/UBOOT_DTSI_LOC/u_boot_dtsi_loc/
- Patch #4: s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/
- Patch #5: s/U-boot/U-Boot/
- Patch #6 and #7: Picked up review tags

Prerequisite
------------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-Boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-Boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-Boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-Boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows:

$ git subtree pull --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-Boot maintainers here [4]. Now we would like to reach out to wider U-Boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-Boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-Boot to run devicetree bindings schema checks which will bring compliance to U-Boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Quoted 8 lines

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

I have been following your guidance here and I have also seen it to work but not sure why. Anyway I have strong suspicious that any Makefile rule is not right.

I am getting this issue.

/bin/sh: line 1: @: command not found
make[1]: *** [devicetree-rebasing/Bindings/Makefile:68: devicetree-rebasing/Bindings/processed-schema.json] Error 127
make: *** [Makefile:1181: dt_binding_check] Error 2

devicetree-rebasing/Bindings/processed-schema.json is not generated properly

I am using the latest dt schema

$ dt-validate -V
2023.12.dev6+gfb80ec43c204

and no issue to run it from Linux source code that's why I expect it is not issue with my PC in general. Do you know what can be wrong?

Thanks,
Michal

author
#66 lore raw

Hi Michal,

Quoted 116 lines · Michal Simek
Quoted 112 lines · Sumit Garg

Changes in v3:
--------------
- Patch #4: Minor commit message update
- Patch #5: Replace CONFIG_* with Kconfig options
- Patch #7: Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.
- Patch #1, #3, #6 and #8: Picked up review tags

Changes in v2:
--------------
- Patch #1: excluded gitab CI config check and added commit description.
- Patch #3: s/UBOOT_DTSI_LOC/u_boot_dtsi_loc/
- Patch #4: s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/
- Patch #5: s/U-boot/U-Boot/
- Patch #6 and #7: Picked up review tags

Prerequisite
------------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-Boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-Boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-Boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-Boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows:

$ git subtree pull --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-Boot maintainers here [4]. Now we would like to reach out to wider U-Boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-Boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-Boot to run devicetree bindings schema checks which will bring compliance to U-Boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

Quoted 7 lines
Quoted 3 lines

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

I have been following your guidance here and I have also seen it to work but not sure why. Anyway I have strong suspicious that any Makefile rule is not right.

Thanks for taking time to test DT schema checks. It looks like your suspicion is correct.

Quoted 7 lines

I am getting this issue.

/bin/sh: line 1: @: command not found
make[1]: *** [devicetree-rebasing/Bindings/Makefile:68:
devicetree-rebasing/Bindings/processed-schema.json] Error 127
make: *** [Makefile:1181: dt_binding_check] Error 2

I was able to reproduce this issue once I installed yamllint on my Ubuntu machine.

Quoted 10 lines

devicetree-rebasing/Bindings/processed-schema.json is not generated properly

I am using the latest dt schema

$ dt-validate -V
2023.12.dev6+gfb80ec43c204

and no issue to run it from Linux source code that's why I expect it is not issue with my PC in general.
Do you know what can be wrong?

The issue here is basically due to old U-Boot Kbuild infrastructure which isn't in sync with Linux kernel. This Kbuild commit [1] changes aren't present in U-Boot leading to this issue.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3a2429e1faf40b2aaa481aa4b001a74d222c7e8b

Following change to adapt bindings Makefile to old U-Boot Kbuild expectation should resolve this issue:

(quoted diff) +0 -0

b/devicetree-rebasing/Bindings/Makefile
index 8b395893bd8..7d08372691c 100644

devicetree-rebasing/Bindings/Makefile +3 -3
@@ -47,9 +47,9 @@ quiet_cmd_mk_schema = SCHEMA  $@
                      rm -f $$f
 
 define rule_chkdt
-       $(if $(DT_SCHEMA_LINT),$(call cmd,yamllint),)
-       $(call cmd,chk_bindings)
-       $(call cmd,mk_schema)
+       $(if $(DT_SCHEMA_LINT),$(call echo-cmd,yamllint) $(cmd_yamllint),); \
+       $(call echo-cmd,chk_bindings) $(cmd_chk_bindings); \
+       $(call echo-cmd,mk_schema) $(cmd_mk_schema)
 endef
 
 DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_all_cmd)))

If this works for you then I will include it as a separate patch for v4.

-Sumit

Quoted 4 lines

Thanks,
Michal

#67 lore raw

Hi,

Quoted 180 lines · Sumit Garg

Hi Michal,

Quoted 116 lines · Michal Simek
Quoted 112 lines · Sumit Garg

Changes in v3:
--------------
- Patch #4: Minor commit message update
- Patch #5: Replace CONFIG_* with Kconfig options
- Patch #7: Dropped Makefile portion and enabled OF_UPSTREAM for SoC instead.
- Patch #1, #3, #6 and #8: Picked up review tags

Changes in v2:
--------------
- Patch #1: excluded gitab CI config check and added commit description.
- Patch #3: s/UBOOT_DTSI_LOC/u_boot_dtsi_loc/
- Patch #4: s/DEVICE_TREE_LOC/dt_dir/ and s/U-boot/U-Boot/
- Patch #5: s/U-boot/U-Boot/
- Patch #6 and #7: Picked up review tags

Prerequisite
------------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-Boot repo via:

$ git subtree add --prefix devicetree-rebasing \
        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
        v6.6-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-Boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-Boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-Boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows:

$ git subtree pull --prefix devicetree-rebasing \
        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
        <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-Boot maintainers here [4]. Now we would like to reach out to wider U-Boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-Boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-Boot to run devicetree bindings schema checks which will bring compliance to U-Boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

Quoted 7 lines
Quoted 3 lines

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

I have been following your guidance here and I have also seen it to work but not sure why. Anyway I have strong suspicious that any Makefile rule is not right.

Thanks for taking time to test DT schema checks. It looks like your suspicion is correct.

Quoted 7 lines

I am getting this issue.

/bin/sh: line 1: @: command not found
make[1]: *** [devicetree-rebasing/Bindings/Makefile:68:
devicetree-rebasing/Bindings/processed-schema.json] Error 127
make: *** [Makefile:1181: dt_binding_check] Error 2

I was able to reproduce this issue once I installed yamllint on my Ubuntu machine.

Quoted 10 lines

devicetree-rebasing/Bindings/processed-schema.json is not generated properly

I am using the latest dt schema

$ dt-validate -V
2023.12.dev6+gfb80ec43c204

and no issue to run it from Linux source code that's why I expect it is not issue with my PC in general.
Do you know what can be wrong?

The issue here is basically due to old U-Boot Kbuild infrastructure which isn't in sync with Linux kernel. This Kbuild commit [1] changes aren't present in U-Boot leading to this issue.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3a2429e1faf40b2aaa481aa4b001a74d222c7e8b

Following change to adapt bindings Makefile to old U-Boot Kbuild expectation should resolve this issue:

devicetree-rebasing/Bindings/Makefile +3 -3
index 8b395893bd8..7d08372691c 100644
@@ -47,9 +47,9 @@ quiet_cmd_mk_schema = SCHEMA  $@
                       rm -f $$f
 
  define rule_chkdt
-       $(if $(DT_SCHEMA_LINT),$(call cmd,yamllint),)
-       $(call cmd,chk_bindings)
-       $(call cmd,mk_schema)
+       $(if $(DT_SCHEMA_LINT),$(call echo-cmd,yamllint) $(cmd_yamllint),); \
+       $(call echo-cmd,chk_bindings) $(cmd_chk_bindings); \
+       $(call echo-cmd,mk_schema) $(cmd_mk_schema)
  endef
 
  DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_all_cmd)))
Quoted 1 line

If this works for you then I will include it as a separate patch for v4.

yes that works.

Thanks,
Michal