[U-Boot] [PATCH 8/8] mips: bmips: add support for raw .elf images
Álvaro Fernández Rojas
noltari at gmail.com
Thu Apr 13 15:44:40 UTC 2017
CFE supports loading .elf images instead of raw binaries.
Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
Makefile | 22 ++++++++++++++++++++++
arch/mips/cpu/u-boot-elf.lds | 10 ++++++++++
2 files changed, 32 insertions(+)
create mode 100644 arch/mips/cpu/u-boot-elf.lds
diff --git a/Makefile b/Makefile
index 09b597d..667b5f2 100644
--- a/Makefile
+++ b/Makefile
@@ -568,6 +568,15 @@ ifndef LDSCRIPT
endif
endif
+ifndef LDSCRIPT_ELF
+ ifeq ($(wildcard $(LDSCRIPT_ELF)),)
+ LDSCRIPT_ELF := $(srctree)/$(CPUDIR)/u-boot-elf.lds
+ endif
+ ifeq ($(wildcard $(LDSCRIPT_ELF)),)
+ LDSCRIPT_ELF := $(srctree)/arch/$(ARCH)/cpu/u-boot-elf.lds
+ endif
+endif
+
else
# Dummy target needed, because used as prerequisite
include/config/auto.conf: ;
@@ -786,6 +795,7 @@ ifneq ($(CONFIG_SPL_TARGET),)
ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
endif
ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf
+ALL-$(CONFIG_ARCH_BMIPS) += u-boot-bmips.elf
ALL-$(CONFIG_EFI_APP) += u-boot-app.efi
ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi
@@ -1192,6 +1202,15 @@ u-boot.elf: u-boot.bin
--defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
-Ttext=$(CONFIG_SYS_TEXT_BASE)
+# Rules to link u-boot-bmips
+quiet_cmd_u-boot-bmips ?= LD $@
+ cmd_u-boot-bmips ?= $(LD) -e startup -T u-boot-elf.lds \
+ -Ttext $(CONFIG_SYS_TEXT_BASE) -o $@ u-boot-bmips.o
+
+u-boot-bmips.elf: u-boot.bin u-boot-elf.lds
+ $(Q)$(LD) -r -b binary --oformat elf32-tradbigmips -o u-boot-bmips.o $<
+ $(call if_changed,u-boot-bmips)
+
# Rule to link u-boot
# May be overridden by arch/$(ARCH)/config.mk
quiet_cmd_u-boot__ ?= LD $@
@@ -1340,6 +1359,9 @@ cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
u-boot.lds: $(LDSCRIPT) prepare FORCE
$(call if_changed_dep,cpp_lds)
+u-boot-elf.lds: $(LDSCRIPT_ELF) prepare
+ $(call if_changed_dep,cpp_lds)
+
spl/u-boot-spl.bin: spl/u-boot-spl
@:
spl/u-boot-spl: tools prepare \
diff --git a/arch/mips/cpu/u-boot-elf.lds b/arch/mips/cpu/u-boot-elf.lds
new file mode 100644
index 0000000..db0bb46
--- /dev/null
+++ b/arch/mips/cpu/u-boot-elf.lds
@@ -0,0 +1,10 @@
+OUTPUT_ARCH(mips)
+SECTIONS {
+ .text : {
+ startup = .;
+ *(.text)
+ *(.text.*)
+ *(.data)
+ *(.data.*)
+ }
+}
--
2.1.4
More information about the U-Boot
mailing list