summaryrefslogtreecommitdiff
path: root/tools/rkcommon.h
diff options
context:
space:
mode:
authorJeffy Chen <jeffy.chen@rock-chips.com>2015-11-27 12:07:17 +0800
committerSimon Glass <sjg@chromium.org>2015-12-13 17:07:29 -0700
commit7bf274b9caab6de072d4dab34ab0aa66bb128195 (patch)
treea11415fdb979cbd17ef82c66cded67cc7ea6b6b6 /tools/rkcommon.h
parent5cc5b901e6d319af18b8dc59537c503bbd3ca7f0 (diff)
rockchip: mkimage: use imagename to select spl hdr & spl size
Our chips may have different spl size and spl header, so use imagename(passed by "mkimage -n") to select them now. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/rkcommon.h')
-rw-r--r--tools/rkcommon.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/tools/rkcommon.h b/tools/rkcommon.h
index 222156e7e8..c69540f5f3 100644
--- a/tools/rkcommon.h
+++ b/tools/rkcommon.h
@@ -12,10 +12,38 @@ enum {
RK_BLK_SIZE = 512,
RK_INIT_OFFSET = 4,
RK_MAX_BOOT_SIZE = 512 << 10,
- RK_MAX_CODE1_SIZE = 32 << 10,
+ RK_SPL_HDR_START = RK_INIT_OFFSET * RK_BLK_SIZE,
+ RK_SPL_HDR_SIZE = 4,
+ RK_SPL_START = RK_SPL_HDR_START + RK_SPL_HDR_SIZE,
+ RK_IMAGE_HEADER_LEN = RK_SPL_START,
};
/**
+ * rkcommon_check_params() - check params
+ *
+ * @return 0 if OK, -1 if ERROR.
+ */
+int rkcommon_check_params(struct image_tool_params *params);
+
+/**
+ * rkcommon_get_spl_hdr() - get 4-bytes spl hdr for a Rockchip boot image
+ *
+ * Rockchip's bootrom requires the spl loader to start with a 4-bytes
+ * header. The content of this header depends on the chip type.
+ */
+const char *rkcommon_get_spl_hdr(struct image_tool_params *params);
+
+/**
+ * rkcommon_get_spl_size() - get spl size for a Rockchip boot image
+ *
+ * Different chip may have different sram size. And if we want to jump
+ * back to the bootrom after spl, we may need to reserve some sram space
+ * for the bootrom.
+ * The spl loader size should be sram size minus reserved size(if needed)
+ */
+int rkcommon_get_spl_size(struct image_tool_params *params);
+
+/**
* rkcommon_set_header() - set up the header for a Rockchip boot image
*
* This sets up a 2KB header which can be interpreted by the Rockchip boot ROM.
@@ -24,6 +52,7 @@ enum {
* @file_size: Size of the file we want the boot ROM to load, in bytes
* @return 0 if OK, -ENOSPC if too large
*/
-int rkcommon_set_header(void *buf, uint file_size);
+int rkcommon_set_header(void *buf, uint file_size,
+ struct image_tool_params *params);
#endif