summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2018-11-26 18:21:15 -0800
committerYe Li <ye.li@nxp.com>2020-04-26 23:26:29 -0700
commit3596a6132f6b0a04d25c723dff60f786afc9f228 (patch)
tree32a0c88acbfa8c333094d56fe3150cf87b2d4a57 /common
parent6262298f192f9e8a0f4ef398337d1f6c111a4470 (diff)
MLK-20467 imx8m: Fix issue for booting signed image through uuu
The SPL loads the FIT image FDT part to an address related with the device block length. This length is 512 for SD/MMC and is 1 for other devices like SDP, NOR, NAND, SPI, etc. When signing FIT image, we use fixed address caculated by SD/MMC block length to sign FDT part. Thus, when booting through uuu, this causes mismatch and gets authentication failed. Fix the issue by providing a override function for this FIT buffer address. When secure boot is enabled, adjust the addresses of other devices to be same with SD/MMC. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> (cherry picked from commit 710efd3ccb99e144bd30af8e1ee46459b4a54dd6) (cherry picked from commit f48835f0b6b801cb267b4c27a50136c93dfd3bcf)
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_fit.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 96136e7795..1bf9760667 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -33,6 +33,13 @@ __weak ulong board_spl_fit_size_align(ulong size)
return size;
}
+__weak void* board_spl_fit_buffer_addr(ulong fit_size, int bl_len)
+{
+ int align_len = ARCH_DMA_MINALIGN - 1;
+ return (void *)((CONFIG_SYS_TEXT_BASE - fit_size - bl_len -
+ align_len) & ~align_len);
+}
+
static int find_node_from_desc(const void *fit, int node, const char *str)
{
int child;
@@ -514,7 +521,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
struct spl_image_info image_info;
int node = -1;
int images, ret;
- int base_offset, hsize, align_len = ARCH_DMA_MINALIGN - 1;
+ int base_offset;
int index = 0;
int firmware_node;
@@ -545,8 +552,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
* For FIT with data embedded, data is loaded as part of FIT image.
* For FIT with external data, data is not loaded in this step.
*/
- hsize = (size + info->bl_len + align_len) & ~align_len;
- fit = spl_get_load_buffer(-hsize, hsize);
+ fit = board_spl_fit_buffer_addr(size, info->bl_len);
sectors = get_aligned_image_size(info, size, 0);
count = info->read(info, sector, sectors, fit);
debug("fit read sector %lx, sectors=%d, dst=%p, count=%lu, size=0x%lx\n",