Skip to contentSkip to conversation

Add support for dtb file in /boot directory on target

PATCH New Gary Coulbourne 2 participants 3 messages Dec 3, 2012 – Dec 19, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for dtb file in /boot directory on target

Howdy!

I'm using u-boot, and loading both the kernel image and the dtb from /boot on my target. I added support for this, and am
submitting the patch should it be useful to anyone else.

---
 linux/Config.in |    6 ++++++
 linux/linux.mk  |    7 +++++++
 2 files changed, 13 insertions(+)
linux/Config.in +6 -0
index f408ad5..d5ffa57 100644
@@ -283,6 +283,12 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
          /boot in the target root filesystem, as is typically done on
          x86/x86_64 systems.
 
+config BR2_LINUX_DEVICE_TREE_INSTALL_TARGET
+        bool "Install Device Tree to /boot in target"
+        depends on BR2_LINUX_KERNEL_DTS_SUPPORT
+       help
+         Select this option to have the device tree installed to
+          /boot in the target root filesystem.
 
 # Linux extensions
 source "linux/Config.ext.in"
linux/linux.mk +3 -0
index c4bdf90..8778c35 100644
@@ -208,6 +208,12 @@ define LINUX_APPEND_DTB
 endef
 endif
 
+ifeq ($(BR2_LINUX_DEVICE_TREE_INSTALL_TARGET),y)
+define LINUX_DEVICE_TREE_INSTALL_TARGET
+       install -m 0644 -D $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb

$(TARGET_DIR)/boot/$(KERNEL_DTS_NAME).dtb
+endef
+endif
+
# Compilation. We make sure the kernel gets rebuilt when the

 # configuration has changed.
 define LINUX_BUILD_CMDS
@@ -244,6 +250,7 @@ endef
 define LINUX_INSTALL_TARGET_CMDS
        $(LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET)
        $(LINUX_INSTALL_DTB)
+       $(LINUX_DEVICE_TREE_INSTALL_TARGET)
        # Install modules and remove symbolic links pointing to build
        # directories, not relevant on the target
        @if grep -q "CONFIG_MODULES=y" $(@D)/.config; then      \
Signature · 8 lines
1.7.10.4


Peace,
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20121203/89b6ad10/attachment-0001.html>
#1 lore raw

PATCH 1/1 Add support for dtb file in /boot directory on target

Quoted 5 lines · Gary Coulbourne

Howdy!

I'm using u-boot, and loading both the kernel image and the dtb from /boot on my target. I added support for this, and am submitting the patch should it be useful to anyone else.

Hi Gary,

Could you also resend this patch with git send-email? (See its man page
for how to configure it for gmail.)

Quoted 10 lines
---
  linux/Config.in |    6 ++++++
  linux/linux.mk <http://linux.mk>  |    7 +++++++
  2 files changed, 13 insertions(+)
linux/Config.in +0 -0
index f408ad5..d5ffa57 100644

linux/Config.in config BR2_LINUX_KERNEL_INSTALL_TARGET · line 286

Quoted 4 lines
linux/Config.in +2 -0
@@ -283,6 +283,12 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
           /boot in the target root filesystem, as is typically done on
           x86/x86_64 systems.
+config BR2_LINUX_DEVICE_TREE_INSTALL_TARGET
+        bool "Install Device Tree to /boot in target"

Perhaps the whitespace is correct and gmail ate it, but just to be sure:
indentation should be one tab.

However, does it make sense to have this as a separate config option?
Isn't it better to do this automatically when BR2_LINUX_KERNEL_INSTALL_TARGET is set? (Unless BR2_LINUX_KERNEL_APPENDED_DTB is set as well, of course.)

Or are there use cases where you want the DTB in /boot, but not the
kernel image?

Quoted 26 lines
linux/Config.in +4 -0
+        depends on BR2_LINUX_KERNEL_DTS_SUPPORT
+       help
+         Select this option to have the device tree installed to
+          /boot in the target root filesystem.
  # Linux extensions
  source "linux/Config.ext.in <http://Config.ext.in>"
linux/linux.mk renamed from linux/linux.mk <http://linux.mk> +0 -0

<http://linux.mk>
index c4bdf90..8778c35 100644

linux/linux.mk <http://linux.mk> +3 -0
@@ -208,6 +208,12 @@ define LINUX_APPEND_DTB
  endef
  endif
+ifeq ($(BR2_LINUX_DEVICE_TREE_INSTALL_TARGET),y)
+define LINUX_DEVICE_TREE_INSTALL_TARGET
+       install -m 0644 -D

$(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb
$(TARGET_DIR)/boot/$(KERNEL_DTS_NAME).dtb

linux/linux.mk <http://linux.mk> +3 -0
+endef
+endif
+
  # Compilation. We make sure the kernel gets rebuilt when the
  # configuration has changed.
  define LINUX_BUILD_CMDS

linux/linux.mk <http://linux.mk> endef · line 253

Quoted 4 lines
linux/linux.mk <http://linux.mk> +1 -0
@@ -244,6 +250,7 @@ endef
  define LINUX_INSTALL_TARGET_CMDS
         $(LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET)
         $(LINUX_INSTALL_DTB)
+       $(LINUX_DEVICE_TREE_INSTALL_TARGET)

I would call it LINUX_INSTALL_DTB_TO_TARGET, parallel to the
LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET.

Regards,
Arnout

Quoted 3 lines
linux/linux.mk <http://linux.mk> +0 -0
         # Install modules and remove symbolic links pointing to build
         # directories, not relevant on the target
         @if grep -q "CONFIG_MODULES=y" $(@D)/.config; then      \
Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 Add support for dtb file in /boot directory on target

Quoted 2 lines · Arnout Vandecappelle

Could you also resend this patch with git send-email? (See its man
page for how to configure it for gmail.)

Sure thing.

Quoted 2 lines

Perhaps the whitespace is correct and gmail ate it, but just to be sure:
indentation should be one tab.

I assume gmail ate it. I use tabs by default in makefile-ish files.

Quoted 2 lines

Or are there use cases where you want the DTB in /boot, but not the
kernel image?

It seems the logical place for the dtb to live, with the kernel, bit it is possible someone would not want that.
Is there a consensus from the folks on the mailing list about what should be done with the dtb?

Peace,
Gary