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>2018-11-27 02:57:03 -0800
commitc2b3e9b15700ca611fe9399f086c3b035ea2f763 (patch)
tree6410ce705b6f2e19e4e63de14b0b5fb72c0febb5 /common
parent6fc914b2da6810eb392bcb6de20b9cd7baf95e7f (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)
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 7595a33e81..80e784ac5c 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -25,6 +25,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);
+}
+
#ifdef CONFIG_DUAL_BOOTLOADER
extern int spl_fit_get_rbindex(const void *fit, int images);
#endif
@@ -369,7 +376,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, align_len = ARCH_DMA_MINALIGN - 1;
+ int base_offset;
int index = 0;
/*
@@ -399,8 +406,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.
*/
- fit = (void *)((CONFIG_SYS_TEXT_BASE - size - info->bl_len -
- align_len) & ~align_len);
+ 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",