All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: buildroot@busybox.net
Subject: [Buildroot] [1/1] linux: avoid multiple dtb append on uImages
Date: Sun, 30 Aug 2015 11:30:29 +0300	[thread overview]
Message-ID: <20150830083029.GC17874@tarshish> (raw)
In-Reply-To: <1440823702-13736-1-git-send-email-derosier@gmail.com>

Hi Steve,

On Fri, Aug 28, 2015 at 09:48:22PM -0700, Steve deRosier wrote:
> From: Steve deRosier <steve.derosier@lairdtech.com>
> 
> If using appended dtbs on uImages, a 'make linux-rebuild' will end up just
> adding the new dtb after the previous dtb if all you did was modify the
> device tree without a modification that would regenerate the zImage. This
> results in a surprising effect when you boot your device: your DT changes
> don't take effect because linux just loads the first dtb.
> 
> This patch fixes this little edge case by using an intermediate file for the
> append work if using BR2_LINUX_KERNEL_APPEND_UIMAGE. Otherwise it must
> retain the zImage naming, so the situation is unchanged for the case where
> this flag is not set.

See http://patchwork.ozlabs.org/patch/394002/ (our oldest patchwork entry) for 
a different, arguably simpler, approach.

baruch

> Signed-off-by: Steve deRosier <steve.derosier@lairdtech.com>
> ---
>  linux/linux.mk |   17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 48f9c74..d4252e3 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -245,14 +245,23 @@ endif
>  endif
>  
>  ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
> -# dtbs moved from arch/$ARCH/boot to arch/$ARCH/boot/dts since 3.8-rc1
> +# If we append and create the uImage, we want to be sure not to multiple-append on
> +# rebuilds, so use a temporary intermediate "zImage-dtb" and then append, but if we
> +# don't use the APPENDED_UIMAGE option, we need to be sure it stays named as zImage.
> +IMAGE_PLUS_DTB = zImage
> +ifeq ($(BR2_LINUX_KERNEL_APPENDED_UIMAGE),y)
> +	IMAGE_PLUS_DTB = zImage-dtb
>  define LINUX_APPEND_DTB
> +	cp $(KERNEL_ARCH_PATH)/boot/zImage $(KERNEL_ARCH_PATH)/boot/$(IMAGE_PLUS_DTB);
> +endef
> +endif
> +# dtbs moved from arch/$ARCH/boot to arch/$ARCH/boot/dts since 3.8-rc1
> +LINUX_APPEND_DTB += \
>  	if [ -e $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb ]; then \
>  		cat $(KERNEL_ARCH_PATH)/boot/$(KERNEL_DTS_NAME).dtb; \
>  	else \
>  		cat $(KERNEL_ARCH_PATH)/boot/dts/$(KERNEL_DTS_NAME).dtb; \
> -	fi >> $(KERNEL_ARCH_PATH)/boot/zImage
> -endef
> +	fi >> $(KERNEL_ARCH_PATH)/boot/$(IMAGE_PLUS_DTB)
>  ifeq ($(BR2_LINUX_KERNEL_APPENDED_UIMAGE),y)
>  # We need to generate a new u-boot image that takes into
>  # account the extra-size added by the device tree at the end
> @@ -263,7 +272,7 @@ LINUX_APPEND_DTB += $(sep) MKIMAGE_ARGS=`$(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'`; \
>  	$(MKIMAGE) -A $(MKIMAGE_ARCH) -O linux \
>  	-T kernel -C none $${MKIMAGE_ARGS} \
> -	-d $(KERNEL_ARCH_PATH)/boot/zImage $(LINUX_IMAGE_PATH);
> +	-d $(KERNEL_ARCH_PATH)/boot/$(IMAGE_PLUS_DTB) $(LINUX_IMAGE_PATH);
>  endif
>  endif

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

  reply	other threads:[~2015-08-30  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29  4:48 [Buildroot] [PATCH 1/1] linux: avoid multiple dtb append on uImages derosier at gmail.com
2015-08-30  8:30 ` Baruch Siach [this message]
2015-08-31 16:48   ` [Buildroot] [1/1] " Steve deRosier
2015-12-22 22:06 ` [Buildroot] [PATCH 1/1] " Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150830083029.GC17874@tarshish \
    --to=baruch@tkos.co.il \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.