linker: Modify linker scripts to be more generic
Make use of "IMAGE_MAX_SIZE" and "IMAGE_TEXT_BASE" rather than CONFIG_SPL_MAX_SIZE and CONFIG_SPL_TEXT_BASE. This lets us re-use the same script for both SPL and TPL. Add logic to scripts/Makefile.spl to pass in the right value when preprocessing the script. Cc: Stefano Babic <sbabic@denx.de> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Jagan Teki <jagan@openedev.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: Andreas Bießmann <andreas@biessmann.org> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Cc: Michal Simek <monstr@monstr.eu> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Cc: York Sun <york.sun@nxp.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Heiko Schocher <hs@denx.de> Cc: Adam Ford <aford173@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Tested-by: Adam Ford <aford173@gmail.com> #da850evm & omap3_logic_somlv Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
This commit is contained in:
parent
b32ba6f12e
commit
2f41ade79e
@ -8,8 +8,8 @@
|
|||||||
* Aneesh V <aneesh@ti.com>
|
* Aneesh V <aneesh@ti.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ OUTPUT_ARCH(arm)
|
|||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
. = CONFIG_SPL_TEXT_BASE;
|
. = IMAGE_TEXT_BASE;
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.text :
|
.text :
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
* Texas Instruments, <www.ti.com>
|
* Texas Instruments, <www.ti.com>
|
||||||
* Aneesh V <aneesh@ti.com>
|
* Aneesh V <aneesh@ti.com>
|
||||||
*/
|
*/
|
||||||
MEMORY { .nor : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .nor : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .bss : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .bss : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
|
|
||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
OUTPUT_ARCH(arm)
|
OUTPUT_ARCH(arm)
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
* Texas Instruments, <www.ti.com>
|
* Texas Instruments, <www.ti.com>
|
||||||
* Aneesh V <aneesh@ti.com>
|
* Aneesh V <aneesh@ti.com>
|
||||||
*/
|
*/
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
* Aneesh V <aneesh@ti.com>
|
* Aneesh V <aneesh@ti.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR,
|
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR,
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ SECTIONS
|
|||||||
.ARM.exidx : { *(.ARM.exidx*) }
|
.ARM.exidx : { *(.ARM.exidx*) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_SPL_MAX_SIZE)
|
#if defined(IMAGE_MAX_SIZE)
|
||||||
ASSERT(__image_copy_end - __image_copy_start < (CONFIG_SPL_MAX_SIZE), \
|
ASSERT(__image_copy_end - __image_copy_start < (IMAGE_MAX_SIZE), \
|
||||||
"SPL image too big");
|
"SPL image too big");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* Bo Shen <voice.shen@atmel.com>
|
* Bo Shen <voice.shen@atmel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE, \
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE, \
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
@ -49,8 +49,8 @@ SECTIONS
|
|||||||
} >.sdram
|
} >.sdram
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_SPL_MAX_SIZE)
|
#if defined(IMAGE_MAX_SIZE)
|
||||||
ASSERT(__image_copy_end - __start < (CONFIG_SPL_MAX_SIZE), \
|
ASSERT(__image_copy_end - __start < (IMAGE_MAX_SIZE), \
|
||||||
"SPL image too big");
|
"SPL image too big");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
* Bo Shen <voice.shen@atmel.com>
|
* Bo Shen <voice.shen@atmel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE, \
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE, \
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* Aneesh V <aneesh@ti.com>
|
* Aneesh V <aneesh@ti.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -75,9 +75,6 @@ config ROCKCHIP_RK3288
|
|||||||
|
|
||||||
if ROCKCHIP_RK3288
|
if ROCKCHIP_RK3288
|
||||||
|
|
||||||
config TPL_LDSCRIPT
|
|
||||||
default "arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds"
|
|
||||||
|
|
||||||
config TPL_TEXT_BASE
|
config TPL_TEXT_BASE
|
||||||
default 0xff704000
|
default 0xff704000
|
||||||
|
|
||||||
@ -120,9 +117,6 @@ config ROCKCHIP_RK3368
|
|||||||
|
|
||||||
if ROCKCHIP_RK3368
|
if ROCKCHIP_RK3368
|
||||||
|
|
||||||
config TPL_LDSCRIPT
|
|
||||||
default "arch/arm/mach-rockchip/rk3368/u-boot-tpl.lds"
|
|
||||||
|
|
||||||
config TPL_TEXT_BASE
|
config TPL_TEXT_BASE
|
||||||
default 0xff8c1000
|
default 0xff8c1000
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2018 Jagan Teki <jagan@amarulasolutions.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef CONFIG_SPL_TEXT_BASE
|
|
||||||
#define CONFIG_SPL_TEXT_BASE CONFIG_TPL_TEXT_BASE
|
|
||||||
|
|
||||||
#include "../../cpu/u-boot-spl.lds"
|
|
@ -1,12 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
||||||
/*
|
|
||||||
* (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef CONFIG_SPL_TEXT_BASE
|
|
||||||
#define CONFIG_SPL_TEXT_BASE CONFIG_TPL_TEXT_BASE
|
|
||||||
|
|
||||||
#undef CONFIG_SPL_MAX_SIZE
|
|
||||||
#define CONFIG_SPL_MAX_SIZE CONFIG_TPL_MAX_SIZE
|
|
||||||
|
|
||||||
#include "../../cpu/armv8/u-boot-spl.lds"
|
|
@ -7,8 +7,8 @@
|
|||||||
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||||
|
|
||||||
MEMORY { .spl_mem : ORIGIN = CONFIG_SPL_TEXT_BASE, \
|
MEMORY { .spl_mem : ORIGIN = IMAGE_TEXT_BASE, \
|
||||||
LENGTH = CONFIG_SPL_MAX_SIZE }
|
LENGTH = IMAGE_MAX_SIZE }
|
||||||
MEMORY { .bss_mem : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
MEMORY { .bss_mem : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
|
||||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
|
||||||
|
|
||||||
|
@ -18,11 +18,7 @@ PHDRS
|
|||||||
#endif
|
#endif
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_TPL_BUILD
|
. = IMAGE_TEXT_BASE;
|
||||||
. = CONFIG_TPL_TEXT_BASE;
|
|
||||||
#else
|
|
||||||
. = CONFIG_SPL_TEXT_BASE;
|
|
||||||
#endif
|
|
||||||
.text : {
|
.text : {
|
||||||
*(.text*)
|
*(.text*)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ SECTIONS
|
|||||||
/DISCARD/ : { *(.u_boot_list_2_cmd_*) }
|
/DISCARD/ : { *(.u_boot_list_2_cmd_*) }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
. = CONFIG_SPL_TEXT_BASE; /* Location of bootcode in flash */
|
. = IMAGE_TEXT_BASE; /* Location of bootcode in flash */
|
||||||
__text_start = .;
|
__text_start = .;
|
||||||
.text : { *(.text*); }
|
.text : { *(.text*); }
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
|
* Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_FOOTPRINT }
|
LENGTH = CONFIG_SPL_MAX_FOOTPRINT }
|
||||||
|
|
||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
|
* Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE,\
|
||||||
LENGTH = CONFIG_SPL_MAX_FOOTPRINT }
|
LENGTH = CONFIG_SPL_MAX_FOOTPRINT }
|
||||||
|
|
||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Based on arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
|
* Based on arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE, \
|
MEMORY { .sram : ORIGIN = IMAGE_TEXT_BASE, \
|
||||||
LENGTH = CONFIG_SPL_MAX_FOOTPRINT }
|
LENGTH = CONFIG_SPL_MAX_FOOTPRINT }
|
||||||
|
|
||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
|
@ -911,6 +911,8 @@ config TPL_BOARD_INIT
|
|||||||
config TPL_LDSCRIPT
|
config TPL_LDSCRIPT
|
||||||
string "Linker script for the TPL stage"
|
string "Linker script for the TPL stage"
|
||||||
depends on TPL
|
depends on TPL
|
||||||
|
default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
|
||||||
|
default "arch/$(ARCH)/cpu/u-boot-spl.lds"
|
||||||
help
|
help
|
||||||
The TPL stage will usually require a different linker-script
|
The TPL stage will usually require a different linker-script
|
||||||
(as it runs from a different memory region) than the regular
|
(as it runs from a different memory region) than the regular
|
||||||
|
@ -147,6 +147,15 @@ LDPPFLAGS += \
|
|||||||
$(shell $(LD) --version | \
|
$(shell $(LD) --version | \
|
||||||
sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
|
sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
|
||||||
|
|
||||||
|
# Turn various CONFIG symbols into IMAGE symbols for easy reuse of
|
||||||
|
# the scripts between SPL and TPL.
|
||||||
|
ifneq ($(CONFIG_$(SPL_TPL_)MAX_SIZE),)
|
||||||
|
LDPPFLAGS += -DIMAGE_MAX_SIZE=$(CONFIG_$(SPL_TPL_)MAX_SIZE)
|
||||||
|
endif
|
||||||
|
ifneq ($(CONFIG_$(SPL_TPL_)TEXT_BASE),)
|
||||||
|
LDPPFLAGS += -DIMAGE_TEXT_BASE=$(CONFIG_$(SPL_TPL_)TEXT_BASE)
|
||||||
|
endif
|
||||||
|
|
||||||
MKIMAGEOUTPUT ?= /dev/null
|
MKIMAGEOUTPUT ?= /dev/null
|
||||||
|
|
||||||
quiet_cmd_mkimage = MKIMAGE $@
|
quiet_cmd_mkimage = MKIMAGE $@
|
||||||
|
Loading…
Reference in New Issue
Block a user