mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] arm: add support to generate uImage
@ 2011-04-23  5:05 Jean-Christophe PLAGNIOL-VILLARD
  2011-04-25 11:37 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-23  5:05 UTC (permalink / raw)
  To: barebox

so barebox could be loaded as kernel by itself

add LOAD_TEXT_BASE to specify the load address

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/Makefile |   15 +++++++++++++++
 common/Kconfig    |    7 +++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 108bd5e..f0ec667 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -134,6 +134,21 @@ ifeq ($(machine-y),netx)
 KBUILD_IMAGE := barebox.netx
 endif
 
+MKIMAGE		:= $(objtree)/scripts/mkimage
+
+quiet_cmd_uimage = UIMAGE  $@
+      cmd_uimage = $(MKIMAGE) -A arm -O linux -T kernel \
+		   -C none -a $(BAREBOX_LOAD) -e $(BAREBOX_ENTRY) \
+		   -n 'Barebox-$(KERNELRELEASE)' -d $< $@
+
+uImage: $(MKIMAGE)
+uImage: BAREBOX_LOAD=$(CONFIG_LOAD_TEXT_BASE)
+uImage: BAREBOX_ENTRY=$(CONFIG_TEXT_BASE)
+
+uImage: barebox.bin
+	$(call if_changed,uimage,none)
+	@echo '  Image $@ is ready'
+
 all: $(KBUILD_IMAGE)
 
 archprepare: maketools
diff --git a/common/Kconfig b/common/Kconfig
index 9e30579..50995d3 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -80,6 +80,13 @@ config TEXT_BASE
 	help
 	  The Address barebox gets linked at.
 
+config LOAD_TEXT_BASE
+	prompt "LOAD_TEXT_BASE"
+	hex
+	default TEXT_BASE
+	help
+	  The Address barebox gets load at as a uImage
+
 config HAVE_CONFIGURABLE_MEMORY_LAYOUT
 	bool
 
-- 
1.7.4.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] arm: add support to generate uImage
  2011-04-23  5:05 [PATCH] arm: add support to generate uImage Jean-Christophe PLAGNIOL-VILLARD
@ 2011-04-25 11:37 ` Sascha Hauer
  2011-04-25 15:48   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2011-04-25 11:37 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sat, Apr 23, 2011 at 07:05:18AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> so barebox could be loaded as kernel by itself
> 
> add LOAD_TEXT_BASE to specify the load address
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/Makefile |   15 +++++++++++++++
>  common/Kconfig    |    7 +++++++
>  2 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 108bd5e..f0ec667 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -134,6 +134,21 @@ ifeq ($(machine-y),netx)
>  KBUILD_IMAGE := barebox.netx
>  endif
>  
> +MKIMAGE		:= $(objtree)/scripts/mkimage
> +
> +quiet_cmd_uimage = UIMAGE  $@
> +      cmd_uimage = $(MKIMAGE) -A arm -O linux -T kernel \
> +		   -C none -a $(BAREBOX_LOAD) -e $(BAREBOX_ENTRY) \
> +		   -n 'Barebox-$(KERNELRELEASE)' -d $< $@
> +
> +uImage: $(MKIMAGE)
> +uImage: BAREBOX_LOAD=$(CONFIG_LOAD_TEXT_BASE)
> +uImage: BAREBOX_ENTRY=$(CONFIG_TEXT_BASE)
> +
> +uImage: barebox.bin
> +	$(call if_changed,uimage,none)
> +	@echo '  Image $@ is ready'
> +
>  all: $(KBUILD_IMAGE)
>  
>  archprepare: maketools
> diff --git a/common/Kconfig b/common/Kconfig
> index 9e30579..50995d3 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -80,6 +80,13 @@ config TEXT_BASE
>  	help
>  	  The Address barebox gets linked at.
>  
> +config LOAD_TEXT_BASE
> +	prompt "LOAD_TEXT_BASE"
> +	hex
> +	default TEXT_BASE
> +	help
> +	  The Address barebox gets load at as a uImage
> +

No, please don't. When you load barebox with itself you end up
overwriting the running barebox with the just loaded image if using
TEXT_BASE here.
barebox can be started from any address in SDRAM. Isn't there a
mechanism to support this with the uImage format? The U-Boot guys have
the same problem with ARM_PATCH_PHYS_VIRT in the kernel aswell, so I
assume this is already solved in some way, no?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] arm: add support to generate uImage
  2011-04-25 11:37 ` Sascha Hauer
@ 2011-04-25 15:48   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-04-25 18:57     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-25 15:48 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

> > +	hex
> > +	default TEXT_BASE
> > +	help
> > +	  The Address barebox gets load at as a uImage
> > +
> 
> No, please don't. When you load barebox with itself you end up
> overwriting the running barebox with the just loaded image if using
> TEXT_BASE here.
> barebox can be started from any address in SDRAM. Isn't there a
> mechanism to support this with the uImage format? The U-Boot guys have
> the same problem with ARM_PATCH_PHYS_VIRT in the kernel aswell, so I
> assume this is already solved in some way, no?
I known but the uImage does not allow you to do so
and no they do not do so

for us we can add a -l and -e option to bootm to overwrite the default load address
and entry point but for orlder u-boot or barebox we can not so this is the
only way to specify one for the uImage

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] arm: add support to generate uImage
  2011-04-25 15:48   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-04-25 18:57     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2011-04-25 18:57 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Mon, Apr 25, 2011 at 05:48:34PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > +	hex
> > > +	default TEXT_BASE
> > > +	help
> > > +	  The Address barebox gets load at as a uImage
> > > +
> > 
> > No, please don't. When you load barebox with itself you end up
> > overwriting the running barebox with the just loaded image if using
> > TEXT_BASE here.
> > barebox can be started from any address in SDRAM. Isn't there a
> > mechanism to support this with the uImage format? The U-Boot guys have
> > the same problem with ARM_PATCH_PHYS_VIRT in the kernel aswell, so I
> > assume this is already solved in some way, no?
> I known but the uImage does not allow you to do so
> and no they do not do so
> 
> for us we can add a -l and -e option to bootm to overwrite the default load address
> and entry point but for orlder u-boot or barebox we can not so this is the
> only way to specify one for the uImage

Then the sdram base address is a much safer default value. We also
should add a check in the uImage code that prevents us from overwriting
ourselves.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2011-04-25 18:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-23  5:05 [PATCH] arm: add support to generate uImage Jean-Christophe PLAGNIOL-VILLARD
2011-04-25 11:37 ` Sascha Hauer
2011-04-25 15:48   ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-25 18:57     ` Sascha Hauer

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