X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=tools%2Frksd.c;h=a2baa74d3121168503f65ea56ee3b3a9a0b16f68;hb=f36bbcceba2891bec17add339c7ff3241c3f6d94;hp=2efcd68c3ae77afdf1e843382acc182218b6ee73;hpb=f9a3c278b98a17eddbf0ad903689cce47e3e6f47;p=oweals%2Fu-boot.git diff --git a/tools/rksd.c b/tools/rksd.c index 2efcd68c3a..a2baa74d31 100644 --- a/tools/rksd.c +++ b/tools/rksd.c @@ -13,20 +13,7 @@ #include "mkimage.h" #include "rkcommon.h" -enum { - RKSD_HEADER0_START = 64 * RK_BLK_SIZE, - RKSD_SPL_HDR_START = RKSD_HEADER0_START + - RK_CODE1_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) @@ -44,18 +31,16 @@ static void rksd_set_header(void *buf, struct stat *sbuf, int ifd, unsigned int size; int ret; - /* Zero the whole header. The first 32KB is empty */ - memset(buf, '\0', RKSD_HEADER0_START); - - size = params->file_size - RKSD_SPL_HDR_START; - ret = rkcommon_set_header(buf + RKSD_HEADER0_START, 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) @@ -77,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; @@ -89,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,