summaryrefslogtreecommitdiff
path: root/src/soc/intel/baytrail/Makefile.inc
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-04-02 20:46:13 -0500
committerMarc Jones <marc.jones@se-eng.com>2014-10-28 18:01:13 +0100
commit1131889570836da2ee63f5eacb46ce31d3a55276 (patch)
tree95de33d6f75f510b316f5de54ba746243c677328 /src/soc/intel/baytrail/Makefile.inc
parent31ac9e3a9a53523ad342af55b9a20c3c51cd927a (diff)
downloadcoreboot-1131889570836da2ee63f5eacb46ce31d3a55276.tar.xz
baytrail: handle MRC being an ELF file
Provide the option to embed MRC as an ELF file and not just binary blob. This allows for MRC to be relocated. BUG=chrome-os-partner:27654 BRANCH=rambi TEST=Built and booted rambi. Change-Id: I2e177c155a3074e4e1d450b1a73b7299aebd5286 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192893 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> (cherry picked from commit 89c97d5e2023b8c5cc780e1b1d532d0a586512f9) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Reviewed-on: http://review.coreboot.org/7214 Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/soc/intel/baytrail/Makefile.inc')
-rw-r--r--src/soc/intel/baytrail/Makefile.inc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/soc/intel/baytrail/Makefile.inc b/src/soc/intel/baytrail/Makefile.inc
index 94f3241dfb..464b63919f 100644
--- a/src/soc/intel/baytrail/Makefile.inc
+++ b/src/soc/intel/baytrail/Makefile.inc
@@ -88,10 +88,16 @@ ifeq ($(CONFIG_HAVE_ME_BIN),y)
mv $(obj)/coreboot.pre.new $(obj)/coreboot.pre
endif
+# If an MRC file is an ELF file determine the entry address and first loadable
+# section offset in the file. Subtract the offset from the entry address to
+# determine the final location.
+mrcelfoffset = $(shell readelf -S -W $(CONFIG_MRC_FILE) | sed -e 's/\[ /[0/' | awk '$$3 ~ /PROGBITS/ { print "0x"$$5; exit }' )
+mrcelfentry = $(shell readelf -h -W $(CONFIG_MRC_FILE) | grep 'Entry point address' | awk '{print $$NF }')
+
# Add memory reference code blob.
cbfs-files-$(CONFIG_HAVE_MRC) += mrc.bin
mrc.bin-file := $(call strip_quotes,$(CONFIG_MRC_FILE))
-mrc.bin-position := $(CONFIG_MRC_BIN_ADDRESS)
+mrc.bin-position := $(if $(findstring elf,$(CONFIG_MRC_FILE)),$(shell printf "0x%x" $$(( $(mrcelfentry) - $(mrcelfoffset) )) ),$(CONFIG_MRC_BIN_ADDRESS))
mrc.bin-type := 0xab
PHONY += baytrail_add_me