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