* [Buildroot] [PATCHv2] linux: Fix uImage with appended DTs generation
@ 2013-06-07 13:21 Maxime Ripard
2013-06-24 9:34 ` Maxime Ripard
2013-08-01 16:00 ` Thomas Petazzoni
0 siblings, 2 replies; 3+ messages in thread
From: Maxime Ripard @ 2013-06-07 13:21 UTC (permalink / raw)
To: buildroot
Fixes bug #5516 - appended device tree blobs on uImage fails
Before version 3.7 of the kernel, building the zImage and then the
uImage will rewrite the zImage in the process, removing the device tree
we just appended.
Use mkimage to append the device tree to the uImage and rebuild the
headers directly.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
linux/linux.mk | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/linux/linux.mk b/linux/linux.mk
index 57956dd..50fa943 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -106,12 +106,6 @@ ifneq ($(LINUX_KERNEL_UIMAGE_LOADADDR),)
LINUX_MAKE_FLAGS+=LOADADDR="$(LINUX_KERNEL_UIMAGE_LOADADDR)"
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
@@ -229,9 +223,16 @@ define LINUX_APPEND_DTB
fi >> $(KERNEL_ARCH_PATH)/boot/zImage
endef
ifeq ($(BR2_LINUX_KERNEL_APPENDED_UIMAGE),y)
-# We need to generate the uImage here after that so that the uImage is
-# generated with the right image size.
-LINUX_APPEND_DTB += $(sep)$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) uImage
+# We need to generate a new u-boot image that takes into
+# account the extra-size added by the device tree at the end
+# of the image. To do so, we first need to retrieve both load
+# address and entry point for the kernel from the already
+# generate uboot image before using mkimage -l.
+LINUX_APPEND_DTB += $(sep) MKIMAGE_ARGS=`$(HOST_DIR)/usr/bin/mkimage -l $(LINUX_IMAGE_PATH) |\
+ sed -n -e 's/Image Name:[ ]*\(.*\)/-n \1/p' -e 's/Load Address:/-a/p' -e 's/Entry Point:/-e/p'`; \
+ $(HOST_DIR)/usr/bin/mkimage -A $(KERNEL_ARCH) -O linux \
+ -T kernel -C none $${MKIMAGE_ARGS} \
+ -d $(KERNEL_ARCH_PATH)/boot/zImage $(LINUX_IMAGE_PATH);
endif
endif
@@ -240,7 +241,7 @@ endif
define LINUX_BUILD_CMDS
$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) $(KERNEL_ARCH_PATH)/boot/dts/)
- $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_TARGET)
+ $(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
--
1.8.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* [Buildroot] [PATCHv2] linux: Fix uImage with appended DTs generation
2013-06-07 13:21 [Buildroot] [PATCHv2] linux: Fix uImage with appended DTs generation Maxime Ripard
@ 2013-06-24 9:34 ` Maxime Ripard
2013-08-01 16:00 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2013-06-24 9:34 UTC (permalink / raw)
To: buildroot
On Fri, Jun 07, 2013 at 03:21:43PM +0200, Maxime Ripard wrote:
> Fixes bug #5516 - appended device tree blobs on uImage fails
>
> Before version 3.7 of the kernel, building the zImage and then the
> uImage will rewrite the zImage in the process, removing the device tree
> we just appended.
>
> Use mkimage to append the device tree to the uImage and rebuild the
> headers directly.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Ping?
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130624/047e5d23/attachment-0001.asc>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCHv2] linux: Fix uImage with appended DTs generation
2013-06-07 13:21 [Buildroot] [PATCHv2] linux: Fix uImage with appended DTs generation Maxime Ripard
2013-06-24 9:34 ` Maxime Ripard
@ 2013-08-01 16:00 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2013-08-01 16:00 UTC (permalink / raw)
To: buildroot
Dear Maxime Ripard,
On Fri, 7 Jun 2013 15:21:43 +0200, Maxime Ripard wrote:
> Fixes bug #5516 - appended device tree blobs on uImage fails
>
> Before version 3.7 of the kernel, building the zImage and then the
> uImage will rewrite the zImage in the process, removing the device tree
> we just appended.
>
> Use mkimage to append the device tree to the uImage and rebuild the
> headers directly.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> linux/linux.mk | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
Applied, thanks.
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-01 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-07 13:21 [Buildroot] [PATCHv2] linux: Fix uImage with appended DTs generation Maxime Ripard
2013-06-24 9:34 ` Maxime Ripard
2013-08-01 16:00 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox