arc: Introduce a possibility to not relocate U-boot
PATCH 1/1 arc: Introduce a possibility to not relocate U-boot
From: Alexey Brodkin <[email protected]>
Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger which is capable of accessing much more specific hardware resources compared to gdb. For example it may show contents of L1 and L2 caches, internal states of some hardware blocks etc.
But on the downside MetaWare debugger still cannot work with PIE. Even though that limitation could be work-arounded with change of ELF's header and stripping down all debug info but with it we won't have debug info for source-level debugging which is quite inconvenient.
b) Some platforms which might benefit from usage of U-Boot basically don't have enough RAM to accommodate relocation of U-Boot so we keep code in flash and use as much of RAM as possible for more interesting things.
--- arch/arc/lib/relocate.c | 6 ++++++ arch/arc/lib/start.S | 8 +++++++- common/board_f.c | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-)
arch/arc/lib/relocate.c +6 -0
@@ -17,6 +17,9 @@ int copy_uboot_to_ram(void) {size_t len = (size_t )&__image_copy_end - (size_t )&__image_copy_start; +if (gd->flags &GD_FLG_SKIP_RELOC ) +return 0 ; +memcpy ((void *)gd->relocaddr, (void *)&__image_copy_start, len);return 0 ;
@@ -40,6 +43,9 @@ int do_elf_reloc_fixups(void)Elf32_Rela *re_src = (Elf32_Rela *)(&__rel_dyn_start);Elf32_Rela *re_end = (Elf32_Rela *)(&__rel_dyn_end); +if (gd->flags &GD_FLG_SKIP_RELOC ) +return 0 ; +debug ("Section .rela.dyn is located at %08x-%08x\n" , (unsigned int )re_src, (unsigned int )re_end);
arch/arc/lib/start.S +7 -1
@@ -78,7 +78,13 @@ ENTRY(_start) /* Zero the one and only argument of "board_init_f" */ mov_s %r0, 0 - j board_init_f + bl board_init_f + + /* We only get here if relocation is disabled by GD_FLG_SKIP_RELOC */ + /* Make sure we don't lose GD overwritten by zero new GD */ + mov %r0, %r25 + mov %r1, 0 + bl board_init_r ENDPROC(_start) /*
common/board_f.c +2 -1
@@ -904,7 +904,8 @@ void board_init_f(ulong boot_flags)hang ();#if !defined(CONFIG_ARM ) && !defined(CONFIG_SANDBOX ) && \ - !defined(CONFIG_EFI_APP ) && !CONFIG_IS_ENABLED (X86_64 ) + !defined(CONFIG_EFI_APP ) && !CONFIG_IS_ENABLED (X86_64 ) && \ + !defined(CONFIG_ARC )/* NOTREACHED - jump_to_copy() does not return */ hang ();#endif
Signature · 1 line
2.14.3
PATCH 1/1 arc: Introduce a possibility to not relocate U-boot
Quoted 24 lines · Alexey Brodkin
From: Alexey Brodkin <[email protected]>
Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger which is capable of accessing much more specific hardware resources compared to gdb. For example it may show contents of L1 and L2 caches, internal states of some hardware blocks etc.But on the downside MetaWare debugger still cannot work with PIE. Even though that limitation could be work-arounded with change of ELF's header and stripping down all debug info but with it we won't have debug info for source-level debugging which is quite inconvenient.
b) Some platforms which might benefit from usage of U-Boot basically don't have enough RAM to accommodate relocation of U-Boot so we keep code in flash and use as much of RAM as possible for more interesting things.
Signed-off-by Alexey Brodkin <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>Cc Heiko Schocher <[email protected]>Cc York Sun <[email protected]>Cc Stefan Roese <[email protected]>
Quoted 5 lines
--- arch/arc/lib/relocate.c | 6 ++++++ arch/arc/lib/start.S | 8 +++++++- common/board_f.c | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-)
PATCH 1/1 arc: Introduce a possibility to not relocate U-boot
Hi Simon, Tom,
Quoted 31 lines · Simon Glass
Quoted 24 lines · Alexey Brodkin
From: Alexey Brodkin <[email protected]>
Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger which is capable of accessing much more specific hardware resources compared to gdb. For example it may show contents of L1 and L2 caches, internal states of some hardware blocks etc.But on the downside MetaWare debugger still cannot work with PIE. Even though that limitation could be work-arounded with change of ELF's header and stripping down all debug info but with it we won't have debug info for source-level debugging which is quite inconvenient.
b) Some platforms which might benefit from usage of U-Boot basically don't have enough RAM to accommodate relocation of U-Boot so we keep code in flash and use as much of RAM as possible for more interesting things.
Signed-off-by Alexey Brodkin <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>Cc Heiko Schocher <[email protected]>Cc York Sun <[email protected]>Cc Stefan Roese <[email protected]>Quoted 5 lines
--- arch/arc/lib/relocate.c | 6 ++++++ arch/arc/lib/start.S | 8 +++++++- common/board_f.c | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-)
Quoted 1 line
Reviewed-by Simon Glass <[email protected]>
Is it OK if I pull this into my "next" tree?
I'm asking because common/board_f.c is affected even though that's just an addition of CONFIG_ARC in one #ifdef.
-Alexey
PATCH 1/1 arc: Introduce a possibility to not relocate U-boot
Hi Alexey,
Quoted 34 lines · Alexey Brodkin
Hi Simon, Tom,
Quoted 31 lines · Simon Glass
Quoted 29 lines · Alexey Brodkin
From: Alexey Brodkin <[email protected]>
Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger which is capable of accessing much more specific hardware resources compared to gdb. For example it may show contents of L1 and L2 caches, internal states of some hardware blocks etc.But on the downside MetaWare debugger still cannot work with PIE. Even though that limitation could be work-arounded with change of ELF's header and stripping down all debug info but with it we won't have debug info for source-level debugging which is quite inconvenient.
b) Some platforms which might benefit from usage of U-Boot basically don't have enough RAM to accommodate relocation of U-Boot so we keep code in flash and use as much of RAM as possible for more interesting things.
Signed-off-by Alexey Brodkin <[email protected]>Cc Simon Glass <[email protected]>Cc Bin Meng <[email protected]>Cc Heiko Schocher <[email protected]>Cc York Sun <[email protected]>Cc Stefan Roese <[email protected]>--- arch/arc/lib/relocate.c | 6 ++++++ arch/arc/lib/start.S | 8 +++++++- common/board_f.c | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 1 line
Reviewed-by Simon Glass <[email protected]>Is it OK if I pull this into my "next" tree?
I'm asking because
common/board_f.cis affected even though that's just an addition ofCONFIG_ARCin one #ifdef.
It is OK with me.
Regards,
Simon