From 6f8637a6dfc3588367df7d211f26ea5b67ebbea1 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 21 Aug 2015 13:27:56 -0700 Subject: cortex-m: provide ability to insert free space into RO image base Some platforms might expect the header of the image to be a certain platform specific blob. This patch adds an ability to insert an arbitrary size header in the binary blob, if so desired, the intention is to have the platform specific tools to postprocess the image and replace the header with sensible data. Ideally we should be able to produce an image which is mapped to start at an offset to the FLASH_BASE, but the macros in ec.S.lds files are way too smart for this. BRANCH=none BUG=chrome-os-partner:43025 TEST=with this and other changes the latest cr50 image gets signed and booted properly. Change-Id: Icabf00c6b90657b0ae3370ddad3567ccedf3ff49 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/295200 Reviewed-by: Shawn N --- core/cortex-m/ec.lds.S | 3 +++ include/config.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index dc9e829fa1..d0b90e5ada 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -68,6 +68,9 @@ SECTIONS } > SHARED_LIB #endif .text : { +#if defined(CONFIG_RO_HEAD_ROOM) + . = . + CONFIG_RO_HEAD_ROOM; +#endif OUTDIR/core/CORE/init.o (.text.vecttable) . = ALIGN(4); __version_struct_offset = .; diff --git a/include/config.h b/include/config.h index a527c67fed..b718941a12 100644 --- a/include/config.h +++ b/include/config.h @@ -1820,6 +1820,12 @@ */ #undef CONFIG_WP_ALWAYS +/* + * If needed to allocate some free space in the base of the RO section of the + * image, define this to be equal the required size of the free space. + */ +#undef CONFIG_RO_HEAD_ROOM + /*****************************************************************************/ /* * Include board and core configs, since those hold the CONFIG_ constants for a -- cgit v1.2.1