summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kconfig5
-rw-r--r--Makefile11
-rw-r--r--arch/mips/config.mk1
-rw-r--r--arch/u-boot-elf.lds9
4 files changed, 19 insertions, 7 deletions
diff --git a/Kconfig b/Kconfig
index b4864cdf8d..f698e0a94f 100644
--- a/Kconfig
+++ b/Kconfig
@@ -299,6 +299,11 @@ config ERR_PTR_OFFSET
pointer values - up to 'MAX_ERRNO' bytes below this value must be
unused/invalid addresses.
+config PLATFORM_ELFENTRY
+ string
+ default "__start" if MIPS
+ default "_start"
+
endmenu # General setup
menu "Boot images"
diff --git a/Makefile b/Makefile
index 7fae3c2f64..0db44d4249 100644
--- a/Makefile
+++ b/Makefile
@@ -1647,18 +1647,17 @@ OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \
u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE
$(call if_changed,pad_cat)
-# Create a new ELF from a raw binary file.
-ifndef PLATFORM_ELFENTRY
- PLATFORM_ELFENTRY = "_start"
-endif
quiet_cmd_u-boot-elf ?= LD $@
cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \
- --defsym=$(PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \
+ -T u-boot-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \
-Ttext=$(CONFIG_SYS_TEXT_BASE)
-u-boot.elf: u-boot.bin
+u-boot.elf: u-boot.bin u-boot-elf.lds
$(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o
$(call if_changed,u-boot-elf)
+u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
+ $(call if_changed_dep,cpp_lds)
+
# MediaTek's ARM-based u-boot needs a header to contains its load address
# which is parsed by the BootROM.
# If the SPL build is enabled, the header will be added to the spl binary,
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 9d3a84539a..527fd6a2fd 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -36,7 +36,6 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000
endif
PLATFORM_CPPFLAGS += -D__MIPS__
-PLATFORM_ELFENTRY = "__start"
PLATFORM_ELFFLAGS += -B mips $(OBJCOPYFLAGS)
#
diff --git a/arch/u-boot-elf.lds b/arch/u-boot-elf.lds
new file mode 100644
index 0000000000..1666027e36
--- /dev/null
+++ b/arch/u-boot-elf.lds
@@ -0,0 +1,9 @@
+ENTRY(CONFIG_PLATFORM_ELFENTRY)
+SECTIONS
+{
+ . = CONFIG_PLATFORM_ELFENTRY;
+
+ .data : {
+ *(.data*)
+ }
+}