mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 1/7] kbuild: Add target to build dtb overlay files
Date: Thu, 9 Mar 2023 16:33:22 +0100	[thread overview]
Message-ID: <ea6090bd-36bf-eec0-993a-8bbd044dd48e@pengutronix.de> (raw)
In-Reply-To: <20230309152815.GH5784@pengutronix.de>

On 09.03.23 16:28, Sascha Hauer wrote:
> On Thu, Mar 09, 2023 at 02:24:36PM +0100, Ahmad Fatoum wrote:
>> On 09.03.23 12:52, Sascha Hauer wrote:
>>> Device tree overlay files have the suffix dtso in source format
>>> and dtbo in binary format. Add the necessary targets to build dtbo
>>> files from dtso files and also dtbo.o files to include into the
>>> barebox binary.
>>> The overlay files shouldn't include the device tree snippets from
>>> CONFIG_EXTERNAL_DTS_FRAGMENTS which makes it necessary to specify
>>> these fragments as an argument to cmd_dtc.
>>>
>>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>>> ---
>>>  scripts/Makefile.build |  4 ++++
>>>  scripts/Makefile.lib   | 11 ++++++++++-
>>>  2 files changed, 14 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
>>> index 216f03677b..33480a81b4 100644
>>> --- a/scripts/Makefile.build
>>> +++ b/scripts/Makefile.build
>>> @@ -258,12 +258,16 @@ intermediate_targets = $(foreach sfx, $(2), \
>>>  					$(filter %$(strip $(1)), $(targets))))
>>>  # %.asn1.o <- %.asn1.[ch] <- %.asn1
>>>  # %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
>>> +# %.dtbo.o <- %.dtbo.S <- %.dtbo <- %.dtso
>>>  # %.dtb.pbl.o <- %.dtb.S <- %.dtb <- %.dts (Barebox only)
>>> +# %.dtbo.pbl.o <- %.dtbo.S <- %.dtbo <- %.dtso (Barebox only)
>>>  # %.lex.o <- %.lex.c <- %.l
>>>  # %.tab.o <- %.tab.[ch] <- %.y
>>>  targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \
>>>  	   $(call intermediate_targets, .dtb.o, .dtb.S .dtb.z .dtb) \
>>> +	   $(call intermediate_targets, .dtbo.o, .dtbo.S .dtbo.z .dtbo) \
>>>  	   $(call intermediate_targets, .dtb.pbl.o, .dtb.S .dtb.z .dtb) \
>>> +	   $(call intermediate_targets, .dtbo.pbl.o, .dtbo.S .dtbo.z .dtbo) \
>>
>> I see now reason to allow building an overlay for PBL. Should we drop this?
> 
> I thought some board might want to apply an overlay in PBL, but the code
> to apply an overlay is not there, not even the code to unflatten a dtb.
> So right, this can be removed.
> 
>>
>>>  	   $(call intermediate_targets, .lex.o, .lex.c) \
>>>  	   $(call intermediate_targets, .tab.o, .tab.c .tab.h)
>>>  
>>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
>>> index 6e0d92cf75..6af2fe07b2 100644
>>> --- a/scripts/Makefile.lib
>>> +++ b/scripts/Makefile.lib
>>> @@ -361,13 +361,19 @@ cmd_dt_S_dtb = $(srctree)/scripts/gen-dtb-s $(subst -,_,$(*F)) $< $(CONFIG_IMD)
>>>  $(obj)/%.dtb.S: $(obj)/%.dtb $(obj)/%.dtb.z $(srctree)/scripts/gen-dtb-s FORCE
>>>  	$(call if_changed,dt_S_dtb)
>>>  
>>> +$(obj)/%.dtbo.S: $(obj)/%.dtbo $(obj)/%.dtbo.z $(srctree)/scripts/gen-dtb-s FORCE
>>> +	$(call if_changed,dt_S_dtb)
>>> +
>>>  $(obj)/%.dtb.z: $(obj)/%.dtb FORCE
>>>  	$(call if_changed,$(suffix_y))
>>>  
>>> +$(obj)/%.dtbo.z: $(obj)/%.dtbo FORCE
>>> +	$(call if_changed,$(suffix_y))
>>
>> Can we drop this and change scripts/gen-dtb-s to skip creating the compressed DTB
>> if we have a *.dtbo?
> 
> What's wrong with building compressed overlays? That might come in
> handy later.
Either you link it into barebox proper and then you should rather compress
barebox proper itself.

Or you pick out the *.dtbo.z from the barebox build directory and in that
case you will need decompress by hand anyway, because compressed DT
is currently only handled for barebox live DT.

Cheers,
Ahmad 

> 
>> While at, we should rename the symbol to __dtbo_. Otherwise,
>> we can have name clashes.
> 
> Right.
> 
> Sascha
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2023-03-09 15:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 11:52 [PATCH v2 0/7] support overlays to the barebox live tree Sascha Hauer
2023-03-09 11:52 ` [PATCH v2 1/7] kbuild: Add target to build dtb overlay files Sascha Hauer
2023-03-09 13:24   ` Ahmad Fatoum
2023-03-09 15:28     ` Sascha Hauer
2023-03-09 15:33       ` Ahmad Fatoum [this message]
2023-03-09 15:35         ` Sascha Hauer
2023-03-09 11:52 ` [PATCH v2 2/7] driver: Add rescan hook to struct device Sascha Hauer
2023-03-09 12:54   ` Ahmad Fatoum
2023-03-09 13:39     ` Ahmad Fatoum
2023-03-09 13:08   ` Ahmad Fatoum
2023-03-09 15:41     ` Sascha Hauer
2023-03-10  8:37       ` Sascha Hauer
2023-03-09 11:52 ` [PATCH v2 3/7] i2c: implement rescan Sascha Hauer
2023-03-09 13:02   ` Ahmad Fatoum
2023-03-09 15:54     ` Sascha Hauer
2023-03-09 11:52 ` [PATCH v2 4/7] spi: Directly register SPI device Sascha Hauer
2023-03-09 11:52 ` [PATCH v2 5/7] spi: reduce scope of 'chip' Sascha Hauer
2023-03-09 11:52 ` [PATCH v2 6/7] spi: implement rescan Sascha Hauer
2023-03-09 13:03   ` Ahmad Fatoum
2023-03-09 11:52 ` [PATCH v2 7/7] of_overlay: Add option to apply overlay to live tree Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea6090bd-36bf-eec0-993a-8bbd044dd48e@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox