Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] linux: build default dtbs if no specific source files given
@ 2018-08-03 16:27 Floris Bos
  2018-08-16 20:34 ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Floris Bos @ 2018-08-03 16:27 UTC (permalink / raw)
  To: buildroot

Currently if one wants to build dtbs, one has to specify which
dts source files to build exactly.
This is inconvenient, and some platforms use non-standard file
names that are currently not supported by buildroot.
(e.g. the overlay files in downstream Raspberry Pi kernel)

Fix this by allowing the DTS source to be left empty,
in which case the standard list of dtbs for the kernel
configuration will be build ("make dtbs") and installed
("make dtbs_install")

Only corner case in which specifying file names is still
required is when appending dtb to kernel.

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
---
 linux/Config.in |  4 ++++
 linux/linux.mk  | 14 ++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/linux/Config.in b/linux/Config.in
index d30489e..40d337d 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -377,6 +377,10 @@ config BR2_LINUX_KERNEL_INTREE_DTS_NAME
 	  the trailing .dts. You can provide a list of
 	  dts files to build, separated by spaces.
 
+	  If both this option and out-of-tree path is left empty
+	  the default set of dtbs for the kernel configuration
+	  is build.
+
 config BR2_LINUX_KERNEL_CUSTOM_DTS_PATH
 	string "Out-of-tree Device Tree Source file paths"
 	help
diff --git a/linux/linux.mk b/linux/linux.mk
index 7527b11..a00029f 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -341,6 +341,15 @@ endef
 
 ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
 ifeq ($(BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT),)
+ifeq ($(strip $(LINUX_DTS_NAME)),)
+define LINUX_BUILD_DTB
+	$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) dtbs
+endef
+define LINUX_INSTALL_DTB
+	$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) \
+		INSTALL_DTBS_PATH=$(1) dtbs_install
+endef
+else # LINUX_DTS_NAME
 define LINUX_BUILD_DTB
 	$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_DTBS)
 endef
@@ -353,6 +362,7 @@ define LINUX_INSTALL_DTB
 		$(1)
 endef
 endif # BR2_LINUX_KERNEL_APPENDED_DTB
+endif # LINUX_DTS_NAME
 endif # BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT
 endif # BR2_LINUX_KERNEL_DTS_SUPPORT
 
@@ -501,8 +511,8 @@ $(error No kernel configuration file specified, check your BR2_LINUX_KERNEL_CUST
 endif
 endif
 
-ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT):$(strip $(LINUX_DTS_NAME)),y:)
-$(error No kernel device tree source specified, check your \
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB):$(strip $(LINUX_DTS_NAME)),y:)
+$(error If appending dtb to kernel, device tree source needs to be specified, check your \
 	BR2_LINUX_KERNEL_INTREE_DTS_NAME / BR2_LINUX_KERNEL_CUSTOM_DTS_PATH settings)
 endif
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] linux: build default dtbs if no specific source files given
  2018-08-03 16:27 [Buildroot] [PATCH 1/1] linux: build default dtbs if no specific source files given Floris Bos
@ 2018-08-16 20:34 ` Thomas Petazzoni
  2018-08-16 21:11   ` Floris Bos
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2018-08-16 20:34 UTC (permalink / raw)
  To: buildroot

Hello Floris,

Thanks for this contribution. It definitely makes sense to support this.

On Fri,  3 Aug 2018 18:27:54 +0200, Floris Bos wrote:
> Currently if one wants to build dtbs, one has to specify which
> dts source files to build exactly.
> This is inconvenient, and some platforms use non-standard file
> names that are currently not supported by buildroot.
> (e.g. the overlay files in downstream Raspberry Pi kernel)

Could you give some more specific example of those non-standard names ?
Are we talking about .dtbo files ?

> diff --git a/linux/Config.in b/linux/Config.in
> index d30489e..40d337d 100644
> --- a/linux/Config.in
> +++ b/linux/Config.in
> @@ -377,6 +377,10 @@ config BR2_LINUX_KERNEL_INTREE_DTS_NAME
>  	  the trailing .dts. You can provide a list of
>  	  dts files to build, separated by spaces.
>  
> +	  If both this option and out-of-tree path is left empty
> +	  the default set of dtbs for the kernel configuration
> +	  is build.

I think this should rather be in the help text of the
BR2_LINUX_KERNEL_DTS_SUPPORT. Basically, if you enable
BR2_LINUX_KERNEL_DTS_SUPPORT, but leave
BR2_LINUX_KERNEL_INTREE_DTS_NAME and BR2_LINUX_KERNEL_CUSTOM_DTS_PATH
empty, you'll have all Device Tree for the selected configuration built
and installed.

As a separate patch, we should also change:

  bool "Build a Device Tree Blob (DTB)"

to

  bool "Build Device Tree Blobs (DTBs)"

>  ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
>  ifeq ($(BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT),)
> +ifeq ($(strip $(LINUX_DTS_NAME)),)
> +define LINUX_BUILD_DTB
> +	$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) dtbs

Perhaps we can do:

	$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) \
		$(if $(LINUX_DTS_NAME),$(LINUX_DTBS),dtbs)

to handle both situations at once.

> +define LINUX_INSTALL_DTB
> +	$(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) \
> +		INSTALL_DTBS_PATH=$(1) dtbs_install

I see one problem with see: no all architecture that support building
dtbs have the dtbs_install target.

Can we install all *.dtb* for example ? Or should we say we don't care
if this new feature only works for a subset of the CPU architectures
that use DT ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] linux: build default dtbs if no specific source files given
  2018-08-16 20:34 ` Thomas Petazzoni
@ 2018-08-16 21:11   ` Floris Bos
  2018-08-21 22:39     ` Arnout Vandecappelle
  0 siblings, 1 reply; 5+ messages in thread
From: Floris Bos @ 2018-08-16 21:11 UTC (permalink / raw)
  To: buildroot

Hi,

On 08/16/2018 10:34 PM, Thomas Petazzoni wrote:
> Hello Floris,
>
> Thanks for this contribution. It definitely makes sense to support this.
>
> On Fri,  3 Aug 2018 18:27:54 +0200, Floris Bos wrote:
>> Currently if one wants to build dtbs, one has to specify which
>> dts source files to build exactly.
>> This is inconvenient, and some platforms use non-standard file
>> names that are currently not supported by buildroot.
>> (e.g. the overlay files in downstream Raspberry Pi kernel)
> Could you give some more specific example of those non-standard names ?
> Are we talking about .dtbo files ?

Yes.
Name of source file doesn't match installed file.

overlays/dwc2-overlay.dts -> overlays/dwc2.dbto

> I see one problem with see: no all architecture that support building
> dtbs have the dtbs_install target.

Would consider that a bug in the architecture's Makefile.

> Can we install all *.dtb* for example ?

Don't think that will deal with the "-overlay" in my example.



Yours sincerely,

Floris Bos

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] linux: build default dtbs if no specific source files given
  2018-08-16 21:11   ` Floris Bos
@ 2018-08-21 22:39     ` Arnout Vandecappelle
  2018-08-21 22:59       ` Floris Bos
  0 siblings, 1 reply; 5+ messages in thread
From: Arnout Vandecappelle @ 2018-08-21 22:39 UTC (permalink / raw)
  To: buildroot



On 16/08/2018 23:11, Floris Bos wrote:
> Hi,
> 
> On 08/16/2018 10:34 PM, Thomas Petazzoni wrote:
>> Hello Floris,
>>
>> Thanks for this contribution. It definitely makes sense to support this.
>>
>> On Fri,? 3 Aug 2018 18:27:54 +0200, Floris Bos wrote:
>>> Currently if one wants to build dtbs, one has to specify which
>>> dts source files to build exactly.
>>> This is inconvenient, and some platforms use non-standard file
>>> names that are currently not supported by buildroot.
>>> (e.g. the overlay files in downstream Raspberry Pi kernel)
>> Could you give some more specific example of those non-standard names ?
>> Are we talking about .dtbo files ?
> 
> Yes.
> Name of source file doesn't match installed file.
> 
> overlays/dwc2-overlay.dts -> overlays/dwc2.dbto
> 
>> I see one problem with see: no all architecture that support building
>> dtbs have the dtbs_install target.
> 
> Would consider that a bug in the architecture's Makefile.

 powerpc is the oldest architecture using dtb, and it doesn't have it...

 The builddeb script has an explicit
if grep -q dtbs_install "${srctree}/arch/$SRCARCH/Makefile"; then ...

> 
>> Can we install all *.dtb* for example ?
> 
> Don't think that will deal with the "-overlay" in my example.

 Yes it will, because the binary to install will be called .dtbo so it matches
the *.dtb* pattern.

 Regards,
 Arnout

> 
> 
> 
> Yours sincerely,
> 
> Floris Bos
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] linux: build default dtbs if no specific source files given
  2018-08-21 22:39     ` Arnout Vandecappelle
@ 2018-08-21 22:59       ` Floris Bos
  0 siblings, 0 replies; 5+ messages in thread
From: Floris Bos @ 2018-08-21 22:59 UTC (permalink / raw)
  To: buildroot

On 08/22/2018 12:39 AM, Arnout Vandecappelle wrote:
>
> On 16/08/2018 23:11, Floris Bos wrote:
>> Hi,
>>
>> On 08/16/2018 10:34 PM, Thomas Petazzoni wrote:
>>> Hello Floris,
>>>
>>> Thanks for this contribution. It definitely makes sense to support this.
>>>
>>> On Fri,? 3 Aug 2018 18:27:54 +0200, Floris Bos wrote:
>>>> Currently if one wants to build dtbs, one has to specify which
>>>> dts source files to build exactly.
>>>> This is inconvenient, and some platforms use non-standard file
>>>> names that are currently not supported by buildroot.
>>>> (e.g. the overlay files in downstream Raspberry Pi kernel)
>>> Could you give some more specific example of those non-standard names ?
>>> Are we talking about .dtbo files ?
>> Yes.
>> Name of source file doesn't match installed file.
>>
>> overlays/dwc2-overlay.dts -> overlays/dwc2.dbto
>>
>>> I see one problem with see: no all architecture that support building
>>> dtbs have the dtbs_install target.
>> Would consider that a bug in the architecture's Makefile.
>   powerpc is the oldest architecture using dtb, and it doesn't have it...
>
>   The builddeb script has an explicit
> if grep -q dtbs_install "${srctree}/arch/$SRCARCH/Makefile"; then ...

Well, the top level Makefile does clearly define the INSTALL_DTBS_PATH 
variable: https://github.com/torvalds/linux/blob/master/Makefile#L891
Would argue that if architectures do not provide a target that is able 
to use that, the architecture's Makefile is broken.

Does powerpc provide a dtbs target that builds all dtb, or is that also 
missing?


Anway, as of yesterday there seem to be some progress on consolidating 
the device-tree building for all architectures, so that should fix 
things soonish: https://lkml.org/lkml/2018/8/21/763



>
>>> Can we install all *.dtb* for example ?
>> Don't think that will deal with the "-overlay" in my example.
>   Yes it will, because the binary to install will be called .dtbo so it matches
> the *.dtb* pattern.

Keep in mind that the .dtbo will not be in arch/arm/boot/dts but in 
arch/arm/boot/dts/overlays though.
So you still would need something more sophisticated that also takes 
subdirectories into mind.


Yours sincerely,

Floris Bos

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-21 22:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-03 16:27 [Buildroot] [PATCH 1/1] linux: build default dtbs if no specific source files given Floris Bos
2018-08-16 20:34 ` Thomas Petazzoni
2018-08-16 21:11   ` Floris Bos
2018-08-21 22:39     ` Arnout Vandecappelle
2018-08-21 22:59       ` Floris Bos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox