Skip to contentSkip to conversation

Add some support for device tree kernels with appended trees

PATCH Superseded Maxime Ripard 3 participants 16 messages Jul 3, 2012 – Jul 19, 2012 1 message not in the archive

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add some support for device tree kernels with appended trees

Hi everyone,

This is a refactoring of the previous basic device tree options available for microblaze.

The previous option only made it possible for microblaze targets to give a path to an external device tree, and build a simpleImage with it. This involved using a custom target name as simpleImages are built with the simpleImage.dt_name.
This is also the case on powerpc with cuImages.

This patchset replaces the existing mechanism with a more generic one. First, it allows to build device tree sources to blobs, both taking dts present in the kernel sources and external ones, using a path.

Then, it adds support for kernel images with appended device tree blobs. This option is only for ARM because it is the only architecture I can think of that has such feature.

Finally, it adds the simpleImage and cuImage as regular image variants, with the necessary logic to append the device tree name to use, while doing a bit of code factorisation for u-boot images along the way.

Thanks,
Maxime

#1 lore raw

PATCH 1/4 Rework support for the device tree

---
 linux/Config.in |   46 +++++++++++++++++++++++++++++++++++++++-------
 linux/linux.mk  |   38 +++++++++++++++++++++++---------------
 2 files changed, 62 insertions(+), 22 deletions(-)
linux/Config.in +39 -7
index 4562b1b..6f704b0 100644
@@ -124,14 +124,46 @@ config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
 	help
 	  Path to the kernel configuration file
 
+config BR2_LINUX_KERNEL_DTS_SUPPORT
+	bool "Device tree support"
+	help
+	  Compile a device tree source into a device tree blob.
+	  Select the dts file to compile in the options below.
+
+if BR2_LINUX_KERNEL_DTS_SUPPORT
+
+choice
+	prompt "Device tree source"
+	default BR2_LINUX_KERNEL_USE_DEFAULT_DTS
+
+config BR2_LINUX_KERNEL_USE_DEFAULT_DTS
+	bool "Use a device tree present in the kernel.
+	help
+	   Use a device tree source distributed with
+	   the kernel sources. The dts files are to be
+	   found in the arch/<arch>/boot/dts folder.
+
+config BR2_LINUX_KERNEL_USE_CUSTOM_DTS
+	bool "Use a custom device tree file"
+	help
+	  Use a custom device tree file.
+
+endchoice
+
 config BR2_LINUX_KERNEL_DTS_FILE
-    string "Device Tree dts file location"
-    depends on BR2_microblaze
-    help
-      Path from where the dts file has to be copied
-      The final "custom target" name depends on the
-      dts file name:
-          <name>.dts --> simpleImage.<name>
+	string "DTS name"
+	depends on BR2_LINUX_KERNEL_USE_DEFAULT_DTS
+	help
+	 Name of the default device tree, without the
+	 trailing .dts
+
+config BR2_LINUX_KERNEL_CUSTOM_DTS_FILE
+	string "Device tree file path"
+	depends on BR2_LINUX_KERNEL_USE_CUSTOM_DTS
+	help
+	  Path to the kernel configuration file
+
+endif
 #
 # Binary format
 #
linux/linux.mk +23 -15
index 34f8623..0540aeb 100644
@@ -46,6 +46,12 @@ LINUX_MAKE_FLAGS = \
 # going to be installed in the target filesystem.
 LINUX_VERSION_PROBED = $(shell $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease)
 
+ifeq ($(BR2_LINUX_KERNEL_USE_DEFAULT_DTS),y)
+KERNEL_DTS_NAME = $(BR2_LINUX_KERNEL_DTS_FILE)
+else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),y)
+KERNEL_DTS_NAME = $(basename $(notdir $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE)))
+endif
+
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
 LINUX_IMAGE_NAME=$(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
 else
@@ -117,19 +123,6 @@ endef
 
 LINUX_POST_PATCH_HOOKS += LINUX_APPLY_PATCHES
 
-ifeq ($(KERNEL_ARCH),microblaze)
-# on microblaze, we always want mkimage
-LINUX_DEPENDENCIES+=host-uboot-tools
-
-define LINUX_COPY_DTS
-    if test -f "$(BR2_LINUX_KERNEL_DTS_FILE)" ; then \
-        cp $(BR2_LINUX_KERNEL_DTS_FILE) $(@D)/arch/microblaze/boot/dts ; \
-    else \
-        echo "Cannot copy dts file!" ; \
-    fi
-endef
-endif
-
 ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y)
 KERNEL_SOURCE_CONFIG = $(KERNEL_ARCH_PATH)/configs/$(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig
 else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y)
@@ -143,8 +136,6 @@ define LINUX_CONFIGURE_CMDS
 	$(if $(BR2_ARM_EABI),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_AEABI,$(@D)/.config),
 		$(call KCONFIG_DISABLE_OPT,CONFIG_AEABI,$(@D)/.config))
-    $(if $(BR2_microblaze),
-        $(call LINUX_COPY_DTS))
 	# As the kernel gets compiled before root filesystems are
 	# built, we create a fake cpio file. It'll be
 	# replaced later by the real cpio archive, and the kernel will be
@@ -167,13 +158,23 @@ define LINUX_CONFIGURE_CMDS
 	yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
 endef
 
+ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
+define LINUX_BUILD_DTB
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(KERNEL_DTS_NAME).dtb
+endef
+endif
+
 # Compilation. We make sure the kernel gets rebuilt when the
 # configuration has changed.
 define LINUX_BUILD_CMDS
+	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
+		mkdir $(KERNEL_ARCH_PATH)/boot/dts
+		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE) $(KERNEL_ARCH_PATH)/boot/dts/)
 	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
 	@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then 	\
 		$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ;	\
 	fi
+	$(LINUX_BUILD_DTB)
 endef
 
 
@@ -183,12 +184,19 @@ define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
 endef
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
+define LINUX_INSTALL_DTB
+	cp $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb $(BINARIES_DIR)/
+endef
+endif
+
 define LINUX_INSTALL_IMAGES_CMDS
 	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
 endef
 
 define LINUX_INSTALL_TARGET_CMDS
 	$(LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET)
+	$(LINUX_INSTALL_DTB)
 	# 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 · 1 line
1.7.9.5
#2 lore raw

PATCH 1/4 Rework support for the device tree

Quoted 11 lines · Maxime Ripard
---
  linux/Config.in |   46 +++++++++++++++++++++++++++++++++++++++-------
  linux/linux.mk  |   38 +++++++++++++++++++++++---------------
  2 files changed, 62 insertions(+), 22 deletions(-)
linux/Config.in +0 -0
index 4562b1b..6f704b0 100644

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 133

Quoted 10 lines
linux/Config.in +7 -0
@@ -124,14 +124,46 @@ config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
  	help
  	  Path to the kernel configuration file
 
+config BR2_LINUX_KERNEL_DTS_SUPPORT
+	bool "Device tree support"
+	help
+	  Compile a device tree source into a device tree blob.
+	  Select the dts file to compile in the options below.
+
+if BR2_LINUX_KERNEL_DTS_SUPPORT

Maybe it's better to remove this option, and instead just
detect if BR2_LINUX_KERNEL_DTS_FILE is defined. Or would that make things more confusing?

[snip]

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 144

Quoted 11 lines
linux/Config.in +8 -0
+ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
+define LINUX_BUILD_DTB
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(KERNEL_DTS_NAME).dtb
+endef
+endif
+
  # Compilation. We make sure the kernel gets rebuilt when the
  # configuration has changed.
  define LINUX_BUILD_CMDS
+	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
+		mkdir $(KERNEL_ARCH_PATH)/boot/dts

Should be mkdir -p

Quoted 10 lines
linux/Config.in +2 -0
+		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE) $(KERNEL_ARCH_PATH)/boot/dts/)
  	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
  	@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then 	\
  		$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ;	\
  	fi
+	$(LINUX_BUILD_DTB)
  endef
 
 

linux/Config.in define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET · line 190

Quoted 7 lines
linux/Config.in +4 -0
@@ -183,12 +184,19 @@ define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
  endef
  endif
 
+ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
+define LINUX_INSTALL_DTB
+	cp $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb $(BINARIES_DIR)/
+endef

I would move this definition to the same place as LINUX_BUILD_DTB.

Regards,
Arnout

Quoted 12 lines
linux/Config.in +3 -0
+endif
+
  define LINUX_INSTALL_IMAGES_CMDS
  	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
  endef
 
  define LINUX_INSTALL_TARGET_CMDS
  	$(LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET)
+	$(LINUX_INSTALL_DTB)
  	# 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
#3 lore raw

PATCH 1/4 Rework support for the device tree

Quoted 11 lines · Arnout Vandecappelle

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 133

Quoted 7 lines
linux/Config.in +7 -0
+config BR2_LINUX_KERNEL_DTS_SUPPORT
+    bool "Device tree support"
+    help
+      Compile a device tree source into a device tree blob.
+      Select the dts file to compile in the options below.
+
+if BR2_LINUX_KERNEL_DTS_SUPPORT

Maybe it's better to remove this option, and instead just
detect if BR2_LINUX_KERNEL_DTS_FILE is defined. Or would that make things more confusing?

Forget it, it would make the later patches unnecessarily complex.

Regards,
Arnout

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
#4 lore raw

PATCH 1/4 Rework support for the device tree

In reply to Maxime Ripard

Le Tue, 3 Jul 2012 12:01:13 +0200,
Maxime Ripard <[email protected]> a ?crit :

Quoted 17 lines
---
 linux/Config.in |   46 +++++++++++++++++++++++++++++++++++++++-------
 linux/linux.mk  |   38 +++++++++++++++++++++++---------------
 2 files changed, 62 insertions(+), 22 deletions(-)
linux/Config.in +3 -0
index 4562b1b..6f704b0 100644
@@ -124,14 +124,46 @@ config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
 	help
 	  Path to the kernel configuration file
 
+config BR2_LINUX_KERNEL_DTS_SUPPORT
+	bool "Device tree support"
+	help

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 139

Quoted 10 lines
linux/Config.in +10 -0
+	  Compile a device tree source into a device tree blob.
+	  Select the dts file to compile in the options below.
+
+if BR2_LINUX_KERNEL_DTS_SUPPORT
+
+choice
+	prompt "Device tree source"
+	default BR2_LINUX_KERNEL_USE_DEFAULT_DTS
+
+config BR2_LINUX_KERNEL_USE_DEFAULT_DTS

I don't really like "USE_DEFAULT_DTS", it isn't really a "default" device tree. What about BR2_LINUX_KERNEL_USE_INTREE_DTS or something like that?

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 140

Quoted 1 line
linux/Config.in +1 -0
+	bool "Use a device tree present in the kernel.

Missing " at the end of the line, and the final "." shouldn't be there.

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 144

Quoted 4 lines
linux/Config.in +4 -0
+	help
+	   Use a device tree source distributed with
+	   the kernel sources. The dts files are to be
+	   found in the arch/<arch>/boot/dts folder.

"are to be found" -> "are located" ?

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 149

Quoted 4 lines
linux/Config.in +4 -0
+config BR2_LINUX_KERNEL_USE_CUSTOM_DTS
+	bool "Use a custom device tree file"
+	help
+	  Use a custom device tree file.

"i.e, a device tree file that does not belong to the kernel source tree."

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 154

Quoted 12 lines
linux/Config.in +4 -7
+
+endchoice
+
 config BR2_LINUX_KERNEL_DTS_FILE
-    string "Device Tree dts file location"
-    depends on BR2_microblaze
-    help
-      Path from where the dts file has to be copied
-      The final "custom target" name depends on the
-      dts file name:
-          <name>.dts --> simpleImage.<name>
+	string "DTS name"

string "Device Tree Source file name" ?

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 161

Quoted 7 lines
linux/Config.in +7 -0
+	depends on BR2_LINUX_KERNEL_USE_DEFAULT_DTS
+	help
+	 Name of the default device tree, without the
+	 trailing .dts
+
+config BR2_LINUX_KERNEL_CUSTOM_DTS_FILE
+	string "Device tree file path"

string "Device Tree Source file path" ?

or at least be consistent in the naming, either DTS everywhere, or Device Tree Source everywhere.

Quoted 59 lines
linux/Config.in +5 -0
+	depends on BR2_LINUX_KERNEL_USE_CUSTOM_DTS
+	help
+	  Path to the kernel configuration file
+
+endif
 #
 # Binary format
 #
linux/linux.mk +7 -15
index 34f8623..0540aeb 100644
@@ -46,6 +46,12 @@ LINUX_MAKE_FLAGS = \
 # going to be installed in the target filesystem.
 LINUX_VERSION_PROBED = $(shell $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease)
 
+ifeq ($(BR2_LINUX_KERNEL_USE_DEFAULT_DTS),y)
+KERNEL_DTS_NAME = $(BR2_LINUX_KERNEL_DTS_FILE)
+else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),y)
+KERNEL_DTS_NAME = $(basename $(notdir $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE)))
+endif
+
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
 LINUX_IMAGE_NAME=$(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
 else
@@ -117,19 +123,6 @@ endef
 
 LINUX_POST_PATCH_HOOKS += LINUX_APPLY_PATCHES
 
-ifeq ($(KERNEL_ARCH),microblaze)
-# on microblaze, we always want mkimage
-LINUX_DEPENDENCIES+=host-uboot-tools
-
-define LINUX_COPY_DTS
-    if test -f "$(BR2_LINUX_KERNEL_DTS_FILE)" ; then \
-        cp $(BR2_LINUX_KERNEL_DTS_FILE) $(@D)/arch/microblaze/boot/dts ; \
-    else \
-        echo "Cannot copy dts file!" ; \
-    fi
-endef
-endif
-
 ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y)
 KERNEL_SOURCE_CONFIG = $(KERNEL_ARCH_PATH)/configs/$(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig
 else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y)
@@ -143,8 +136,6 @@ define LINUX_CONFIGURE_CMDS
 	$(if $(BR2_ARM_EABI),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_AEABI,$(@D)/.config),
 		$(call KCONFIG_DISABLE_OPT,CONFIG_AEABI,$(@D)/.config))
-    $(if $(BR2_microblaze),
-        $(call LINUX_COPY_DTS))
 	# As the kernel gets compiled before root filesystems are
 	# built, we create a fake cpio file. It'll be
 	# replaced later by the real cpio archive, and the kernel will be
@@ -167,13 +158,23 @@ define LINUX_CONFIGURE_CMDS
 	yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
 endef
 
+ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)

linux/linux.mk define LINUX_CONFIGURE_CMDS · line 171

Quoted 10 lines
linux/linux.mk +7 -0
+define LINUX_BUILD_DTB
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(KERNEL_DTS_NAME).dtb
+endef
+endif
+
 # Compilation. We make sure the kernel gets rebuilt when the
 # configuration has changed.
 define LINUX_BUILD_CMDS
+	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
+		mkdir $(KERNEL_ARCH_PATH)/boot/dts

Do you really need to create the directory here? I would suspect that all arches supporting the Device Tree already have their boot/dts/ directory, no?

Quoted 10 lines
linux/linux.mk +2 -0
+		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE) $(KERNEL_ARCH_PATH)/boot/dts/)
 	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
 	@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then 	\
 		$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ;	\
 	fi
+	$(LINUX_BUILD_DTB)
 endef
 
 

linux/linux.mk define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET · line 189

Quoted 6 lines
linux/linux.mk +3 -0
@@ -183,12 +184,19 @@ define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
 endef
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
+define LINUX_INSTALL_DTB
+	cp $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb $(BINARIES_DIR)/

Hum, here when I do a make foobar.dtb, the foobar.dtb file ends up in the main kernel source tree, not in arch/arm/boot/.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH 1/4 Rework support for the device tree

Le Wed, 18 Jul 2012 18:36:17 +0200,
Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 8 lines
Quoted 3 lines

Do you really need to create the directory here? I would suspect that all arches supporting the Device Tree already have their boot/dts/ directory, no?

Nope. For instance in 3.0 there was preliminary DTS support for ARM,
but no arch/arm/boot/dts directory. That said, I'm not entirely sure if the foo.dtb target would even work, because I don't see a rule for producing it for arm in 3.0...

Realistically, the ARM DT support was so limited (in number of platforms supported) in 3.0 that I don't think it's worth the effort. I think we can safely assume that for all practical cases, arch/<ARCH>/boot/dts exists.

Quoted 3 lines
Quoted 2 lines

Hum, here when I do a make foobar.dtb, the foobar.dtb file ends up in the main kernel source tree, not in arch/arm/boot/.

That's strange... For which architecture and kernel version?

That's just complete crap from my side. I got confused by the big command line I typically use to build the kernel and concatenate the DTB. The DTB indeed ends up in arch/arm/boot and Maxime's code is correct in that respect.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#7 lore raw

PATCH 2/4 Add support for appended device tree blobs for arm

In reply to Maxime Ripard
---
 linux/Config.in |    8 ++++++++
 linux/linux.mk  |   38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletion(-)
linux/Config.in +8 -0
index 6f704b0..46b9756 100644
@@ -132,6 +132,14 @@ config BR2_LINUX_KERNEL_DTS_SUPPORT
 
 if BR2_LINUX_KERNEL_DTS_SUPPORT
 
+config BR2_LINUX_KERNEL_APPENDED_DTB
+	bool "Append the Device Tree binary to the kernel"
+	depends on BR2_arm || BR2_armeb
+	help
+	  After building the device tree blob, append it to the
+	  kernel image. If necessary generates a uImage from that
+	  new kernel image afterward.
+
 choice
 	prompt "Device tree source"
 	default BR2_LINUX_KERNEL_USE_DEFAULT_DTS
linux/linux.mk +37 -1
index 0540aeb..483974c 100644
@@ -52,6 +52,13 @@ else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),y)
 KERNEL_DTS_NAME = $(basename $(notdir $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE)))
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+ifneq ($(words $(KERNEL_DTS_NAME)),1)
+$(error Kernel with appended device tree needs exactly one DTS source.\
+  Check BR2_LINUX_KERNEL_DTS_FILE or BR2_LINUX_KERNEL_CUSTOM_DTS_FILE.)
+endif
+endif
+
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
 LINUX_IMAGE_NAME=$(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
 else
@@ -76,6 +83,12 @@ LINUX_IMAGE_NAME=vmlinuz
 endif
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+LINUX_IMAGE_TARGET=zImage
+else
+LINUX_IMAGE_TARGET=$(LINUX_IMAGE_NAME)
+endif
+
 # Compute the arch path, since i386 and x86_64 are in arch/x86 and not
 # in arch/$(KERNEL_ARCH). Even if the kernel creates symbolic links
 # for bzImage, arch/i386 and arch/x86_64 do not exist when copying the
@@ -155,6 +168,8 @@ define LINUX_CONFIGURE_CMDS
 		$(call KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$(@D)/.config))
 	$(if $(BR2_PACKAGE_SYSTEMD),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config))
+	$(if $(BR2_LINUX_KERNEL_APPENDED_DTB),
+		$(call KCONFIG_ENABLE_OPT,CONFIG_ARM_APPENDED_DTB,$(@D)/.config))
 	yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
 endef
 
@@ -164,17 +179,38 @@ define LINUX_BUILD_DTB
 endef
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y)
+define LINUX_APPEND_DTB
+	cat $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb > $(KERNEL_ARCH_PATH)/boot/zImage_dtb
+	mv $(KERNEL_ARCH_PATH)/boot/zImage_dtb $(KERNEL_ARCH_PATH)/boot/zImage
+	LOAD=`$(MKIMAGE) -l $(LINUX_IMAGE_PATH) | sed -n 's/Load Address: \([0-9]*\)/\1/p'`; \
+	ENTRY=`$(MKIMAGE) -l $(LINUX_IMAGE_PATH) | sed -n 's/Entry Point: \([0-9]*\)/\1/p'`; \
+	$(MKIMAGE) -A $(KERNEL_ARCH) -O linux -T kernel -C none -a $${LOAD} -e $${ENTRY} -n 'Linux Buildroot' \
+		-d $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)
+endef
+else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y)
+define LINUX_APPEND_DTB
+	cat $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb > $(KERNEL_ARCH_PATH)/boot/zImage_dtb
+	mv $(KERNEL_ARCH_PATH)/boot/zImage_dtb $(KERNEL_ARCH_PATH)/boot/zImage
+endef
+else
+$(error Appending DTB to the kernel image is only possible for u-boot images and zImage.)
+endif
+endif
+
 # Compilation. We make sure the kernel gets rebuilt when the
 # configuration has changed.
 define LINUX_BUILD_CMDS
 	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
 		mkdir $(KERNEL_ARCH_PATH)/boot/dts
 		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE) $(KERNEL_ARCH_PATH)/boot/dts/)
-	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_TARGET)
 	@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then 	\
 		$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ;	\
 	fi
 	$(LINUX_BUILD_DTB)
+	$(LINUX_APPEND_DTB)
 endef
 
 
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 2/4 Add support for appended device tree blobs for arm

Quoted 11 lines · Maxime Ripard
---
  linux/Config.in |    8 ++++++++
  linux/linux.mk  |   38 +++++++++++++++++++++++++++++++++++++-
  2 files changed, 45 insertions(+), 1 deletion(-)
linux/Config.in +0 -0
index 6f704b0..46b9756 100644

linux/Config.in config BR2_LINUX_KERNEL_DTS_SUPPORT · line 137

Quoted 6 lines
linux/Config.in +3 -0
@@ -132,6 +132,14 @@ config BR2_LINUX_KERNEL_DTS_SUPPORT
 
  if BR2_LINUX_KERNEL_DTS_SUPPORT
 
+config BR2_LINUX_KERNEL_APPENDED_DTB
+	bool "Append the Device Tree binary to the kernel"
+	depends on BR2_arm || BR2_armeb

From the code below, it looks like this also

	depends on BR2_LINUX_KERNEL_UBOOT_IMAGE || BR2_LINUX_KERNEL_ZIMAGE
Quoted 59 lines
linux/Config.in +5 -0
+	help
+	  After building the device tree blob, append it to the
+	  kernel image. If necessary generates a uImage from that
+	  new kernel image afterward.
+
  choice
  	prompt "Device tree source"
  	default BR2_LINUX_KERNEL_USE_DEFAULT_DTS
linux/linux.mk +22 -0
index 0540aeb..483974c 100644
@@ -52,6 +52,13 @@ else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),y)
  KERNEL_DTS_NAME = $(basename $(notdir $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE)))
  endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+ifneq ($(words $(KERNEL_DTS_NAME)),1)
+$(error Kernel with appended device tree needs exactly one DTS source.\
+  Check BR2_LINUX_KERNEL_DTS_FILE or BR2_LINUX_KERNEL_CUSTOM_DTS_FILE.)
+endif
+endif
+
  ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
  LINUX_IMAGE_NAME=$(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
  else
@@ -76,6 +83,12 @@ LINUX_IMAGE_NAME=vmlinuz
  endif
  endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+LINUX_IMAGE_TARGET=zImage
+else
+LINUX_IMAGE_TARGET=$(LINUX_IMAGE_NAME)
+endif
+
  # Compute the arch path, since i386 and x86_64 are in arch/x86 and not
  # in arch/$(KERNEL_ARCH). Even if the kernel creates symbolic links
  # for bzImage, arch/i386 and arch/x86_64 do not exist when copying the
@@ -155,6 +168,8 @@ define LINUX_CONFIGURE_CMDS
  		$(call KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$(@D)/.config))
  	$(if $(BR2_PACKAGE_SYSTEMD),
  		$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config))
+	$(if $(BR2_LINUX_KERNEL_APPENDED_DTB),
+		$(call KCONFIG_ENABLE_OPT,CONFIG_ARM_APPENDED_DTB,$(@D)/.config))
  	yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
  endef
 
@@ -164,17 +179,38 @@ define LINUX_BUILD_DTB
  endef
  endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y)
+define LINUX_APPEND_DTB
+	cat $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb>  $(KERNEL_ARCH_PATH)/boot/zImage_dtb
+	mv $(KERNEL_ARCH_PATH)/boot/zImage_dtb $(KERNEL_ARCH_PATH)/boot/zImage
+	LOAD=`$(MKIMAGE) -l $(LINUX_IMAGE_PATH) | sed -n 's/Load Address: \([0-9]*\)/\1/p'`; \
+	ENTRY=`$(MKIMAGE) -l $(LINUX_IMAGE_PATH) | sed -n 's/Entry Point: \([0-9]*\)/\1/p'`; \

linux/linux.mk define LINUX_BUILD_DTB · line 198

Quoted 10 lines
linux/linux.mk +10 -0
+	$(MKIMAGE) -A $(KERNEL_ARCH) -O linux -T kernel -C none -a $${LOAD} -e $${ENTRY} -n 'Linux Buildroot' \
+		-d $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)
+endef
+else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y)
+define LINUX_APPEND_DTB
+	cat $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb>  $(KERNEL_ARCH_PATH)/boot/zImage_dtb
+	mv $(KERNEL_ARCH_PATH)/boot/zImage_dtb $(KERNEL_ARCH_PATH)/boot/zImage
+endef
+else
+$(error Appending DTB to the kernel image is only possible for u-boot images and zImage.)

This is unnecessary with the Config.in change I proposed.

Quoted 19 lines
linux/linux.mk +5 -1
+endif
+endif
+
  # Compilation. We make sure the kernel gets rebuilt when the
  # configuration has changed.
  define LINUX_BUILD_CMDS
  	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
  		mkdir $(KERNEL_ARCH_PATH)/boot/dts
  		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE) $(KERNEL_ARCH_PATH)/boot/dts/)
-	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_TARGET)
  	@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then 	\
  		$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ;	\
  	fi
  	$(LINUX_BUILD_DTB)
+	$(LINUX_APPEND_DTB)
  endef
 
 
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
#9 lore raw

PATCH 2/4 Add support for appended device tree blobs for arm

In reply to Maxime Ripard

Le Tue, 3 Jul 2012 12:01:14 +0200,
Maxime Ripard <[email protected]> a ?crit :

Quoted 11 lines
---
 linux/Config.in |    8 ++++++++
 linux/linux.mk  |   38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletion(-)
linux/Config.in +0 -0
index 6f704b0..46b9756 100644

linux/Config.in config BR2_LINUX_KERNEL_DTS_SUPPORT · line 136

Quoted 5 lines
linux/Config.in +2 -0
@@ -132,6 +132,14 @@ config BR2_LINUX_KERNEL_DTS_SUPPORT
 
 if BR2_LINUX_KERNEL_DTS_SUPPORT
 
+config BR2_LINUX_KERNEL_APPENDED_DTB
+	bool "Append the Device Tree binary to the kernel"

Blob

linux/Config.in config BR2_LINUX_KERNEL_DTS_SUPPORT · line 141

Quoted 5 lines
linux/Config.in +5 -0
+	depends on BR2_arm || BR2_armeb
+	help
+	  After building the device tree blob, append it to the
+	  kernel image. If necessary generates a uImage from that
+	  new kernel image afterward.

This should rather be *after* the Device Tree Source choice and selection, in my opinion. It would be more logical: (1) what I include,
(2) how I include it.

Quoted 54 lines
linux/Config.in +0 -0
 choice
 	prompt "Device tree source"
 	default BR2_LINUX_KERNEL_USE_DEFAULT_DTS
linux/linux.mk +22 -0
index 0540aeb..483974c 100644
@@ -52,6 +52,13 @@ else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),y)
 KERNEL_DTS_NAME = $(basename $(notdir $(BR2_LINUX_KERNEL_CUSTOM_DTS_FILE)))
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+ifneq ($(words $(KERNEL_DTS_NAME)),1)
+$(error Kernel with appended device tree needs exactly one DTS source.\
+  Check BR2_LINUX_KERNEL_DTS_FILE or BR2_LINUX_KERNEL_CUSTOM_DTS_FILE.)
+endif
+endif
+
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
 LINUX_IMAGE_NAME=$(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
 else
@@ -76,6 +83,12 @@ LINUX_IMAGE_NAME=vmlinuz
 endif
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+LINUX_IMAGE_TARGET=zImage
+else
+LINUX_IMAGE_TARGET=$(LINUX_IMAGE_NAME)
+endif
+
 # Compute the arch path, since i386 and x86_64 are in arch/x86 and not
 # in arch/$(KERNEL_ARCH). Even if the kernel creates symbolic links
 # for bzImage, arch/i386 and arch/x86_64 do not exist when copying the
@@ -155,6 +168,8 @@ define LINUX_CONFIGURE_CMDS
 		$(call KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$(@D)/.config))
 	$(if $(BR2_PACKAGE_SYSTEMD),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config))
+	$(if $(BR2_LINUX_KERNEL_APPENDED_DTB),
+		$(call KCONFIG_ENABLE_OPT,CONFIG_ARM_APPENDED_DTB,$(@D)/.config))
 	yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
 endef
 
@@ -164,17 +179,38 @@ define LINUX_BUILD_DTB
 endef
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
+ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y)
+define LINUX_APPEND_DTB
+	cat $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb > $(KERNEL_ARCH_PATH)/boot/zImage_dtb
+	mv $(KERNEL_ARCH_PATH)/boot/zImage_dtb $(KERNEL_ARCH_PATH)/boot/zImage
+	LOAD=`$(MKIMAGE) -l $(LINUX_IMAGE_PATH) | sed -n 's/Load Address: \([0-9]*\)/\1/p'`; \
+	ENTRY=`$(MKIMAGE) -l $(LINUX_IMAGE_PATH) | sed -n 's/Entry Point: \([0-9]*\)/\1/p'`; \

linux/linux.mk define LINUX_BUILD_DTB · line 198

Quoted 10 lines
linux/linux.mk +10 -0
+	$(MKIMAGE) -A $(KERNEL_ARCH) -O linux -T kernel -C none -a $${LOAD} -e $${ENTRY} -n 'Linux Buildroot' \
+		-d $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(LINUX_IMAGE_NAME)
+endef
+else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y)
+define LINUX_APPEND_DTB
+	cat $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb > $(KERNEL_ARCH_PATH)/boot/zImage_dtb
+	mv $(KERNEL_ARCH_PATH)/boot/zImage_dtb $(KERNEL_ARCH_PATH)/boot/zImage
+endef
+else
+$(error Appending DTB to the kernel image is only possible for u-boot images and zImage.)

Can't this be verified at the Kconfig level instead.

linux/linux.mk define LINUX_BUILD_DTB · line 200

Quoted 2 lines
linux/linux.mk +2 -0
+endif
+endif

A big comment on top of this mkimage magic would be necessary.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#10 lore raw

PATCH 2/4 Add support for appended device tree blobs for arm

In reply to Maxime Ripard

Le Tue, 3 Jul 2012 12:01:14 +0200,
Maxime Ripard <[email protected]> a ?crit :

linux/Config.in config BR2_LINUX_KERNEL_DTS_SUPPORT · line 141

Quoted 7 lines
linux/Config.in +7 -0
+config BR2_LINUX_KERNEL_APPENDED_DTB
+	bool "Append the Device Tree binary to the kernel"
+	depends on BR2_arm || BR2_armeb
+	help
+	  After building the device tree blob, append it to the
+	  kernel image. If necessary generates a uImage from that
+	  new kernel image afterward.

Just got another idea here. Since cuImage and simpleImage on PowerPC and Microblaze bundle their DTB, can't we define the Appended DTB feature as an additional kernel image type?

I.e, on ARM, you would typically have:

zImage
zImage + appended DTB
uImage
uImage + appended DTB

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#11 lore raw

PATCH 3/4 Factorise the u-boot images code

In reply to Maxime Ripard
---
 linux/Config.in |    4 ++++
 linux/linux.mk  |    5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
linux/Config.in +4 -0
index 46b9756..c5488e8 100644
@@ -176,12 +176,16 @@ endif
 # Binary format
 #
 
+config BR2_LINUX_KERNEL_UBOOT_IMAGE
+       bool
+
 choice
 	prompt "Kernel binary format"
 
 config BR2_LINUX_KERNEL_UIMAGE
 	bool "uImage"
 	depends on BR2_arm || BR2_armeb || BR2_bfin || BR2_powerpc || BR2_avr32 || BR2_sh || BR2_sh64
+	select BR2_LINUX_KERNEL_UBOOT_IMAGE
 
 config BR2_LINUX_KERNEL_BZIMAGE
 	bool "bzImage"
linux/linux.mk +4 -1
index 483974c..8517d2f 100644
@@ -34,6 +34,10 @@ LINUX_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH))
 LINUX_INSTALL_IMAGES = YES
 LINUX_DEPENDENCIES  += host-module-init-tools
 
+ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y)
+	LINUX_DEPENDENCIES+=host-uboot-tools
+endif
+
 LINUX_MAKE_FLAGS = \
 	HOSTCC="$(HOSTCC)" \
 	HOSTCFLAGS="$(HOSTCFLAGS)" \
@@ -69,7 +73,6 @@ LINUX_IMAGE_NAME=vmImage
 else
 LINUX_IMAGE_NAME=uImage
 endif
-LINUX_DEPENDENCIES+=host-uboot-tools
 else ifeq ($(BR2_LINUX_KERNEL_BZIMAGE),y)
 LINUX_IMAGE_NAME=bzImage
 else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y)
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 3/4 Factorise the u-boot images code

