dts: Make it easier to enable __symbols__ generation in dtb files
PATCH 1/1 dts: Make it easier to enable __symbols__ generation in dtb files
This introduces the variabe DTC_EXTRA_FLAGS to allow for additional flags to be passed to dtc. While this can have many uses (such as easier testing of new warning flags) the use case I wish to spell out here is passing of -@ to enable __symbols__ to be included in the resulting dtb and thus 'stacked' overlays to be able to be used.
When passing in -@ this will increase the size of the dtb (and resident memory usage) in exchange for allowing more types of overlays to be applied to the dtb file prior to passing it to Linux and additional functionality within the kernel when OF_OVERLAY is enabled and in tools outside of the kernel.
---
This would be v3 of my attempt to enable __symbols__ more widely (v2, for people not on the CC, enabled it always, but for some boards).
To be clear, this version of the patch is more flexible in that it allows for arbitrary flags to be passed to dtc, which can have other uses. But, I'm still spelling out -@ being the motivation behind this for clarity. Both Frank and Rob were uncomfortable with v2, and Frank suggested this approach to make it easier for users / distributions / etc to opt-in to this functionality. For clarity, Frank was suggesting (at least at first) perhaps also a tie-in CONFIG option, which I have not done here as I feel that's adding extra hurdles to something that must already be opt-in. Given that today many of the immediate uses are for "pre-boot" application of overlays (SoM + carrier + add-ons or EVM + LCD for example), I believe this is an acceptable trade-off to make currently.
--- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +1 -1
@@ -293,7 +293,7 @@ DTC_FLAGS += -Wnode_name_chars_strict \ -Wproperty_name_chars_strict endif -DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) +DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) $(DTC_EXTRA_FLAGS) # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_dt_S_dtb= DTB $@
Signature · 1 line
1.9.1
Hi Tom,
Some nit picking on the patch comment. :-)
Quoted 5 lines · Tom Rini
This introduces the variabe
DTC_EXTRA_FLAGSto allow for additional flags to be passed to dtc. While this can have many uses (such as easier testing of new warning flags) the use case I wish to spell out here is passing of -@ to enable__symbols__to be included in the resulting dtb and thus 'stacked' overlays to be able to be used.
Not just stacked overlays (I'm guessing by that you mean an overlay applied on top of an overlay), but even an overlay on top of the base dtb.
Quoted 5 lines
When passing in -@ this will increase the size of the dtb (and resident memory usage) in exchange for allowing more types of overlays to be applied to the dtb file prior to passing it to Linux and additional functionality within the kernel when
OF_OVERLAYis enabled and in tools outside of the kernel.
Not so much additional functionality within the kernel. It is basic functionality for any overlay to be applied in the kernel.
Quoted 16 lines
Cc Jason Kridner <[email protected]>Cc Drew Fustini <[email protected]>Cc Robert Nelson <[email protected]>Cc Lokesh Vutla <[email protected]>Cc Frank Rowand <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Russell King <[email protected]>Cc Masahiro Yamada <[email protected]>Cc Michal Marek <[email protected]>CC linux-kbuild at vger.kernel.orgCc devicetree at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Tom Rini <[email protected]>
Quoted 8 lines
---
This would be v3 of my attempt to enable__symbols__more widely (v2, for people not on the CC, enabled it always, but for some boards).To be clear, this version of the patch is more flexible in that it allows for arbitrary flags to be passed to dtc, which can have other uses. But, I'm still spelling out -@ being the motivation behind this for clarity.
Thank you, that is very useful info to capture in the commit history.
Quoted 9 lines
Both Frank and Rob were uncomfortable with v2, and Frank suggested this approach to make it easier for users / distributions / etc to opt-in to this functionality. For clarity, Frank was suggesting (at least at first) perhaps also a tie-in CONFIG option, which I have not done here as I feel that's adding extra hurdles to something that must already be opt-in. Given that today many of the immediate uses are for "pre-boot" application of overlays (SoM + carrier + add-ons or EVM + LCD for example), I believe this is an acceptable trade-off to make currently.
If I understand correctly, then you are following Rob's suggestion of passing the DTC_EXTRA_FLAGS value in the dtb make command.
That seems to be a reasonable approach for now. Rob did mention that he would like to remove the current hard coding of a base DTC_FLAGS value, where several architectures initialize it with one of:
DTC_FLAGS ?= -p 1024
DTC_FLAGS := -p 1024
If those initializations can be removed, then we could just use DTC_FLAGS in the make command, instead of adding DTC_EXTRA_FLAGS. Can you discuss that option with Rob? (Sorry Rob, I'll be off-grid soon.)
Quoted 18 lines
--- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/Makefile.lib +1
-1@@ -293,7 +293,7 @@ DTC_FLAGS += -Wnode_name_chars_strict \ -Wproperty_name_chars_strict endif -DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) +DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) $(DTC_EXTRA_FLAGS) # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_dt_S_dtb= DTB $@
Quoted 12 lines · Frank Rowand
Hi Tom,
Some nit picking on the patch comment. :-)
Quoted 5 lines · Tom Rini
This introduces the variabe
DTC_EXTRA_FLAGSto allow for additional flags to be passed to dtc. While this can have many uses (such as easier testing of new warning flags) the use case I wish to spell out here is passing of -@ to enable__symbols__to be included in the resulting dtb and thus 'stacked' overlays to be able to be used.
Quoted 3 lines
Not just stacked overlays (I'm guessing by that you mean an overlay applied on top of an overlay), but even an overlay on top of the base dtb.
In the case of outside of the kernel, we can today have some classes of overlays that work today. "Stacked" is how Pantelis has been referring to overlays that make use of __symbols__ so that we can resolve references. I guess this ended up being referenced as plugin support in dtc.git tho? I'm not quite sure how to re-word the above to be clear that it's extending what can be used.
Quoted 8 lines
Quoted 5 lines
When passing in -@ this will increase the size of the dtb (and resident memory usage) in exchange for allowing more types of overlays to be applied to the dtb file prior to passing it to Linux and additional functionality within the kernel when
OF_OVERLAYis enabled and in tools outside of the kernel.Not so much additional functionality within the kernel. It is basic functionality for any overlay to be applied in the kernel.
Oh, I thought the kernel already handled using that information. I'll think how to reword the line there then.
Quoted 44 lines
Quoted 15 lines
Cc Jason Kridner <[email protected]>Cc Drew Fustini <[email protected]>Cc Robert Nelson <[email protected]>Cc Lokesh Vutla <[email protected]>Cc Frank Rowand <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Russell King <[email protected]>Cc Masahiro Yamada <[email protected]>Cc Michal Marek <[email protected]>Signed-off-by Tom Rini <[email protected]>Quoted 8 lines
---
This would be v3 of my attempt to enable__symbols__more widely (v2, for people not on the CC, enabled it always, but for some boards).To be clear, this version of the patch is more flexible in that it allows for arbitrary flags to be passed to dtc, which can have other uses. But, I'm still spelling out -@ being the motivation behind this for clarity.
Thank you, that is very useful info to capture in the commit history.
Quoted 9 lines
Both Frank and Rob were uncomfortable with v2, and Frank suggested this approach to make it easier for users / distributions / etc to opt-in to this functionality. For clarity, Frank was suggesting (at least at first) perhaps also a tie-in CONFIG option, which I have not done here as I feel that's adding extra hurdles to something that must already be opt-in. Given that today many of the immediate uses are for "pre-boot" application of overlays (SoM + carrier + add-ons or EVM + LCD for example), I believe this is an acceptable trade-off to make currently.
If I understand correctly, then you are following Rob's suggestion of passing the
DTC_EXTRA_FLAGSvalue in the dtb make command.That seems to be a reasonable approach for now. Rob did mention that he would like to remove the current hard coding of a base
DTC_FLAGSvalue, where several architectures initialize it with one of:
Quoted 7 lines
DTC_FLAGS ?= -p 1024 DTC_FLAGS := -p 1024If those initializations can be removed, then we could just use
DTC_FLAGSin the make command, instead of addingDTC_EXTRA_FLAGS. Can you discuss that option with Rob? (Sorry Rob, I'll be off-grid soon.)
With respect to the current users of DTC_FLAGS, we could just change c6x / microblaze / openrisc / powerpc to use '+=' not '?=' or ':=' as one-line patches, from a quick test on microblaze. Or maybe I'm missing something?
But we can't only pass DTC_FLAGS on the command-line directly, unless we also pass in all other valid and normal flags (ie -Wno-unit_address_vs_reg). This is in-line with how for example CFLAGS is handled in the kernel, rather than by what, based on some googling, Makefiles can be made to do, in general. Thanks!
Signature · 1 line
Tom