summaryrefslogtreecommitdiff
path: root/core/cortex-m
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-09-25 14:39:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-25 19:36:37 -0700
commit094a81f5deff3b8cf5342138afefef8d8f34f8ff (patch)
tree5e0624367d5b9b7ca1c25b877db217b999f8e80c /core/cortex-m
parente9000b22cb0e15df7d1389da30d78e7244086d0b (diff)
downloadchrome-ec-094a81f5deff3b8cf5342138afefef8d8f34f8ff.tar.gz
cleanup: Handle signed RW images a bit cleaner
For signed EC RW images (CONFIG_RWSIG), there's no point in embedding the public key or signature into the image itself since it will just be replaced by the signer (either as the next step in the build process, or after the fact for MP releases). This takes that out and just points to where the pubkey and signature will be placed. BUG=none BRANCH=none TEST=make buildall I also checked the signatures with futility show -t build/*/ec.bin They still look good, and the one signed image I booted (Cr50) works as before. Change-Id: Ib39b7c508914851f81a1bebb2450e08ef0def76c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/302630 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'core/cortex-m')
-rw-r--r--core/cortex-m/ec.lds.S33
1 files changed, 8 insertions, 25 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index ca99d43b1b..3e026331fe 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -40,11 +40,6 @@ MEMORY
ORIGIN = CONFIG_PROGRAM_MEMORY_BASE + FW_MEM_OFF(SECTION), \
LENGTH = FW_SIZE(SECTION)
#endif /* CONFIG_EXTERNAL_STORAGE */
-#ifdef RSA_PUBLIC_KEY_SIZE
- PSTATE(r) : \
- ORIGIN = FW_OFF(SECTION) + FW_SIZE(SECTION), \
- LENGTH = CONFIG_FW_PSTATE_SIZE
-#endif
#ifdef CONFIG_USB_RAM_SIZE
USB_RAM (rw) : \
ORIGIN = CONFIG_USB_RAM_BASE, \
@@ -266,24 +261,6 @@ SECTIONS
/* NOTHING MAY GO AFTER THIS! */
} > IRAM
-#ifdef RSA_PUBLIC_KEY_SIZE
-#ifdef SECTION_IS_RO
- .flash_suffix : {
- FILL(0xff);
- /*
- * Put the public key coefficients at the end of the partition
- * after the pstate bits.
- */
- . = ORIGIN(PSTATE) + LENGTH(PSTATE) - RSA_PUBLIC_KEY_SIZE;
- *(.rsa_pubkey)
- } > PSTATE
-#else /* RW section: we don't need the RSA public key, put it anywhere */
- .flash_suffix : AT(LOADADDR(.data) + SIZEOF(.data)) {
- *(.rsa_pubkey)
- } > FLASH
-#endif
-#endif
-
/* The linker won't notice if the .data section is too big to fit,
* apparently because we're sending it into IRAM, not FLASH. The following
* symbol isn't used by the code, but running "objdump -t *.elf | grep hey"
@@ -291,8 +268,14 @@ SECTIONS
* explicit ASSERT afterwards will cause the linker to abort if we use too
* much. */
__hey_flash_used = LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION);
- ASSERT(FW_SIZE(SECTION) >=
- (LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION)),
+ ASSERT((FW_SIZE(SECTION)
+#if defined(CONFIG_RWSIG) && defined(SECTION_IS_RO)
+ - CONFIG_RO_PUBKEY_SIZE
+#endif
+#if defined(CONFIG_RWSIG) && defined(SECTION_IS_RW)
+ - CONFIG_RW_SIG_SIZE
+#endif
+ ) >= (LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION)),
"No room left in the flash")
#ifdef CONFIG_USB_RAM_SIZE