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"
17 RKSD_SPL_HDR_START
= RK_INIT_OFFSET
* RK_BLK_SIZE
,
18 RKSD_SPL_START
= RKSD_SPL_HDR_START
+ 4,
19 RKSD_HEADER_LEN
= RKSD_SPL_START
,
22 static char dummy_hdr
[RKSD_HEADER_LEN
];
24 static int rksd_check_params(struct image_tool_params
*params
)
29 static int rksd_verify_header(unsigned char *buf
, int size
,
30 struct image_tool_params
*params
)
35 static void rksd_print_header(const void *buf
)
39 static void rksd_set_header(void *buf
, struct stat
*sbuf
, int ifd
,
40 struct image_tool_params
*params
)
45 size
= params
->file_size
- RKSD_SPL_HDR_START
;
46 ret
= rkcommon_set_header(buf
, size
);
48 /* TODO(sjg@chromium.org): This method should return an error */
49 printf("Warning: SPL image is too large (size %#x) and will not boot\n",
53 memcpy(buf
+ RKSD_SPL_HDR_START
, CONFIG_ROCKCHIP_SPL_HDR
, 4);
56 static int rksd_extract_subimage(void *buf
, struct image_tool_params
*params
)
61 static int rksd_check_image_type(uint8_t type
)
63 if (type
== IH_TYPE_RKSD
)
69 /* We pad the file out to a fixed size - this method returns that size */
70 static int rksd_vrec_header(struct image_tool_params
*params
,
71 struct image_type_params
*tparams
)
75 pad_size
= RKSD_SPL_HDR_START
+ CONFIG_ROCKCHIP_MAX_SPL_SIZE
;
76 debug("pad_size %x\n", pad_size
);
78 return pad_size
- params
->file_size
;
86 "Rockchip SD Boot Image support",
93 rksd_extract_subimage
,
94 rksd_check_image_type
,