diff mbox series

[RFC,v2,2/3] of: Add support for -@ when compiling overlays

Message ID 20220427185243.173594-3-detlev.casanova@collabora.com (mailing list archive)
State Not Applicable
Headers show
Series ARM: dts: Support official Raspberry Pi 7inch touchscreen | expand

Commit Message

Detlev Casanova April 27, 2022, 6:52 p.m. UTC
This commit adds an option to compile all device trees with -@ to add the
symbol table to the Device Tree Blobs.

It prepares the introduction of device tree overlays that are
not applied on device trees at compile time (dtbo files.)

These device tree overlays will be used by either a bootloader or a
linux userspace tool to extend the base device tree.

This is used e.g. for drivers that need device tree nodes for optional
non plug and play devices, like an external DSI touchscreen panel that
embeds different i2c devices to control it.

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
---
 drivers/of/Kconfig   | 8 ++++++++
 scripts/Makefile.lib | 9 +++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

Comments

Rob Herring April 27, 2022, 9:24 p.m. UTC | #1
On Wed, Apr 27, 2022 at 02:52:42PM -0400, Detlev Casanova wrote:
> This commit adds an option to compile all device trees with -@ to add the
> symbol table to the Device Tree Blobs.

Why would we want to tie this to the kernel config?

Globally enabling it has already been discussed and rejected.

> It prepares the introduction of device tree overlays that are
> not applied on device trees at compile time (dtbo files.)
> 
> These device tree overlays will be used by either a bootloader or a
> linux userspace tool to extend the base device tree.
> 
> This is used e.g. for drivers that need device tree nodes for optional
> non plug and play devices, like an external DSI touchscreen panel that
> embeds different i2c devices to control it.

You can already set DTC_FLAGS per directory (and target?), so enable it 
for the dtbs that have overlays.

> 
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> ---
>  drivers/of/Kconfig   | 8 ++++++++
>  scripts/Makefile.lib | 9 +++++++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
Florian Fainelli April 28, 2022, 12:01 a.m. UTC | #2
On 4/27/2022 2:24 PM, Rob Herring wrote:
> On Wed, Apr 27, 2022 at 02:52:42PM -0400, Detlev Casanova wrote:
>> This commit adds an option to compile all device trees with -@ to add the
>> symbol table to the Device Tree Blobs.
> 
> Why would we want to tie this to the kernel config?
> 
> Globally enabling it has already been discussed and rejected.
> 
>> It prepares the introduction of device tree overlays that are
>> not applied on device trees at compile time (dtbo files.)
>>
>> These device tree overlays will be used by either a bootloader or a
>> linux userspace tool to extend the base device tree.
>>
>> This is used e.g. for drivers that need device tree nodes for optional
>> non plug and play devices, like an external DSI touchscreen panel that
>> embeds different i2c devices to control it.
> 
> You can already set DTC_FLAGS per directory (and target?), so enable it
> for the dtbs that have overlays.

Looks like this patch series from Aurelien should take care of that:

https://lore.kernel.org/linux-arm-kernel/20220427233607.1225419-1-
aurelien@aurel32.net/
diff mbox series

Patch

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 80b5fd44ab1c..28cf8d18ac45 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -76,11 +76,19 @@  config OF_RESERVED_MEM
 config OF_RESOLVE
 	bool
 
+config OF_SYMBOLS
+	bool "Include device tree symbols"
+	help
+	  Loading a device tree overlay dynamically can require the base
+	  device tree symbols to be present.
+	  If this is enabled, the device tree blobs will be bigger.
+
 config OF_OVERLAY
 	bool "Device Tree overlays"
 	select OF_DYNAMIC
 	select OF_FLATTREE
 	select OF_RESOLVE
+	select OF_SYMBOLS
 	help
 	  Overlays are a method to dynamically modify part of the kernel's
 	  device tree with dynamically loaded data.
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 79be57fdd32a..4c330e565297 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -319,8 +319,13 @@  endif
 
 DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
 
-# Set -@ if the target is a base DTB that overlay is applied onto
-DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
+ifeq ($(CONFIG_OF_SYMBOLS),y)
+	# Add symbols in all devicetrees
+	DTC_FLAGS += -@
+else
+	# Set -@ if the target is a base DTB that overlay is applied onto
+	DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
+endif
 
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB     $@