linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset
@ 2008-03-07 16:55 Kumar Gala
  2008-03-08  1:44 ` Geoff Levand
  2008-03-11  0:37 ` David Gibson
  0 siblings, 2 replies; 5+ messages in thread
From: Kumar Gala @ 2008-03-07 16:55 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

Normally we assume kernel images will be loaded at offset 0. However
there are situations, like when the kernel itself is running at a non-zero
physical address, that we don't want to load it at 0.

Allow the wrapper to take an offset.  We use this when building u-boot images.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/boot/Makefile |    7 +++++++
 arch/powerpc/boot/wrapper  |   12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index f43dd6e..1b4bfc6 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -35,6 +35,12 @@ endif

 BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt

+ifdef CONFIG_MEMORY_START
+MEMBASE=$(CONFIG_MEMORY_START)
+else
+MEMBASE=0x00000000
+endif
+
 $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
@@ -181,6 +187,7 @@ endif
 # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
 quiet_cmd_wrap	= WRAP    $@
       cmd_wrap	=$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
+		-m $(MEMBASE) \
 		$(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux

 image-$(CONFIG_PPC_PSERIES)		+= zImage.pseries
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 6655a90..4f2b2d0 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -50,8 +50,11 @@ objbin=$object
 # directory for working files
 tmpdir=.

+# physical offset of kernel image
+membase=0x00000000
+
 usage() {
-    echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
+    echo 'Usage: wrapper [-o output] [-p platform] [-i initrd] [-m membase]' >&2
     echo '       [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
     echo '       [-D datadir] [-W workingdir] [--no-gzip] [vmlinux]' >&2
     exit 1
@@ -84,6 +87,11 @@ while [ "$#" -gt 0 ]; do
 	[ "$#" -gt 0 ] || usage
 	dts="$1"
 	;;
+    -m)
+	shift
+	[ "$#" -gt 0 ] || usage
+	membase="$1"
+	;;
     -c)
 	cacheit=y
 	;;
@@ -225,7 +233,7 @@ fi
 case "$platform" in
 uboot)
     rm -f "$ofile"
-    mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
+    mkimage -A ppc -O linux -T kernel -C gzip -a $membase -e $membase \
 	$uboot_version -d "$vmz" "$ofile"
     if [ -z "$cacheit" ]; then
 	rm -f "$vmz"
-- 
1.5.4.1

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

* Re: [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset
  2008-03-07 16:55 [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset Kumar Gala
@ 2008-03-08  1:44 ` Geoff Levand
  2008-03-08 15:13   ` Kumar Gala
  2008-03-11  0:37 ` David Gibson
  1 sibling, 1 reply; 5+ messages in thread
From: Geoff Levand @ 2008-03-08  1:44 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras

On 03/07/2008 08:55 AM, Kumar Gala wrote:
> Normally we assume kernel images will be loaded at offset 0. However
> there are situations, like when the kernel itself is running at a non-zero
> physical address, that we don't want to load it at 0.
> 
> Allow the wrapper to take an offset.  We use this when building u-boot images.
> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
>  arch/powerpc/boot/Makefile |    7 +++++++
>  arch/powerpc/boot/wrapper  |   12 ++++++++++--
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f43dd6e..1b4bfc6 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -35,6 +35,12 @@ endif
> 
>  BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt
> 
> +ifdef CONFIG_MEMORY_START
> +MEMBASE=$(CONFIG_MEMORY_START)

We have the powerpc config option CONFIG_KERNEL_START.  I'm
wondering  how this CONFIG_MEMORY_START is different.  I just
did a quick search, and it seems that CONFIG_MEMORY_START is
only defined for the renesas arch's.

-Geoff

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

* Re: [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset
  2008-03-08  1:44 ` Geoff Levand
@ 2008-03-08 15:13   ` Kumar Gala
  0 siblings, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2008-03-08 15:13 UTC (permalink / raw)
  To: Geoff Levand; +Cc: linuxppc-dev, Paul Mackerras


On Mar 7, 2008, at 7:44 PM, Geoff Levand wrote:

> On 03/07/2008 08:55 AM, Kumar Gala wrote:
>> Normally we assume kernel images will be loaded at offset 0. However
>> there are situations, like when the kernel itself is running at a  
>> non-zero
>> physical address, that we don't want to load it at 0.
>>
>> Allow the wrapper to take an offset.  We use this when building u- 
>> boot images.
>>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>> ---
>> arch/powerpc/boot/Makefile |    7 +++++++
>> arch/powerpc/boot/wrapper  |   12 ++++++++++--
>> 2 files changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
>> index f43dd6e..1b4bfc6 100644
>> --- a/arch/powerpc/boot/Makefile
>> +++ b/arch/powerpc/boot/Makefile
>> @@ -35,6 +35,12 @@ endif
>>
>> BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt
>>
>> +ifdef CONFIG_MEMORY_START
>> +MEMBASE=$(CONFIG_MEMORY_START)
>
> We have the powerpc config option CONFIG_KERNEL_START.  I'm
> wondering  how this CONFIG_MEMORY_START is different.  I just
> did a quick search, and it seems that CONFIG_MEMORY_START is
> only defined for the renesas arch's.

KERNEL_START is the virtual address of the kernel.  It makes no claims  
about what the physical address is.

MEMORY_START will be the physical address that the kernel is at.  This  
will only be supported on platforms like Book-e that can have  
exception vectors at roughly any address.

- k

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

* Re: [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset
  2008-03-07 16:55 [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset Kumar Gala
  2008-03-08  1:44 ` Geoff Levand
@ 2008-03-11  0:37 ` David Gibson
  2008-03-11  4:19   ` Kumar Gala
  1 sibling, 1 reply; 5+ messages in thread
From: David Gibson @ 2008-03-11  0:37 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras

On Fri, Mar 07, 2008 at 10:55:51AM -0600, Kumar Gala wrote:
> Normally we assume kernel images will be loaded at offset 0. However
> there are situations, like when the kernel itself is running at a non-zero
> physical address, that we don't want to load it at 0.
> 
> Allow the wrapper to take an offset.  We use this when building u-boot images.
> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

Hrm.  It concerns me that with the patch as it stands,
CONFIG_MEMORY_START looks like a fairly universal option, but it will
only be respected on u-boot platforms (and only new u-boot, not cuboot
at that).

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset
  2008-03-11  0:37 ` David Gibson
@ 2008-03-11  4:19   ` Kumar Gala
  0 siblings, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2008-03-11  4:19 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev, Paul Mackerras


On Mar 10, 2008, at 7:37 PM, David Gibson wrote:

> On Fri, Mar 07, 2008 at 10:55:51AM -0600, Kumar Gala wrote:
>> Normally we assume kernel images will be loaded at offset 0. However
>> there are situations, like when the kernel itself is running at a  
>> non-zero
>> physical address, that we don't want to load it at 0.
>>
>> Allow the wrapper to take an offset.  We use this when building u- 
>> boot images.
>>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>
> Hrm.  It concerns me that with the patch as it stands,
> CONFIG_MEMORY_START looks like a fairly universal option, but it will
> only be respected on u-boot platforms (and only new u-boot, not cuboot
> at that).

Nothing stops anyone from submitting patches that makes it work for  
other platforms.  CONFIG_MEMORY_START is only of utility on book-e  
class machines at this point and from a Freescale point of view that's  
85xx and thus means u-boot.  IBM, AMCC, or a random Joe is free to  
submit patches to make it work on 44x. :)

- k

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

end of thread, other threads:[~2008-03-11  4:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-07 16:55 [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset Kumar Gala
2008-03-08  1:44 ` Geoff Levand
2008-03-08 15:13   ` Kumar Gala
2008-03-11  0:37 ` David Gibson
2008-03-11  4:19   ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).