summaryrefslogtreecommitdiff
path: root/tools/rksd.c
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/rksd.c
parent5cc5b901e6d319af18b8dc59537c503bbd3ca7f0 (diff)
downloadu-boot-7bf274b9caab6de072d4dab34ab0aa66bb128195.tar.gz
u-boot-7bf274b9caab6de072d4dab34ab0aa66bb128195.tar.bz2
u-boot-7bf274b9caab6de072d4dab34ab0aa66bb128195.zip
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/rksd.c')
-rw-r--r--tools/rksd.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/tools/rksd.c b/tools/rksd.c
index 39f5c75e69..a2baa74d31 100644
--- a/tools/rksd.c
+++ b/tools/rksd.c
@@ -13,18 +13,7 @@
#include "mkimage.h"
#include "rkcommon.h"
-enum {
- RKSD_SPL_HDR_START = RK_INIT_OFFSET * RK_BLK_SIZE,
- RKSD_SPL_START = RKSD_SPL_HDR_START + 4,
- RKSD_HEADER_LEN = RKSD_SPL_START,
-};
-
-static char dummy_hdr[RKSD_HEADER_LEN];
-
-static int rksd_check_params(struct image_tool_params *params)
-{
- return 0;
-}
+static char dummy_hdr[RK_IMAGE_HEADER_LEN];
static int rksd_verify_header(unsigned char *buf, int size,
struct image_tool_params *params)
@@ -42,15 +31,16 @@ static void rksd_set_header(void *buf, struct stat *sbuf, int ifd,
unsigned int size;
int ret;
- size = params->file_size - RKSD_SPL_HDR_START;
- ret = rkcommon_set_header(buf, size);
+ 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);
}
- memcpy(buf + RKSD_SPL_HDR_START, "RK32", 4);
+ memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
+ RK_SPL_HDR_SIZE);
}
static int rksd_extract_subimage(void *buf, struct image_tool_params *params)
@@ -72,7 +62,7 @@ static int rksd_vrec_header(struct image_tool_params *params,
{
int pad_size;
- pad_size = RKSD_SPL_HDR_START + RK_MAX_CODE1_SIZE;
+ pad_size = RK_SPL_HDR_START + rkcommon_get_spl_size(params);
debug("pad_size %x\n", pad_size);
return pad_size - params->file_size;
@@ -84,9 +74,9 @@ static int rksd_vrec_header(struct image_tool_params *params,
U_BOOT_IMAGE_TYPE(
rksd,
"Rockchip SD Boot Image support",
- RKSD_HEADER_LEN,
+ RK_IMAGE_HEADER_LEN,
dummy_hdr,
- rksd_check_params,
+ rkcommon_check_params,
rksd_verify_header,
rksd_print_header,
rksd_set_header,