diff mbox

[v2] ARM: shmobile: uImage load address rework

Message ID 20130610092857.19175.25629.sendpatchset@w520 (mailing list archive)
State New, archived
Headers show

Commit Message

Magnus Damm June 10, 2013, 9:28 a.m. UTC
From: Magnus Damm <damm@opensource.se>

This is V2 of the mach-shmobile uImage load address rework patch.

Rework the mach-shmobile uImage load address calculation by storing
the per-board load addresses in Makefile.boot. This removes the
CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
it possible to create safe kernel images that boot on multiple boards.

This is one of several series of code that reworks code not to rely on
CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.

Signed-off-by: Magnus Damm <damm@opensource.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---

 Changes since V1:
 - On popular request, merged patch 5 and 14 and all other.
 - Updated the __ZRELADDR calculation, thanks Arnd!
 - Added Reviewed-by from Laurent and Morimoto-san, thanks!

 arch/arm/mach-shmobile/Makefile.boot |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Comments

Simon Horman June 11, 2013, 7:47 a.m. UTC | #1
On Mon, Jun 10, 2013 at 06:28:57PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> This is V2 of the mach-shmobile uImage load address rework patch.
> 
> Rework the mach-shmobile uImage load address calculation by storing
> the per-board load addresses in Makefile.boot. This removes the
> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
> it possible to create safe kernel images that boot on multiple boards.
> 
> This is one of several series of code that reworks code not to rely on
> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thanks, I have queued this up in the soc2 branch.
My current plan is to let that branch sit in next for a few
days and then send a pull-request for it to be included in v3.11.

> ---
> 
>  Changes since V1:
>  - On popular request, merged patch 5 and 14 and all other.
>  - Updated the __ZRELADDR calculation, thanks Arnd!
>  - Added Reviewed-by from Laurent and Morimoto-san, thanks!
> 
>  arch/arm/mach-shmobile/Makefile.boot |   20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> --- 0001/arch/arm/mach-shmobile/Makefile.boot
> +++ work/arch/arm/mach-shmobile/Makefile.boot	2013-06-10 16:15:22.000000000 +0900
> @@ -1,6 +1,22 @@
> -__ZRELADDR	:= $(shell /bin/bash -c 'printf "0x%08x" \
> -		     $$[$(CONFIG_MEMORY_START) + 0x8000]')
> +# per-board load address for uImage
> +loadaddr-y	:=
> +loadaddr-$(CONFIG_MACH_AG5EVM) += 0x40008000
> +loadaddr-$(CONFIG_MACH_AP4EVB) += 0x40008000
> +loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000
> +loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
> +loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
> +loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
> +loadaddr-$(CONFIG_MACH_BONITO) += 0x40008000
> +loadaddr-$(CONFIG_MACH_KOTA2) += 0x41008000
> +loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
> +loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
> +loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
> +loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
> +loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
> +loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
> +loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
>  
> +__ZRELADDR	:= $(sort $(loadaddr-y))
>     zreladdr-y   += $(__ZRELADDR)
>  
>  # Unsupported legacy stuff
>
Magnus Damm June 11, 2013, 9:33 a.m. UTC | #2
On Tue, Jun 11, 2013 at 4:47 PM, Simon Horman <horms@verge.net.au> wrote:
> On Mon, Jun 10, 2013 at 06:28:57PM +0900, Magnus Damm wrote:
>> From: Magnus Damm <damm@opensource.se>
>>
>> This is V2 of the mach-shmobile uImage load address rework patch.
>>
>> Rework the mach-shmobile uImage load address calculation by storing
>> the per-board load addresses in Makefile.boot. This removes the
>> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
>> it possible to create safe kernel images that boot on multiple boards.
>>
>> This is one of several series of code that reworks code not to rely on
>> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
>>
>> Signed-off-by: Magnus Damm <damm@opensource.se>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Thanks, I have queued this up in the soc2 branch.
> My current plan is to let that branch sit in next for a few
> days and then send a pull-request for it to be included in v3.11.

Sounds good, thanks! I will try to sort out the remaining bits and see
where that takes us.

Cheers,

/ magnus
Guennadi Liakhovetski June 11, 2013, 1:54 p.m. UTC | #3
Hi Magnus

On Mon, 10 Jun 2013, Magnus Damm wrote:

> From: Magnus Damm <damm@opensource.se>
> 
> This is V2 of the mach-shmobile uImage load address rework patch.
> 
> Rework the mach-shmobile uImage load address calculation by storing
> the per-board load addresses in Makefile.boot. This removes the
> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
> it possible to create safe kernel images that boot on multiple boards.
> 
> This is one of several series of code that reworks code not to rely on
> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---

This patch seems to break compilation when none of CONFIG_MACH_* is set, 
e.g. when trying to build a generic SoC kernel with only DT-based board 
support, or am I missing something?

Thanks
Guennadi

> 
>  Changes since V1:
>  - On popular request, merged patch 5 and 14 and all other.
>  - Updated the __ZRELADDR calculation, thanks Arnd!
>  - Added Reviewed-by from Laurent and Morimoto-san, thanks!
> 
>  arch/arm/mach-shmobile/Makefile.boot |   20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> --- 0001/arch/arm/mach-shmobile/Makefile.boot
> +++ work/arch/arm/mach-shmobile/Makefile.boot	2013-06-10 16:15:22.000000000 +0900
> @@ -1,6 +1,22 @@
> -__ZRELADDR	:= $(shell /bin/bash -c 'printf "0x%08x" \
> -		     $$[$(CONFIG_MEMORY_START) + 0x8000]')
> +# per-board load address for uImage
> +loadaddr-y	:=
> +loadaddr-$(CONFIG_MACH_AG5EVM) += 0x40008000
> +loadaddr-$(CONFIG_MACH_AP4EVB) += 0x40008000
> +loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000
> +loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
> +loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
> +loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
> +loadaddr-$(CONFIG_MACH_BONITO) += 0x40008000
> +loadaddr-$(CONFIG_MACH_KOTA2) += 0x41008000
> +loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
> +loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
> +loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
> +loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
> +loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
> +loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
> +loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
>  
> +__ZRELADDR	:= $(sort $(loadaddr-y))
>     zreladdr-y   += $(__ZRELADDR)
>  
>  # Unsupported legacy stuff
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Laurent Pinchart June 11, 2013, 9:50 p.m. UTC | #4
Hi Magnus,

Thanks for the patch.

On Monday 10 June 2013 18:28:57 Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> This is V2 of the mach-shmobile uImage load address rework patch.
> 
> Rework the mach-shmobile uImage load address calculation by storing
> the per-board load addresses in Makefile.boot. This removes the
> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
> it possible to create safe kernel images that boot on multiple boards.
> 
> This is one of several series of code that reworks code not to rely on
> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

I've noticed today that KZM9G doesn't boot v3.10-rc2 with 
CONFIG_AUTO_ZRELADDR=y. While not caused by this patch, that's something that 
will need to be fixed to support multi-arch kernels. I'm not too familiar with 
early boot code, would you be able to have a look at this ?

> ---
> 
>  Changes since V1:
>  - On popular request, merged patch 5 and 14 and all other.
>  - Updated the __ZRELADDR calculation, thanks Arnd!
>  - Added Reviewed-by from Laurent and Morimoto-san, thanks!
> 
>  arch/arm/mach-shmobile/Makefile.boot |   20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> --- 0001/arch/arm/mach-shmobile/Makefile.boot
> +++ work/arch/arm/mach-shmobile/Makefile.boot	2013-06-10 
16:15:22.000000000
> +0900 @@ -1,6 +1,22 @@
> -__ZRELADDR	:= $(shell /bin/bash -c 'printf "0x%08x" \
> -		     $$[$(CONFIG_MEMORY_START) + 0x8000]')
> +# per-board load address for uImage
> +loadaddr-y	:=
> +loadaddr-$(CONFIG_MACH_AG5EVM) += 0x40008000
> +loadaddr-$(CONFIG_MACH_AP4EVB) += 0x40008000
> +loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000
> +loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
> +loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
> +loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
> +loadaddr-$(CONFIG_MACH_BONITO) += 0x40008000
> +loadaddr-$(CONFIG_MACH_KOTA2) += 0x41008000
> +loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
> +loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
> +loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
> +loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
> +loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
> +loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
> +loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
> 
> +__ZRELADDR	:= $(sort $(loadaddr-y))
>     zreladdr-y   += $(__ZRELADDR)
> 
>  # Unsupported legacy stuff
Magnus Damm June 12, 2013, 2:20 a.m. UTC | #5
Hi Guennadi,

On Tue, Jun 11, 2013 at 10:54 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> Hi Magnus
>
> On Mon, 10 Jun 2013, Magnus Damm wrote:
>
>> From: Magnus Damm <damm@opensource.se>
>>
>> This is V2 of the mach-shmobile uImage load address rework patch.
>>
>> Rework the mach-shmobile uImage load address calculation by storing
>> the per-board load addresses in Makefile.boot. This removes the
>> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
>> it possible to create safe kernel images that boot on multiple boards.
>>
>> This is one of several series of code that reworks code not to rely on
>> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
>>
>> Signed-off-by: Magnus Damm <damm@opensource.se>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>> ---
>
> This patch seems to break compilation when none of CONFIG_MACH_* is set,
> e.g. when trying to build a generic SoC kernel with only DT-based board
> support, or am I missing something?

Thanks for your feedback. I believe the current code already covers
the in-tree REFERENCE DT boards. Perhaps there is some board missing?

If you want to build an uImage for a certain DT board then perhaps you
can add it to the list with an incremental patch?

Or even better, use zImage instead of uImage, then we can have a
single binary for all boards.

So if you build the kernel for no board at all, either set the
LOADADDR variable as the help text says, or simply do not build for
uImage.

Makes sense?

Cheers,

/ magnus
Magnus Damm June 12, 2013, 2:21 a.m. UTC | #6
Hi Laurent,

