From b6d3e1fa56f365796b40d86e9195f882f0690952 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sat, 9 Nov 2019 15:28:24 +0100 Subject: ARM: zynq: add size check in zynq_mkimage Currently Barebox does not support 2 stage loading on Zynq, so the image must fit into the free OCRAM area. Add a check to the mkimage tool to validate this. Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- scripts/zynq_mkimage.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/zynq_mkimage.c b/scripts/zynq_mkimage.c index bf214ca5d0..0a1c069472 100644 --- a/scripts/zynq_mkimage.c +++ b/scripts/zynq_mkimage.c @@ -283,6 +283,11 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + if (st.st_size > 192 * 1024) { + fprintf(stderr, "Image too big, will not fit in OCRAM!\n"); + exit(EXIT_FAILURE); + } + buf = calloc(st.st_size + IMAGE_OFFSET, sizeof(char)); if (!buf) { fprintf(stderr, "Unable to allocate buffer\n"); -- cgit v1.2.3