2 * (C) Copyright 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
7 * See README.rockchip for details of the rksd format
10 #include "imagetool.h"
16 static int rksd_verify_header(unsigned char *buf, int size,
17 struct image_tool_params *params)
22 static void rksd_print_header(const void *buf)
26 static void rksd_set_header(void *buf, struct stat *sbuf, int ifd,
27 struct image_tool_params *params)
32 printf("params->file_size %d\n", params->file_size);
33 printf("params->orig_file_size %d\n", params->orig_file_size);
36 * We need to calculate this using 'RK_SPL_HDR_START' and not using
37 * 'tparams->header_size', as the additional byte inserted when
38 * 'is_boot0' is true counts towards the payload.
40 size = params->file_size - RK_SPL_HDR_START;
41 ret = rkcommon_set_header(buf, size, params);
43 /* TODO(sjg@chromium.org): This method should return an error */
44 printf("Warning: SPL image is too large (size %#x) and will "
49 static int rksd_extract_subimage(void *buf, struct image_tool_params *params)
54 static int rksd_check_image_type(uint8_t type)
56 if (type == IH_TYPE_RKSD)
62 static int rksd_vrec_header(struct image_tool_params *params,
63 struct image_type_params *tparams)
66 * Pad to the RK_BLK_SIZE (512 bytes) to be consistent with init_size
67 * being encoded in RK_BLK_SIZE units in header0 (see rkcommon.c).
69 return rkcommon_vrec_header(params, tparams, RK_BLK_SIZE);
77 "Rockchip SD Boot Image support",
80 rkcommon_check_params,
84 rksd_extract_subimage,
85 rksd_check_image_type,