From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: Add option to disable code relocation
Date: Sun, 5 Feb 2012 13:05:47 +0100 [thread overview]
Message-ID: <201202051305.47342.marek.vasut@gmail.com> (raw)
In-Reply-To: <1328424259-12914-1-git-send-email-sjg@chromium.org>
> This permits disabling the code relation in U-Boot which is useful when
> debugging with an ICE.
>
> To use it define CONFIG_SYS_SKIP_ARM_RELOCATION in your board.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> arch/arm/config.mk | 2 ++
> arch/arm/cpu/armv7/start.S | 3 +--
> arch/arm/include/asm/global_data.h | 3 +++
> arch/arm/lib/board.c | 10 ++++++++++
> 4 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/config.mk b/arch/arm/config.mk
> index 45f9dca..46b52af 100644
> --- a/arch/arm/config.mk
> +++ b/arch/arm/config.mk
> @@ -79,5 +79,7 @@ endif
>
> # needed for relocation
> ifndef CONFIG_NAND_SPL
> +ifndef CONFIG_SYS_SKIP_ARM_RELOCATION
> LDFLAGS_u-boot += -pie
> endif
> +endif
> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
> index ef08a55..82eac7c 100644
> --- a/arch/arm/cpu/armv7/start.S
> +++ b/arch/arm/cpu/armv7/start.S
> @@ -183,8 +183,7 @@ stack_setup:
> mov sp, r4
>
> adr r0, _start
> - cmp r0, r6
> - moveq r9, #0 /* no relocation. relocation offset(r9) = 0 */
> + subs r9, r6, r0 /* r9 <- relocation offset */
> beq clear_bss /* skip relocation */
> mov r1, r6 /* r1 <- scratch for copy_loop */
> ldr r3, _image_copy_end_ofs
> diff --git a/arch/arm/include/asm/global_data.h
> b/arch/arm/include/asm/global_data.h index c3ff789..23a6077 100644
> --- a/arch/arm/include/asm/global_data.h
> +++ b/arch/arm/include/asm/global_data.h
> @@ -77,6 +77,9 @@ typedef struct global_data {
> unsigned long tlb_addr;
> #endif
> const void *fdt_blob; /* Our device tree, NULL if none */
> +#ifdef CONFIG_SYS_SKIP_ARM_RELOCATION
> + ulong malloc_end; /* End of malloc region (addr + 1) */
> +#endif
> void **jt; /* jump table */
> char env_buf[32]; /* buffer for getenv() before reloc. */
> #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 3d78274..81293c3 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -355,6 +355,7 @@ void board_init_f(ulong bootflag)
> #endif /* CONFIG_FB_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
> @@ -363,6 +364,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_SPL_BUILD
> /*
> @@ -419,6 +421,10 @@ void board_init_f(ulong bootflag)
> dram_init_banksize();
> display_dram_config(); /* and display it */
>
> +#ifdef CONFIG_SYS_SKIP_ARM_RELOCATION
> + gd->malloc_end = addr;
> + addr = _TEXT_BASE;
> +#endif
> gd->relocaddr = addr;
> gd->start_addr_sp = addr_sp;
> gd->reloc_off = addr - _TEXT_BASE;
> @@ -478,7 +484,11 @@ void board_init_r(gd_t *id, ulong dest_addr)
> #endif
>
> /* The Malloc area is immediately below the monitor copy in DRAM */
> +#ifdef CONFIG_SYS_SKIP_ARM_RELOCATION
> + malloc_start = gd->malloc_end - TOTAL_MALLOC_LEN;
> +#else
> malloc_start = dest_addr - TOTAL_MALLOC_LEN;
> +#endif
> mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
>
> #if !defined(CONFIG_SYS_NO_FLASH)
Why would you need this one ? Is there any user for this patch?
M
next prev parent reply other threads:[~2012-02-05 12:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-05 6:44 [U-Boot] [PATCH] arm: Add option to disable code relocation Simon Glass
2012-02-05 7:39 ` Mike Frysinger
2012-02-05 12:05 ` Marek Vasut
2012-02-05 20:38 ` Mike Frysinger
2012-02-05 21:40 ` Simon Glass
2012-02-05 22:44 ` Wolfgang Denk
2012-02-05 23:23 ` Graeme Russ
2012-02-05 23:32 ` Simon Glass
2012-02-05 23:37 ` Graeme Russ
2012-02-05 23:41 ` Simon Glass
2012-02-05 23:46 ` Graeme Russ
2012-02-07 9:52 ` Graeme Russ
2012-02-06 7:51 ` Wolfgang Denk
2012-02-06 8:43 ` Graeme Russ
2012-02-06 14:49 ` Tom Rini
2012-02-06 19:27 ` Mike Frysinger
2012-02-06 19:46 ` Tom Rini
2012-02-06 20:25 ` Graeme Russ
2012-02-07 6:41 ` Dirk Behme
2012-02-07 23:23 ` Wolfgang Denk
2012-02-07 23:28 ` Graeme Russ
2012-02-07 23:36 ` Wolfgang Denk
2012-02-07 23:48 ` Graeme Russ
2012-02-08 6:42 ` Dirk Behme
2012-02-08 6:51 ` Dirk Behme
2012-02-08 7:12 ` Simon Glass
2012-02-08 7:16 ` Dirk Behme
2012-02-08 22:05 ` Graeme Russ
2012-02-09 3:38 ` Graeme Russ
2012-02-09 18:30 ` Simon Glass
2012-02-08 14:03 ` Wolfgang Denk
2012-02-06 21:17 ` Albert ARIBAUD
2012-02-06 22:24 ` Wolfgang Denk
2012-02-07 6:51 ` Dirk Behme
2012-02-07 7:25 ` Aneesh V
2012-02-05 23:32 ` Simon Glass
2012-02-05 12:05 ` Marek Vasut [this message]
2012-02-05 18:54 ` Wolfgang Denk
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=201202051305.47342.marek.vasut@gmail.com \
--to=marek.vasut@gmail.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.