On Wed, Jun 12, 2013 at 6:50 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Magnus,
>
> Thanks for the patch.
>
> On Monday 10 June 2013 18:28:57 Magnus Damm wrote:
>> From: Magnus Damm <damm@opensource.se>
>>
>> This is V2 of the mach-shmobile uImage load address rework patch.
>>
>> Rework the mach-shmobile uImage load address calculation by storing
>> the per-board load addresses in Makefile.boot. This removes the
>> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
>> it possible to create safe kernel images that boot on multiple boards.
>>
>> This is one of several series of code that reworks code not to rely on
>> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
>>
>> Signed-off-by: Magnus Damm <damm@opensource.se>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> I've noticed today that KZM9G doesn't boot v3.10-rc2 with
> CONFIG_AUTO_ZRELADDR=y. While not caused by this patch, that's something that
> will need to be fixed to support multi-arch kernels. I'm not too familiar with
> early boot code, would you be able to have a look at this ?

I will have a look. I suspect that issue is not related to this patch, is it?

Cheers,

/ magnus
Laurent Pinchart June 12, 2013, 2:31 a.m. UTC | #7
Hi Magnus,

On Wednesday 12 June 2013 11:21:34 Magnus Damm wrote:
> On Wed, Jun 12, 2013 at 6:50 AM, Laurent Pinchart wrote:
> > On Monday 10 June 2013 18:28:57 Magnus Damm wrote:
> >> From: Magnus Damm <damm@opensource.se>
> >> 
> >> This is V2 of the mach-shmobile uImage load address rework patch.
> >> 
> >> Rework the mach-shmobile uImage load address calculation by storing
> >> the per-board load addresses in Makefile.boot. This removes the
> >> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
> >> it possible to create safe kernel images that boot on multiple boards.
> >> 
> >> This is one of several series of code that reworks code not to rely on
> >> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
> >> 
> >> Signed-off-by: Magnus Damm <damm@opensource.se>
> >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > I've noticed today that KZM9G doesn't boot v3.10-rc2 with
> > CONFIG_AUTO_ZRELADDR=y. While not caused by this patch, that's something
> > that will need to be fixed to support multi-arch kernels. I'm not too
> > familiar with early boot code, would you be able to have a look at this ?
> 
> I will have a look. I suspect that issue is not related to this patch, is
> it?

No, it isn't, the issue is present in v3.10-rc2. I don't know if it has ever 
worked.
Guennadi Liakhovetski June 12, 2013, 6:22 a.m. UTC | #8
On Wed, 12 Jun 2013, Magnus Damm wrote:

> Hi Guennadi,
> 
> On Tue, Jun 11, 2013 at 10:54 PM, Guennadi Liakhovetski
> <g.liakhovetski@gmx.de> wrote:
> > Hi Magnus
> >
> > On Mon, 10 Jun 2013, Magnus Damm wrote:
> >
> >> From: Magnus Damm <damm@opensource.se>
> >>
> >> This is V2 of the mach-shmobile uImage load address rework patch.
> >>
> >> Rework the mach-shmobile uImage load address calculation by storing
> >> the per-board load addresses in Makefile.boot. This removes the
> >> CONFIG_MEMORY_START dependency from Makefile.boot, and it also makes
> >> it possible to create safe kernel images that boot on multiple boards.
> >>
> >> This is one of several series of code that reworks code not to rely on
> >> CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
> >>
> >> Signed-off-by: Magnus Damm <damm@opensource.se>
> >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >> ---
> >
> > This patch seems to break compilation when none of CONFIG_MACH_* is set,
> > e.g. when trying to build a generic SoC kernel with only DT-based board
> > support, or am I missing something?
> 
> Thanks for your feedback. I believe the current code already covers
> the in-tree REFERENCE DT boards. Perhaps there is some board missing?
> 
> If you want to build an uImage for a certain DT board then perhaps you
> can add it to the list with an incremental patch?
> 
> Or even better, use zImage instead of uImage, then we can have a
> single binary for all boards.
> 
> So if you build the kernel for no board at all, either set the
> LOADADDR variable as the help text says, or simply do not build for
> uImage.
> 
> Makes sense?

Ok, understand, thanks.

Regards
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
diff mbox

Patch

--- 0001/arch/arm/mach-shmobile/Makefile.boot
+++ work/arch/arm/mach-shmobile/Makefile.boot	2013-06-10 16:15:22.000000000 +0900
@@ -1,6 +1,22 @@ 
-__ZRELADDR	:= $(shell /bin/bash -c 'printf "0x%08x" \
-		     $$[$(CONFIG_MEMORY_START) + 0x8000]')
+# per-board load address for uImage
+loadaddr-y	:=
+loadaddr-$(CONFIG_MACH_AG5EVM) += 0x40008000
+loadaddr-$(CONFIG_MACH_AP4EVB) += 0x40008000
+loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000
+loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
+loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
+loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
+loadaddr-$(CONFIG_MACH_BONITO) += 0x40008000
+loadaddr-$(CONFIG_MACH_KOTA2) += 0x41008000
+loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
+loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
+loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
+loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
+loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
+loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
+loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
 
+__ZRELADDR	:= $(sort $(loadaddr-y))
    zreladdr-y   += $(__ZRELADDR)
 
 # Unsupported legacy stuff