Add out-of-source U-Boot device tree support
PATCH 1/1 Add out-of-source U-Boot device tree support
Similaly to Linux, this patch adds the ability to copy in and build out-of-source device tree sources during a U-Boot build.
--- boot/uboot/Config.in | 7 +++++++ boot/uboot/uboot.mk | 3 +++ 2 files changed, 10 insertions(+)
boot/uboot/Config.in +7 -0
@@ -407,4 +407,11 @@ config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT endif # BR2_TARGET_UBOOT_ENVIMAGE +config BR2_TARGET_UBOOT_CUSTOM_DTS_PATH + string "Device Tree Source file paths" + help + Path to the device tree source files. You can + provide a list of dts paths to copy, + separated by spaces. + endif # BR2_TARGET_UBOOT
boot/uboot/uboot.mk +3 -0
@@ -195,6 +195,9 @@ endef endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY define UBOOT_BUILD_CMDS + $(if $(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH), + cp -f $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH)) $(@D)/arch/$(UBOOT_ARCH)/dts/ + ) $(TARGET_CONFIGURE_OPTS) \ $(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \ $(UBOOT_MAKE_TARGET)
Signature · 1 line
2.7.4
PATCH 1/1 Add out-of-source U-Boot device tree support
Quoted 14 lines · James Balean
Similaly to Linux, this patch adds the ability to copy in and build out-of-source device tree sources during a U-Boot build.
Signed-off-by James Balean <[email protected]>--- boot/uboot/Config.in | 7 +++++++ boot/uboot/uboot.mk | 3 +++ 2 files changed, 10 insertions(+)boot/uboot/Config.in +0
-0
boot/uboot/Config.in config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT · line 411
Quoted 5 lines
boot/uboot/Config.in +2
-0@@ -407,4 +407,11 @@ config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT endif # BR2_TARGET_UBOOT_ENVIMAGE +config BR2_TARGET_UBOOT_CUSTOM_DTS_PATH + string "Device Tree Source file paths"
Would it make sense to add
default BR2_LINUX_KERNEL_CUSTOM_DTS_PATH if BR2_LINUX_KERNEL_USE_CUSTOM_DTS
?
Perhaps also
depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
(AFAIK it's not possible to link in a DTB in the legacy build system.)
boot/uboot/Config.in config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT · line 415
Quoted 4 lines
boot/uboot/Config.in +4
-0+ help + Path to the device tree source files. You can + provide a list of dts paths to copy, + separated by spaces.
Indentation should be 1 tab + 2 spaces, and wrap at 72 columns (where tab
counts as 8, so 62 significant characters).
Perhaps you can add
To use this device tree source file, the U-Boot configuration file must refer to it.
Regards,
Arnout
Quoted 17 lines
boot/uboot/Config.in +1
-0+ endif # BR2_TARGET_UBOOTboot/uboot/uboot.mk +3
-0@@ -195,6 +195,9 @@ endef endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY define UBOOT_BUILD_CMDS + $(if $(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH), + cp -f $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH)) $(@D)/arch/$(UBOOT_ARCH)/dts/ + ) $(TARGET_CONFIGURE_OPTS) \ $(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \ $(UBOOT_MAKE_TARGET)
Signature · 6 lines
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
PATCH 1/1 Add out-of-source U-Boot device tree support
Hi Arnout,
Thank you for your reviewing this patch and for your response.
Quoted 8 lines · Arnout Vandecappelle
Would it make sense to add
defaultBR2_LINUX_KERNEL_CUSTOM_DTS_PATHifBR2_LINUX_KERNEL_USE_CUSTOM_DTS
?Perhaps also
depends onBR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
(AFAIK it's not possible to link in a DTB in the legacy build system.)
Quoted 7 lines
Indentation should be 1 tab + 2 spaces, and wrap at 72 columns (where tab
counts as 8, so 62 significant characters).Perhaps you can add
To use this device tree source file, the U-Boot configuration file must refer to it.
All very good suggestions, which I will incorporate in a new version of the patch shortly.
Thanks again,
James
Signature · 1 line
2.7.4
PATCH 1/1 Add out-of-source U-Boot device tree support
In reply to Arnout VandecappelleHi Arnout,
Quoted 3 lines · Arnout Vandecappelle
Would it make sense to add
defaultBR2_LINUX_KERNEL_CUSTOM_DTS_PATHifBR2_LINUX_KERNEL_USE_CUSTOM_DTS
?
Have reconsidered this suggestion. I think that perhaps it would be best not to make the U-boot option dependent on the Linux option. As Linux and U-Boot use two different device tree sources, there may be occasions when custom DTS configuration must be made to one or the other rather than both. This is the case with my boards, which have device tree support in Linux, but not in U-Boot.
Kind regards,
James
Signature · 1 line
2.7.4
PATCH 1/1 Add out-of-source U-Boot device tree support
Quoted 7 lines · James Balean
Hi Arnout,
Quoted 3 lines · Arnout Vandecappelle
Would it make sense to add
defaultBR2_LINUX_KERNEL_CUSTOM_DTS_PATHifBR2_LINUX_KERNEL_USE_CUSTOM_DTS
?
Quoted 6 lines
Have reconsidered this suggestion. I think that perhaps it would be best not to make the U-boot option dependent on the Linux option. As Linux and U-Boot use two different device tree sources, there may be occasions when custom DTS configuration must be made to one or the other rather than both. This is the case with my boards, which have device tree support in Linux, but not in U-Boot.
Certainly, but I only suggested to *default* to the same DTS. It is also
possible that the kernel isn't built at all by Buildroot, or that it uses an in-tree DTS, or that it is built without DTS because the DTB is provided by U-Boot. All of these cases are covered by the "if BR2_LINUX_KERNEL_USE_CUSTOM_DTS" part. And even if the both kernel and U-Boot use a DTS, it is possible to change the default.
Regards,
Arnout
Signature · 6 lines
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
PATCH 1/1 Add out-of-source U-Boot device tree support
Hello,
Quoted 7 lines · Arnout Vandecappelle
Quoted 6 lines
Have reconsidered this suggestion. I think that perhaps it would be best not to make the U-boot option dependent on the Linux option. As Linux and U-Boot use two different device tree sources, there may be occasions when custom DTS configuration must be made to one or the other rather than both. This is the case with my boards, which have device tree support in Linux, but not in U-Boot.
Quoted 6 lines
Certainly, but I only suggested to *default* to the same DTS. It is also
possible that the kernel isn't built at all by Buildroot, or that it uses an in-tree DTS, or that it is built without DTS because the DTB is provided by U-Boot. All of these cases are covered by the "ifBR2_LINUX_KERNEL_USE_CUSTOM_DTS" part. And even if the both kernel and U-Boot use a DTS, it is possible to change the default.
I am not entirely convinced that this:
default BR2_LINUX_KERNEL_CUSTOM_DTS_PATH if BR2_LINUX_KERNEL_USE_CUSTOM_DTS
is really a good idea. IMO, it tries to be too "clever". I'd really prefer to keep the U-Boot and Linux configurations independent from each other.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 Add out-of-source U-Boot device tree support
Quoted 18 lines · Thomas Petazzoni
Hello,
Quoted 7 lines · Arnout Vandecappelle
Quoted 6 lines
Have reconsidered this suggestion. I think that perhaps it would be best not to make the U-boot option dependent on the Linux option. As Linux and U-Boot use two different device tree sources, there may be occasions when custom DTS configuration must be made to one or the other rather than both. This is the case with my boards, which have device tree support in Linux, but not in U-Boot.
Quoted 6 lines
Certainly, but I only suggested to *default* to the same DTS. It is also
possible that the kernel isn't built at all by Buildroot, or that it uses an in-tree DTS, or that it is built without DTS because the DTB is provided by U-Boot. All of these cases are covered by the "ifBR2_LINUX_KERNEL_USE_CUSTOM_DTS" part. And even if the both kernel and U-Boot use a DTS, it is possible to change the default.
Quoted 7 lines
I am not entirely convinced that this:
default
BR2_LINUX_KERNEL_CUSTOM_DTS_PATHifBR2_LINUX_KERNEL_USE_CUSTOM_DTSis really a good idea. IMO, it tries to be too "clever". I'd really prefer to keep the U-Boot and Linux configurations independent from each other.
Yeah, thinking a bit more about it: if you use the same DT in U-Boot as in the
kernel, then you probably let U-Boot pass it to the kernel so you don't need it at kernel build time...
So forget I suggested this :-)
Regards,
Arnout
Signature · 6 lines
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
PATCH 1/1 Add out-of-source U-Boot device tree support
Hello,
Quoted 3 lines · Arnout Vandecappelle
Yeah, thinking a bit more about it: if you use the same DT in U-Boot as in the
kernel, then you probably let U-Boot pass it to the kernel so you don't need it at kernel build time...
Not necessarily. The DT can be used by U-Boot itself to know which peripherals are available, and how they should be configured. I am not sure there is a U-Boot option to bundle the DT within U-Boot just for the purpose of passing it to the kernel. But I might be wrong, I haven't looked in details at how U-Boot uses the DT.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 Add out-of-source U-Boot device tree support
Quoted 10 lines · Thomas Petazzoni
Hello,
Quoted 3 lines · Arnout Vandecappelle
Yeah, thinking a bit more about it: if you use the same DT in U-Boot as in the
kernel, then you probably let U-Boot pass it to the kernel so you don't need it at kernel build time...Not necessarily. The DT can be used by U-Boot itself to know which peripherals are available, and how they should be configured.
But U-Boot can always pass the device tree it uses internally to the kernel, no?
Quoted 3 lines
I am not
sure there is a U-Boot option to bundle the DT within U-Boot just for the purpose of passing it to the kernel.
I never heard of such an option either.
Regards,
Arnout
Quoted 2 lines
But I might be wrong, I
haven't looked in details at how U-Boot uses the DT.
Signature · 6 lines
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
PATCH 1/1 Add out-of-source U-Boot device tree support
Hello,
Quoted 4 lines · Arnout Vandecappelle
Quoted 2 lines
Not necessarily. The DT can be used by U-Boot itself to know which peripherals are available, and how they should be configured.
But U-Boot can always pass the device tree it uses internally to the kernel, no?
I don't know. Would have to check.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 Add out-of-source U-Boot device tree support
Hi All,
Thank you for your responses. I will submit a new version of the patch with your suggestions following this.
Quoted 7 lines · Thomas Petazzoni
Quoted 5 lines
Quoted 2 lines
Not necessarily. The DT can be used by U-Boot itself to know which peripherals are available, and how they should be configured.
But U-Boot can always pass the device tree it uses internally to the kernel, no?
I don't know. Would have to check.
I believe it is possible to use U-Boot's device tree blob when booting Linux. U-Boot's DTB is simply concatenated on the end of itself, so the address at which the blob starts could be determined and supplied to the 'bootm' command when booting Linux. I have not tested this though, so will report back if I get around to it.
Thanks again,
James
PATCH v2 1/1 Add out-of-source U-Boot device tree support
Similaly to Linux, this patch adds the ability to copy in and build out-of-source device tree sources during a U-Boot build.
---
Changes for v2:
- Added dependency on U-Boot Kconfig build system.
- Code style cleanup
boot/uboot/Config.in | 14 ++++++++++++++ boot/uboot/uboot.mk | 3 +++ 2 files changed, 17 insertions(+)
boot/uboot/Config.in +14 -0
@@ -407,4 +407,18 @@ config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT endif # BR2_TARGET_UBOOT_ENVIMAGE +if BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + +config BR2_TARGET_UBOOT_CUSTOM_DTS_PATH + string "Device Tree Source file paths" + help + Path to the device tree source files. You can provide a list + of dts paths to copy, separated by spaces. + + To use this device tree source file, the U-Boot configuration + file must refer to it. + +endif + endif # BR2_TARGET_UBOOT +
boot/uboot/uboot.mk +3 -0
@@ -195,6 +195,9 @@ endef endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY define UBOOT_BUILD_CMDS + $(if $(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH), + cp -f $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH)) $(@D)/arch/$(UBOOT_ARCH)/dts/ + ) $(TARGET_CONFIGURE_OPTS) \ $(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \ $(UBOOT_MAKE_TARGET)
Signature · 1 line
2.7.4
Thomas Petazzoni
AppliedPATCH v2 1/1 Add out-of-source U-Boot device tree support
Hello,
Quoted 10 lines · James Balean
Similaly to Linux, this patch adds the ability to copy in and build out-of-source device tree sources during a U-Boot build.
Signed-off-by James Balean <[email protected]>Cc Arnout Vandecappelle <[email protected]>Cc Thomas Petazzoni <[email protected]>---
Changes for v2:
- Added dependency on U-BootKconfigbuild system.
- Code style cleanup
Applied to master after slightly tweaking the help text and dropping a needlessly added newline at the end of Config.in.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com