public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* uImage with integrated dtb file
@ 2012-03-24 23:48 Roland Stigge
  2012-03-25  6:21 ` Dirk Behme
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Roland Stigge @ 2012-03-24 23:48 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

since I will need to maintain some machines with DT enabled kernels but 
containing a U-Boot without DT support, I sometimes need to integrate a 
dtb file into uImage.

I'm sure others have got the same issue. But searching for a while I 
only got older/meanwhile neglected approaches like:

git://kernel.ubuntu.com/jk/dt/linux-2.6.git - branch: dtbimage

I'm currently using a simple hack like attached below.

Wondering what others are doing.

Sorry if this topic has already been discussed.

Roland


--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -70,9 +70,11 @@ $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
 clean-files := *.dtb
 
 quiet_cmd_uimage = UIMAGE  $@
-      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
+      cmd_uimage = cat $< arch/arm/boot/*.dtb > $<.tmp ; \
+                  $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
                   -C none -a $(LOADADDR) -e $(STARTADDR) \
-                  -n 'Linux-$(KERNELRELEASE)' -d $< $@
+                  -n 'Linux-$(KERNELRELEASE)' -d $<.tmp $@ ; \
+                  rm -f $<.tmp
 
 ifeq ($(CONFIG_ZBOOT_ROM),y)
 $(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* uImage with integrated dtb file
  2012-03-24 23:48 uImage with integrated dtb file Roland Stigge
@ 2012-03-25  6:21 ` Dirk Behme
  2012-03-25 11:48 ` Thierry Reding
  2012-03-26 15:06 ` Stephen Warren
  2 siblings, 0 replies; 5+ messages in thread
From: Dirk Behme @ 2012-03-25  6:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 25.03.2012 00:48, Roland Stigge wrote:
> Hi,
>
> since I will need to maintain some machines with DT enabled kernels but
> containing a U-Boot without DT support, I sometimes need to integrate a
> dtb file into uImage.
>
> I'm sure others have got the same issue. But searching for a while I
> only got older/meanwhile neglected approaches like:
>
> git://kernel.ubuntu.com/jk/dt/linux-2.6.git - branch: dtbimage

Would have been nice if you would have provided a http link ;)

> I'm currently using a simple hack like attached below.
>
> Wondering what others are doing.

In the past I saw people using something like

http://lists.infradead.org/pipermail/linux-arm-kernel/2011-September/064353.html

I'm not sure if the is the most recent version, though.

Best regards

Dirk

> Sorry if this topic has already been discussed.
>
> Roland
>
>
> --- a/arch/arm/boot/Makefile
> +++ b/arch/arm/boot/Makefile
> @@ -70,9 +70,11 @@ $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
>   clean-files := *.dtb
>
>   quiet_cmd_uimage = UIMAGE  $@
> -      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
> +      cmd_uimage = cat $<  arch/arm/boot/*.dtb>  $<.tmp ; \
> +                  $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
>                     -C none -a $(LOADADDR) -e $(STARTADDR) \
> -                  -n 'Linux-$(KERNELRELEASE)' -d $<  $@
> +                  -n 'Linux-$(KERNELRELEASE)' -d $<.tmp $@ ; \
> +                  rm -f $<.tmp
>
>   ifeq ($(CONFIG_ZBOOT_ROM),y)
>   $(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* uImage with integrated dtb file
  2012-03-24 23:48 uImage with integrated dtb file Roland Stigge
  2012-03-25  6:21 ` Dirk Behme
@ 2012-03-25 11:48 ` Thierry Reding
  2012-03-26 15:06 ` Stephen Warren
  2 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2012-03-25 11:48 UTC (permalink / raw)
  To: linux-arm-kernel

* Roland Stigge wrote:
> Hi,
> 
> since I will need to maintain some machines with DT enabled kernels but 
> containing a U-Boot without DT support, I sometimes need to integrate a 
> dtb file into uImage.

I use the new image format that is itself based on FDT and has support for
appending a DTB. Some documentation can be found here:

	http://git.denx.de/u-boot.git/?p=u-boot.git;a=tree;f=doc/uImage.FIT

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120325/02582b30/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* uImage with integrated dtb file
  2012-03-24 23:48 uImage with integrated dtb file Roland Stigge
  2012-03-25  6:21 ` Dirk Behme
  2012-03-25 11:48 ` Thierry Reding
@ 2012-03-26 15:06 ` Stephen Warren
  2012-03-26 16:48   ` Roland Stigge
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2012-03-26 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/24/2012 05:48 PM, Roland Stigge wrote:
> Hi,
> 
> since I will need to maintain some machines with DT enabled kernels but 
> containing a U-Boot without DT support, I sometimes need to integrate a 
> dtb file into uImage.
> 
> I'm sure others have got the same issue. But searching for a while I 
> only got older/meanwhile neglected approaches like:
> 
> git://kernel.ubuntu.com/jk/dt/linux-2.6.git - branch: dtbimage
> 
> I'm currently using a simple hack like attached below.
...
> --- a/arch/arm/boot/Makefile
...
>  quiet_cmd_uimage = UIMAGE  $@
> -      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
> +      cmd_uimage = cat $< arch/arm/boot/*.dtb > $<.tmp ; \

That won't work well when multiple .dtb files are built. That's
certainly common for Tegra, and probably most subarchs.

The concatenation should be optional; people not using
CONFIG_APPENDED_DTB (hopefully the majority) wouldn't want this for example.

Please be aware of:

https://lkml.org/lkml/2012/3/16/450
Kbuild: centralize MKIMAGE and cmd_uimage definitions

I believe previous discussion around this topic has resolved into people
not wanting to make CONFIG_APPENDED_DTB to easy to use, so that people
who don't need to use it won't be tempted to just use it instead of
explicit FDT support in bootloaders. For example, see:

https://lkml.org/lkml/2011/8/2/200
Build a uImage with dtb already appended

... which Grant has specifically stated he didn't want applied upstream
for the reason I mention above.

> +                  $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
>                    -C none -a $(LOADADDR) -e $(STARTADDR) \
> -                  -n 'Linux-$(KERNELRELEASE)' -d $< $@
> +                  -n 'Linux-$(KERNELRELEASE)' -d $<.tmp $@ ; \
> +                  rm -f $<.tmp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* uImage with integrated dtb file
  2012-03-26 15:06 ` Stephen Warren
@ 2012-03-26 16:48   ` Roland Stigge
  0 siblings, 0 replies; 5+ messages in thread
From: Roland Stigge @ 2012-03-26 16:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 26/03/12 17:06, Stephen Warren wrote:
>>  quiet_cmd_uimage = UIMAGE  $@
>> -      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
>> +      cmd_uimage = cat $< arch/arm/boot/*.dtb > $<.tmp ; \
> 
> That won't work well when multiple .dtb files are built.

That's completely correct! Therefore I called it "hack" (maybe
forgetting to prefix it "ugly"), so please don't use it. ;-)

Roland

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-26 16:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-24 23:48 uImage with integrated dtb file Roland Stigge
2012-03-25  6:21 ` Dirk Behme
2012-03-25 11:48 ` Thierry Reding
2012-03-26 15:06 ` Stephen Warren
2012-03-26 16:48   ` Roland Stigge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox