diff mbox series

of: Add OF_SYMBOLS

Message ID 56ad8108c15715d4e948a8921e24c97731d11478.1609894820.git.plr.vincent@gmail.com
State Changes Requested, archived
Headers show
Series of: Add OF_SYMBOLS | expand

Checks

Context Check Description
robh/checkpatch success

Commit Message

Vincent Pelletier Jan. 6, 2021, 1:09 a.m. UTC
Allows telling dtc to emit the __symbols__ section in produced Device Tree
Blobs, which in turn allows using overlay Device Tree Blobs which reference
nodes from the base Device Tree using such symbols.
This does not presume of what will apply the overlay (bootloader, kernel,
fdtoverlay...).

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
---
 drivers/of/Kconfig   | 8 ++++++++
 scripts/Makefile.lib | 4 ++++
 2 files changed, 12 insertions(+)

Comments

Rob Herring Jan. 6, 2021, 3:47 p.m. UTC | #1
On Tue, Jan 5, 2021 at 6:10 PM Vincent Pelletier <plr.vincent@gmail.com> wrote:
>
> Allows telling dtc to emit the __symbols__ section in produced Device Tree
> Blobs, which in turn allows using overlay Device Tree Blobs which reference
> nodes from the base Device Tree using such symbols.
> This does not presume of what will apply the overlay (bootloader, kernel,
> fdtoverlay...).

A global option is not something we're going to accept. It needs to be
per dtb or soc family at least.

IIRC, you can just set DTC_FLAGS on the make command line if you want
to enable symbols globally.

Also, note that Viresh is working on adding overlay support[1].

Rob

[1] https://lore.kernel.org/linux-devicetree/cover.1609844956.git.viresh.kumar@linaro.org/
diff mbox series

Patch

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 18450437d5d5..2f3db2241561 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -93,6 +93,14 @@  config OF_OVERLAY
 	  While this option is selected automatically when needed, you can
 	  enable it manually to improve device tree unit test coverage.
 
+config OF_SYMBOLS
+	bool "Include symbols in generated Device Tree Blobs"
+	help
+	  This option tells the Device Tree compiler to generate __symbols__
+	  sections in all produced Device Tree Blobs.
+	  Useful for Device Tree overlays, be they applied by the kernel or by
+	  a bootloader, at a slight increase in file size.
+
 config OF_NUMA
 	bool
 
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 213677a5ed33..402c2a5158db 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -299,6 +299,10 @@  endif
 
 DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
 
+ifeq ($(CONFIG_OF_SYMBOLS),y)
+DTC_FLAGS += -@
+endif
+
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB     $@
 cmd_dt_S_dtb=						\