Quoted 1 line · Maxime Ripard
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
#13 lore raw

PATCH 3/4 Factorise the u-boot images code

In reply to Maxime Ripard

Le Tue, 3 Jul 2012 12:01:15 +0200,
Maxime Ripard <[email protected]> a ?crit :

Quoted 11 lines
---
 linux/Config.in |    4 ++++
 linux/linux.mk  |    5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
linux/Config.in +0 -0
index 46b9756..c5488e8 100644

linux/Config.in endif · line 180

Quoted 5 lines
linux/Config.in +2 -0
@@ -176,12 +176,16 @@ endif
 # Binary format
 #
 
+config BR2_LINUX_KERNEL_UBOOT_IMAGE
+       bool

Maybe this should rather be BR2_LINUX_KERNEL_NEEDS_MKIMAGE ?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#14 lore raw

PATCH 4/4 Add cuImage(powerpc) and simpleImage(microblaze) as Linux kernel images variants

In reply to Maxime Ripard
---
 linux/Config.in |   12 ++++++++++++
 linux/linux.mk  |    4 ++++
 2 files changed, 16 insertions(+)
linux/Config.in +12 -0
index c5488e8..80870ab 100644
@@ -195,6 +195,18 @@ config BR2_LINUX_KERNEL_ZIMAGE
 	bool "zImage"
 	depends on BR2_arm || BR2_armeb || BR2_powerpc || BR2_sparc || BR2_sh || BR2_sh64 || BR2_xtensa
 
+config BR2_LINUX_KERNEL_CUIMAGE
+	bool "cuImage"
+	depends on BR2_powerpc
+	select BR2_LINUX_KERNEL_UBOOT_IMAGE
+	select BR2_LINUX_KERNEL_DTS_SUPPORT
+
+config BR2_LINUX_KERNEL_SIMPLEIMAGE
+	bool "simpleImage"
+	depends on BR2_microblaze
+	select BR2_LINUX_KERNEL_UBOOT_IMAGE
+	select BR2_LINUX_KERNEL_DTS_SUPPORT
+
 config BR2_LINUX_KERNEL_VMLINUX_BIN
 	bool "vmlinux.bin"
 	depends on BR2_mips || BR2_mipsel || BR2_sh || BR2_sh64
linux/linux.mk +4 -0
index 8517d2f..687c1a9 100644
@@ -77,6 +77,10 @@ else ifeq ($(BR2_LINUX_KERNEL_BZIMAGE),y)
 LINUX_IMAGE_NAME=bzImage
 else ifeq ($(BR2_LINUX_KERNEL_ZIMAGE),y)
 LINUX_IMAGE_NAME=zImage
+else ifeq ($(BR2_LINUX_KERNEL_CUIMAGE),y)
+LINUX_IMAGE_NAME=cuImage.$(KERNEL_DTS_NAME)
+else ifeq ($(BR2_LINUX_KERNEL_SIMPLEIMAGE),y)
+LINUX_IMAGE_NAME=simpleImage.$(KERNEL_DTS_NAME)
 else ifeq ($(BR2_LINUX_KERNEL_VMLINUX_BIN),y)
 LINUX_IMAGE_NAME=vmlinux.bin
 else ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y)
Signature · 1 line
1.7.9.5
#15 lore raw

PATCH 4/4 Add cuImage(powerpc) and simpleImage(microblaze) as Linux kernel images variants

Quoted 1 line · Maxime Ripard

Note: untested

Note: depends on the other DTS patches, which I didn't ACK.

Regards,
Arnout

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
#16 lore raw

PATCH v2 1/1 Add some support for device tree kernels with appended trees

In reply to Maxime Ripard

Le Tue, 3 Jul 2012 12:01:12 +0200,
Maxime Ripard <[email protected]> a ?crit :

Quoted 13 lines

This is a refactoring of the previous basic device tree options available for microblaze.

The previous option only made it possible for microblaze targets to give a path to an external device tree, and build a simpleImage with it. This involved using a custom target name as simpleImages are built with the simpleImage.dt_name.
This is also the case on powerpc with cuImages.

This patchset replaces the existing mechanism with a more generic one. First, it allows to build device tree sources to blobs, both taking dts present in the kernel sources and external ones, using a path.

Quoted 7 lines

Then, it adds support for kernel images with appended device tree blobs. This option is only for ARM because it is the only architecture I can think of that has such feature.

Finally, it adds the simpleImage and cuImage as regular image variants, with the necessary logic to append the device tree name to use, while doing a bit of code factorisation for u-boot images along the way.

Thanks, I globally like this and find this much better than the microblaze specific handling we had before. However, could you migrate this nice cover letter description into the appropriate commit logs? Your commit logs are really short and do not describe what the commit is doing, but the commit logs is what is staying in the project history, so this is where all the attention should be put, rather than to the cover letter.

I'll reply to the individual patches for details.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com