1
2
3
4
5
6
7
8
9
10#include "imagetool.h"
11#include <image.h>
12#include "rkcommon.h"
13
14static uint32_t header;
15
16static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
17 struct image_tool_params *params)
18{
19 memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
20 RK_SPL_HDR_SIZE);
21
22 if (rkcommon_need_rc4_spl(params))
23 rkcommon_rc4_encode_spl(buf, 4, params->file_size);
24}
25
26static int rkimage_check_image_type(uint8_t type)
27{
28 if (type == IH_TYPE_RKIMAGE)
29 return EXIT_SUCCESS;
30 else
31 return EXIT_FAILURE;
32}
33
34
35
36
37U_BOOT_IMAGE_TYPE(
38 rkimage,
39 "Rockchip Boot Image support",
40 4,
41 &header,
42 rkcommon_check_params,
43 NULL,
44 NULL,
45 rkimage_set_header,
46 NULL,
47 rkimage_check_image_type,
48 NULL,
49 NULL
50);
51