All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aneesh V <aneesh@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH] arm: provide a CONFIG flag for disabling relocation
Date: Fri, 25 Mar 2011 18:57:04 +0530	[thread overview]
Message-ID: <4D8C9828.9060503@ti.com> (raw)
In-Reply-To: <1301058732-30898-1-git-send-email-aneesh@ti.com>

Forgot to mention that this patch depends on my previous series for MMC
spl:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/96352

This one was anyway intended to initiate the discussion. If approved,
I shall create a cleaner patch.

On Friday 25 March 2011 06:42 PM, Aneesh V wrote:
> Relocation may not be needed and desirable in many cases:
>   * For many boards the amount of SDRAM is fixed.
>     So relocation is not needed.
>   * Relocation adds un-necessary additional overhead when
>     it's not needed. This delay is singificant on slower
>     platforms such as FPGA
>   * Many boards have ample memory. So reserving enough memory
>     for Linux in the first half is not a challenge even without
>     relocation
>
> Add a CONFIG option to disable relocation on platforms that
> do not need it. When this flag is enabled allocate memory
> for stack heap etc at the end of memory as usual, but U-Boot
> itself is not moved from TEXT_BASE.
>
> Additionally, -pie is removed from the final link step because
> it was causing the absolute value of all symbols coming from
> the linker script to be 0. This affects find_cmd()
>
> Tested on OMAP4430 SDP
>
> Cc: Albert Aribaud<albert.aribaud@free.fr>
> Cc: Wolfgang Denk<wd@denx.de>
>
> Signed-off-by: Aneesh V<aneesh@ti.com>
> ---
>   arch/arm/config.mk              |    2 ++
>   arch/arm/lib/board.c            |    5 +++++
>   board/ti/sdp4430/config.mk      |    9 +++++++--
>   include/configs/omap4_sdp4430.h |    2 ++
>   4 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/config.mk b/arch/arm/config.mk
> index 1785e73..2315bcb 100644
> --- a/arch/arm/config.mk
> +++ b/arch/arm/config.mk
> @@ -71,5 +71,7 @@ LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
>
>   # needed for relocation
>   ifndef CONFIG_NAND_SPL
> +ifndef CONFIG_SYS_SKIP_ARM_RELOCATION
>   LDFLAGS_u-boot += -pie
>   endif
> +endif
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 72ee108..ed3898f 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -361,6 +361,7 @@ void board_init_f (ulong bootflag)
>   	gd->fb_base = addr;
>   #endif /* CONFIG_LCD */
>
> +#ifndef CONFIG_SYS_SKIP_ARM_RELOCATION
>   	/*
>   	 * reserve memory for U-Boot code, data&  bss
>   	 * round down to next 4 kB limit
> @@ -369,6 +370,7 @@ void board_init_f (ulong bootflag)
>   	addr&= ~(4096 - 1);
>
>   	debug ("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len>>  10, addr);
> +#endif
>
>   #ifndef CONFIG_PRELOADER
>   	/*
> @@ -420,6 +422,9 @@ void board_init_f (ulong bootflag)
>   	dram_init_banksize();
>   	display_dram_config();	/* and display it */
>
> +#ifdef CONFIG_SYS_SKIP_ARM_RELOCATION
> +	addr = _TEXT_BASE;
> +#endif
>   	gd->relocaddr = addr;
>   	gd->start_addr_sp = addr_sp;
>   	gd->reloc_off = addr - _TEXT_BASE;
> diff --git a/board/ti/sdp4430/config.mk b/board/ti/sdp4430/config.mk
> index c62965d..8846732 100644
> --- a/board/ti/sdp4430/config.mk
> +++ b/board/ti/sdp4430/config.mk
> @@ -28,5 +28,10 @@
>   # Linux-Kernel is expected to be at 8000'8000, entry 8000'8000
>   # (mem base + reserved)
>
> -# 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
> -CONFIG_SYS_TEXT_BASE = 0x80100000
> +# 64MB into the SDRAM
> +# Assuming a minimum of 128 MB on the board:
> +# - 64MB before U-Boot is more than enough for Linux when relocation is
> +#   disabled
> +# - ~63MB after the U-Boot is more than enough for U-Boot to relocate
> +#   itself without stepping on itself
> +CONFIG_SYS_TEXT_BASE = 0x84000000
> diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h
> index fff67d8..e9f76d3 100644
> --- a/include/configs/omap4_sdp4430.h
> +++ b/include/configs/omap4_sdp4430.h
> @@ -278,4 +278,6 @@
>   #define CONFIG_SYS_SPL_BSS_MAX_SIZE		0x80000		/* 512 KB */
>
>   #define CONFIG_SYS_THUMB_BUILD
> +
> +#define CONFIG_SYS_SKIP_ARM_RELOCATION
>   #endif /* __CONFIG_H */

  reply	other threads:[~2011-03-25 13:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 13:12 [U-Boot] [RFC PATCH] arm: provide a CONFIG flag for disabling relocation Aneesh V
2011-03-25 13:27 ` Aneesh V [this message]
2011-03-25 14:12 ` Wolfgang Denk
2011-03-25 16:12   ` Aneesh V
2011-03-25 18:35     ` Albert ARIBAUD
2011-04-20 18:34       ` Simon Glass
2011-04-21  6:56         ` Aneesh V
2011-04-21 15:18           ` Simon Glass
  -- strict thread matches above, loose matches on Subject: below --
2011-09-20 14:22 GROYER, Anthony
2011-09-20 18:09 ` Wolfgang Denk
2011-09-20 19:13   ` Albert ARIBAUD
2011-09-21  9:29     ` GROYER, Anthony
2011-09-21 10:45       ` Wolfgang Denk
2011-09-21 11:44         ` Albert ARIBAUD
2011-09-21 10:51       ` Albert ARIBAUD
2011-09-21 11:20         ` Andreas Bießmann
2011-09-21 12:03           ` Albert ARIBAUD
2011-09-21 12:31             ` Andreas Bießmann
2011-09-21 14:23               ` Albert ARIBAUD
2011-09-22  7:10                 ` Andreas Bießmann
2011-09-29 16:14               ` Andreas Bießmann
2011-09-30  7:21                 ` Simon Schwarz
2011-10-01  6:48                   ` Albert ARIBAUD
2011-09-20 21:34 ` Simon Glass
2011-09-21 14:21   ` Aneesh V
2011-09-23 16:04     ` Simon Glass
2011-10-01  7:01       ` Albert ARIBAUD
2011-10-03  3:34         ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D8C9828.9060503@ti.com \
    --to=aneesh@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.