summaryrefslogtreecommitdiff
path: root/tools/rksd.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/rksd.c')
-rw-r--r--tools/rksd.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/rksd.c b/tools/rksd.c
index ac8a67d..8627b6d 100644
--- a/tools/rksd.c
+++ b/tools/rksd.c
@@ -29,12 +29,20 @@ static void rksd_set_header(void *buf, struct stat *sbuf, int ifd,
unsigned int size;
int ret;
+ printf("params->file_size %d\n", params->file_size);
+ printf("params->orig_file_size %d\n", params->orig_file_size);
+
+ /*
+ * We need to calculate this using 'RK_SPL_HDR_START' and not using
+ * 'tparams->header_size', as the additional byte inserted when
+ * 'is_boot0' is true counts towards the payload.
+ */
size = params->file_size - RK_SPL_HDR_START;
ret = rkcommon_set_header(buf, size, params);
if (ret) {
/* TODO(sjg@chromium.org): This method should return an error */
- printf("Warning: SPL image is too large (size %#x) and will not boot\n",
- size);
+ printf("Warning: SPL image is too large (size %#x) and will "
+ "not boot\n", size);
}
}
@@ -51,18 +59,14 @@ static int rksd_check_image_type(uint8_t type)
return EXIT_FAILURE;
}
-/* We pad the file out to a fixed size - this method returns that size */
static int rksd_vrec_header(struct image_tool_params *params,
struct image_type_params *tparams)
{
- int pad_size;
-
- rkcommon_vrec_header(params, tparams);
-
- pad_size = RK_SPL_HDR_START + rkcommon_get_spl_size(params);
- debug("pad_size %x\n", pad_size);
-
- return pad_size - params->file_size - tparams->header_size;
+ /*
+ * Pad to the RK_BLK_SIZE (512 bytes) to be consistent with init_size
+ * being encoded in RK_BLK_SIZE units in header0 (see rkcommon.c).
+ */
+ return rkcommon_vrec_header(params, tparams, RK_BLK_SIZE);
}
/*