U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Menon
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Introduce CONFIG_SKIP_RELOCATION as alternative define. This may be desired in some conditions where U-Boot is downloaded directly into SRAM during NAND/Peripheral download mode and is not expected to be relocated.
This patch also organizes SKIP_LOWLEVEL_INIT and SKIP_RELOCATION in a common arm feature dependent section.
Index: u-boot-v2.git/arch/arm/cpu/start-arm.S
===================================================================
--- u-boot-v2.git.orig/arch/arm/cpu/start-arm.S 2008-05-05
09:35:00.000000000 -0500
+++ u-boot-v2.git/arch/arm/cpu/start-arm.S 2008-05-05
09:35:05.000000000 -0500
@@ -160,6 +160,10 @@
bl board_init_lowlevel
#endif
+ /*
+ * In some circumstances, we may choose not to relocate u-boot
+ */
+#ifndef CONFIG_SKIP_RELOCATION
relocate: /* relocate U-Boot to RAM
*/
adr r0, _start /* r0 <- current position of
code */
ldr r1, _TEXT_BASE /* test if we run from flash or
RAM */
@@ -176,6 +180,7 @@
stmia r1!, {r3-r10} /* copy to target address [r1]
*/
cmp r0, r2 /* until source end addreee [r2]
*/
ble copy_loop
+#endif
/* Set up the stack
*/
stack_setup:
Index: u-boot-v2.git/arch/arm/Kconfig
===================================================================
--- u-boot-v2.git.orig/arch/arm/Kconfig 2008-05-05 09:34:44.000000000
-0500
+++ u-boot-v2.git/arch/arm/Kconfig 2008-05-05 09:35:25.000000000
-0500
@@ -74,6 +74,7 @@
bool
select ARM926EJS
+
choice
prompt "Select your board"
@@ -140,7 +141,7 @@
The i.MX SoCs have a Pin which can output different reference
frequencies.
Say y here if you want to have the clko command which lets you
select the
frequency to output on this pin.
-
+
source arch/arm/mach-netx/Kconfig
menu "Arm specific settings "
@@ -164,6 +165,27 @@
If you want to start a 2.6 kernel and use an initrd image say y here.
+menu "Boot Features"
+
+config SKIP_LOWLEVEL_INIT
+ bool
+ default n
+ depends on ARM
+ prompt "Skip lowlevel init"
+ help
+ This entry skips the SDRAM initialising on many ARM based
boards.
+ It enables using U-boot as a second stage bootloader.
+
+config SKIP_RELOCATION
+ bool
+ default n
+ depends on ARM
+ prompt "Skip U-Boot Relocation"
+ help
+ This entry skips the relocation logic on certain platforms
+ It enables using U-boot as a second stage bootloader.
+endmenu
+
endmenu
source common/Kconfig
Index: u-boot-v2.git/common/Kconfig
===================================================================
--- u-boot-v2.git.orig/common/Kconfig 2008-05-05 09:34:44.000000000
-0500
+++ u-boot-v2.git/common/Kconfig 2008-05-05 09:35:05.000000000
-0500
@@ -216,14 +216,6 @@
help
Enable build of u-boot with -g.
-config SKIP_LOWLEVEL_INIT
- bool
- depends on ARM
- prompt "Skip lowlevel init"
- help
- This entry skips the SDRAM initialising on many ARM based
boards.
- It enables using U-boot as a second stage bootloader.
-
config ENABLE_FLASH_NOISE
bool
prompt "verbose flash handling"
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Quoted 7 lines · In message <[email protected]> you…
Introduce
CONFIG_SKIP_RELOCATIONas alternative define. This may be desired in some conditions where U-Boot is downloaded directly into SRAM during NAND/Peripheral download mode and is not expected to be relocated.This patch also organizes
SKIP_LOWLEVEL_INITandSKIP_RELOCATIONin a common arm feature dependent section.
Your patch is corrupted - your mailer line-wrapped it:
Quoted 8 lines
(quoted diff) +7
-0+config SKIP_LOWLEVEL_INIT + bool + default n + depends on ARM + prompt "Skip lowlevel init" + help + This entry skips the SDRAM initialising on many ARM basedboards.
^^^^^^^^^^^^^ here for example.
PLease fix your mailer before resending.
I strongly recommend to use git and git tools for such work.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Never face facts; if you do, you'll never get up in the morning." - Marlo Thomas
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
In reply to MenonQuoted 4 lines · Nishanth
Introduce
CONFIG_SKIP_RELOCATIONas alternative define. This may be desired in some conditions where U-Boot is downloaded directly into SRAM during NAND/Peripheral download mode and is not expected to be relocated.
If U-Boot is not expected to be relocated, TEXT_BASE should be in SRAM in which case the relocation loop just does nothing. So you end up in saving 12 * 4 bytes of space. Is it really worth to introduce an #ifdef for such a small saving?
Sascha
Quoted 114 lines
This patch also organizes
SKIP_LOWLEVEL_INITandSKIP_RELOCATIONin a common arm feature dependent section.Signed-off-by Nishanth Menon <[email protected]>Index:
u-boot-v2.git/arch/arm/cpu/start-arm.S
===================================================================
---u-boot-v2.git.orig/arch/arm/cpu/start-arm.S2008-05-05
09:35:00.000000000 -0500
+++u-boot-v2.git/arch/arm/cpu/start-arm.S2008-05-05
09:35:05.000000000 -0500(quoted diff) +4
-0@@ -160,6 +160,10 @@ bl board_init_lowlevel #endif + /* + * In some circumstances, we may choose not to relocate u-boot + */ +#ifndef CONFIG_SKIP_RELOCATION relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 <- current position ofcode */
ldr r1,_TEXT_BASE/* test if we run from flash or
RAM */(quoted diff) +1
-0@@ -176,6 +180,7 @@ stmia r1!, {r3-r10} /* copy to target address [r1] */ cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop +#endif/* Set up the stack
*/
stack_setup:
Index: u-boot-v2.git/arch/arm/Kconfig
===================================================================
--- u-boot-v2.git.orig/arch/arm/Kconfig 2008-05-05 09:34:44.000000000
-0500
+++ u-boot-v2.git/arch/arm/Kconfig 2008-05-05 09:35:25.000000000
-0500(quoted diff) +1
-0@@ -74,6 +74,7 @@ bool select ARM926EJS + choice prompt "Select your board"@@ -140,7 +141,7 @@ The i.MX SoCs have a Pin which can output different referencefrequencies.
Say y here if you want to have the clko command which lets you
select the(quoted diff) +10
-1frequency to output on this pin. - + source arch/arm/mach-netx/Kconfig menu "Arm specific settings "@@ -164,6 +165,27 @@ If you want to start a 2.6 kernel and use an initrd image say y here. +menu "Boot Features" + +config SKIP_LOWLEVEL_INIT + bool + default n + depends on ARM + prompt "Skip lowlevel init" + help + This entry skips the SDRAM initialising on many ARM basedboards.
(quoted diff) +12
-0+ It enables using U-boot as a second stage bootloader. + +config SKIP_RELOCATION + bool + default n + depends on ARM + prompt "Skip U-Boot Relocation" + help + This entry skips the relocation logic on certain platforms + It enables using U-boot as a second stage bootloader. +endmenu + endmenu source common/KconfigIndex: u-boot-v2.git/common/Kconfig
===================================================================
--- u-boot-v2.git.orig/common/Kconfig 2008-05-05 09:34:44.000000000
-0500
+++ u-boot-v2.git/common/Kconfig 2008-05-05 09:35:05.000000000
-0500(quoted diff) +0
-6@@ -216,14 +216,6 @@ help Enable build of u-boot with -g. -config SKIP_LOWLEVEL_INIT - bool - depends on ARM - prompt "Skip lowlevel init" - help - This entry skips the SDRAM initialising on many ARM basedboards.
(quoted diff) +0
-2- It enables using U-boot as a second stage bootloader. - config ENABLE_FLASH_NOISE bool prompt "verbose flash handling"
Signature · 4 lines
Pengutronix e.K. - Linux Solutions for Science and Industry ----------------------------------------------------------- Kontakt-Informationen finden Sie im Header dieser Mail oder auf der Webseite -> http://www.pengutronix.de/impressum/ <-
Menon
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Sascha,
Quoted 13 lines
-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Wednesday, May 07, 2008 8:51 AM
To: Menon, Nishanth
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [Patch 2/4] U-Boot-V2: ARM: introduceCONFIG_SKIP_RELOCATIONQuoted 4 lines · Nishanth
Introduce
CONFIG_SKIP_RELOCATIONas alternative define. This may be desired in some conditions where U-Boot is downloaded directly into SRAM during NAND/Peripheral download mode and is not expected to be relocated.
Quoted 4 lines
If U-Boot is not expected to be relocated,
TEXT_BASEshould be in SRAM in which case the relocation loop just does nothing. So you end up in saving 12 * 4 bytes of space. Is it really worth to introduce an #ifdef for such a small saving?
Probably not much of a saving, been looking at the code, and I see CONFIG_RELOCATABLE depending on ppc.
It may not be just the savings part of 48bytes. There can be additional stuff an SOC might choose to do. (ppc start.S also uses the define to save 4 instructions or so). Cleaner approach might make sense to remove the CONFIG_RELOCATABLE dependency on ppc and make it a global configuration. Allowing any platform to choose what ever it wants to do. I will redo the patch accordingly if you are ok with using CONFIG_RELOCATABLE (including fixing my brain dead mailer's issues hopefully :( ).
Regards,
Nishanth Menon
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Quoted 18 lines · Nishanth
Sascha,
Quoted 13 lines
-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Wednesday, May 07, 2008 8:51 AM
To: Menon, Nishanth
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [Patch 2/4] U-Boot-V2: ARM: introduceCONFIG_SKIP_RELOCATIONQuoted 4 lines · Nishanth
Introduce
CONFIG_SKIP_RELOCATIONas alternative define. This may be desired in some conditions where U-Boot is downloaded directly into SRAM during NAND/Peripheral download mode and is not expected to be relocated.Quoted 4 lines
If U-Boot is not expected to be relocated,
TEXT_BASEshould be in SRAM in which case the relocation loop just does nothing. So you end up in saving 12 * 4 bytes of space. Is it really worth to introduce an #ifdef for such a small saving?
Quoted 7 lines
Probably not much of a saving, been looking at the code, and I see
CONFIG_RELOCATABLEdepending on ppc. It may not be just the savings part of 48bytes. There can be additional stuff an SOC might choose to do. (ppcstart.Salso uses the define to save 4 instructions or so). Cleaner approach might make sense to remove theCONFIG_RELOCATABLEdependency on ppc and make it a global configuration. Allowing any platform to choose what ever it wants to do.
CONFIG_RELOCATABLE on powerpc means something different. On arm we start U-Boot by running it at an address != link address and _copy_ (not relocate) ourselves to the address we are linked at. On powerpc real relocation is done if CONFIG_RELOCATABLE is enabled.
Hence the option you wanted to add should better have the name CONFIG_SKIP_COPY_TO_SDRAM or something like that.
Sascha
Signature · 4 lines
Pengutronix e.K. - Linux Solutions for Science and Industry ----------------------------------------------------------- Kontakt-Informationen finden Sie im Header dieser Mail oder auf der Webseite -> http://www.pengutronix.de/impressum/ <-
Menon
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Sascha,
Quoted 7 lines
-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Wednesday, May 07, 2008 10:29 AM
To: Menon, Nishanth
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [Patch 2/4] U-Boot-V2: ARM: introduceCONFIG_SKIP_RELOCATION
Quoted 6 lines
CONFIG_RELOCATABLEon powerpc means something different. On arm we start U-Boot by running it at an address != link address and _copy_ (not relocate) ourselves to the address we are linked at. On powerpc real relocation is done ifCONFIG_RELOCATABLEis enabled.
Hence the option you wanted to add should better have the nameCONFIG_SKIP_COPY_TO_SDRAMor something like that.
Hmm.. good point. My ignorance on ppc is kicking me ;).. I will remove the SKIP_COPY part from my patch. Couple of questions:
a) Are we ok with removing dependency of ARM from "config SKIP_LOWLEVEL_INIT" in common/Kconfig (as opposed to my patch in which I moved it to arch/arm/Kconfig)? Considering that it is used: arch/m68k/cpu/start-mcfv4e.S
b) Further am wondering if it is fine to convert ARCH_HAS_INIT_LOWLEVEL to CONFIG_ARCH_HAS_INIT_LOWLEVEL in common/Kconfig and make it arch independent?
Regards,
Nishanth Menon
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Quoted 9 lines · Nishanth
Sascha,
Quoted 7 lines
-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Wednesday, May 07, 2008 10:29 AM
To: Menon, Nishanth
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [Patch 2/4] U-Boot-V2: ARM: introduceCONFIG_SKIP_RELOCATION
Quoted 8 lines
Quoted 6 lines
CONFIG_RELOCATABLEon powerpc means something different. On arm we start U-Boot by running it at an address != link address and _copy_ (not relocate) ourselves to the address we are linked at. On powerpc real relocation is done ifCONFIG_RELOCATABLEis enabled.
Hence the option you wanted to add should better have the nameCONFIG_SKIP_COPY_TO_SDRAMor something like that.Hmm.. good point. My ignorance on ppc is kicking me ;).. I will remove the
SKIP_COPYpart from my patch. Couple of questions:
a) Are we ok with removing dependency of ARM from "configSKIP_LOWLEVEL_INIT" in common/Kconfig (as opposed to my patch in which I moved it toarch/arm/Kconfig)? Considering that it is used:arch/m68k/cpu/start-mcfv4e.S
so SKIP_LOWLEVEL_INIT would depend on CONFIG_ARCH_HAS_INIT_LOWLEVEL?
Quoted 2 lines
b) Further am wondering if it is fine to convert
ARCH_HAS_INIT_LOWLEVELtoCONFIG_ARCH_HAS_INIT_LOWLEVELin common/Kconfig and make it arch independent?
ok
Regards
Sascha
Signature · 4 lines
Pengutronix e.K. - Linux Solutions for Science and Industry ----------------------------------------------------------- Kontakt-Informationen finden Sie im Header dieser Mail oder auf der Webseite -> http://www.pengutronix.de/impressum/ <-
Menon
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
Sascha,
Quoted 6 lines
-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Thursday, May 08, 2008 10:16 AM
To: Menon, Nishanth
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [Patch 2/4] U-Boot-V2: ARM: introduceCONFIG_SKIP_RELOCATION
Quoted 7 lines
Quoted 1 line
Hmm.. good point. My ignorance on ppc is kicking me ;).. I will remove the
SKIP_COPYpart from mypatch. Couple of questions:
Quoted 1 line
a) Are we ok with removing dependency of ARM from "config
SKIP_LOWLEVEL_INIT" in common/Kconfig (asopposed to my patch in which I moved it to
arch/arm/Kconfig)? Considering that it is used:arch/m68k/cpu/start-mcfv4e.Sso
SKIP_LOWLEVEL_INITwould depend onCONFIG_ARCH_HAS_INIT_LOWLEVEL?
No it should not. It should ideally be CONFIG_MACH_HAS_INIT_LOWLEVEL? And enabling this will call board_init_lowlevel.
Regards,
Nishanth Menon
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
In reply to Sascha HauerQuoted 7 lines · In message <[email protected]> you wrote:
CONFIG_RELOCATABLEon powerpc means something different. On arm we start U-Boot by running it at an address != link address and _copy_ (not relocate) ourselves to the address we are linked at. On powerpc real relocation is done ifCONFIG_RELOCATABLEis enabled.
Hence the option you wanted to add should better have the nameCONFIG_SKIP_COPY_TO_SDRAMor something like that.
This is something that I always wanted to fix. The ARM implementation is broken by design - unfortunately it has been also used for MIPS, and other architectures. It would be much better if we had real relocation to a (dynamically determined) address on ARM too, instead of such a fixed mapping.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It's a small world, but I wouldn't want to paint it.
PATCH 2/4 U-Boot-V2: ARM: introduceCONFIG_SKIP_RELOCATION
Quoted 13 lines
Quoted 6 lines
CONFIG_RELOCATABLEon powerpc means something different. On arm we start U-Boot by running it at an address != link address and _copy_ (not relocate) ourselves to the address we are linked at. On powerpc real relocation is done ifCONFIG_RELOCATABLEis enabled.
Hence the option you wanted to add should better have the nameCONFIG_SKIP_COPY_TO_SDRAMor something like that.This is something that I always wanted to fix. The ARM implementation is broken by design - unfortunately it has been also used for MIPS, and other architectures. It would be much better if we had real relocation to a (dynamically determined) address on ARM too, instead of such a fixed mapping.
Quoted 4 lines
Best regards,
Wolfgang Denk
As more and more architectures support booting from just about anything than a parallel flash, maybe it is better to have a CONFIG_COPY_TO_SDRAM than its negative form.
Whats the big benefit of beeing able to select where U-boot runs? I could understand if there was a need for a compile time parameter.
Best Regards
Ulf Samuelsson
PATCH 2/4 U-Boot-V2: ARM: introduce CONFIG_SKIP_RELOCATION
In reply to Wolfgang DenkQuoted 9 lines · Wolfgang Denk
Quoted 7 lines · In message <[email protected]> you wrote:
CONFIG_RELOCATABLEon powerpc means something different. On arm we start U-Boot by running it at an address != link address and _copy_ (not relocate) ourselves to the address we are linked at. On powerpc real relocation is done ifCONFIG_RELOCATABLEis enabled.
Hence the option you wanted to add should better have the nameCONFIG_SKIP_COPY_TO_SDRAMor something like that.
Quoted 5 lines
This is something that I always wanted to fix. The ARM implementation is broken by design - unfortunately it has been also used for MIPS, and other architectures. It would be much better if we had real relocation to a (dynamically determined) address on ARM too, instead of such a fixed mapping.
I wouldn't say broken. With a fixed mapping you get smaller code size and for many cases it's just enough. So I vote for having both.
Regards
Sascha
Signature · 4 lines
Pengutronix e.K. - Linux Solutions for Science and Industry ----------------------------------------------------------- Kontakt-Informationen finden Sie im Header dieser Mail oder auf der Webseite -> http://www.pengutronix.de/impressum/ <-