From 510c7374e2aea5846da1a29ea34067101c058220 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <tpearson@raptorengineeringinc.com>
Date: Mon, 18 Apr 2016 16:40:00 +0000
Subject: [PATCH 01/15] tools/rkspi: Warn when SPL image size is too large

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
---
 tools/rkspi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/rkspi.c b/tools/rkspi.c
index a0b0051..0505fc2 100644
--- a/tools/rkspi.c
+++ b/tools/rkspi.c
@@ -1,4 +1,5 @@
 /*
+ * (C) 2016 Raptor Engineering, LLC
  * (C) Copyright 2015 Google,  Inc
  * Written by Simon Glass <sjg@chromium.org>
  *
@@ -81,6 +82,15 @@ static int rkspi_vrec_header(struct image_tool_params *params,
 			     struct image_type_params *tparams)
 {
 	int pad_size;
+	int spl_size;
+
+	spl_size = params->file_size - tparams->header_size;
+	if (spl_size > 0x7830) {
+		/* TODO(sjg@chromium.org): This method should return an error */
+		printf("Warning: SPL image is too large (size %#x) and will not boot (limit %#x)\n",
+		spl_size, 0x7830);
+	}
+
 
 	pad_size = (rkcommon_get_spl_size(params) + 0x7ff) / 0x800 * 0x800;
 	params->orig_file_size = pad_size;
-- 
1.9.1

