]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
a131c1f4 SG |
2 | /* |
3 | * (C) Copyright 2015 Google, Inc | |
4 | * Written by Simon Glass <[email protected]> | |
5 | * | |
a131c1f4 SG |
6 | * See README.rockchip for details of the rkimage format |
7 | */ | |
8 | ||
9 | #include "imagetool.h" | |
10 | #include <image.h> | |
7bf274b9 | 11 | #include "rkcommon.h" |
a131c1f4 SG |
12 | |
13 | static uint32_t header; | |
14 | ||
a131c1f4 SG |
15 | static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd, |
16 | struct image_tool_params *params) | |
17 | { | |
f25c1755 | 18 | memcpy(buf, rkcommon_get_spl_hdr(params), RK_SPL_HDR_SIZE); |
cfbcdade HS |
19 | |
20 | if (rkcommon_need_rc4_spl(params)) | |
f43b0d49 | 21 | rkcommon_rc4_encode_spl(buf, 0, params->file_size); |
a131c1f4 SG |
22 | } |
23 | ||
a131c1f4 SG |
24 | static int rkimage_check_image_type(uint8_t type) |
25 | { | |
26 | if (type == IH_TYPE_RKIMAGE) | |
27 | return EXIT_SUCCESS; | |
28 | else | |
29 | return EXIT_FAILURE; | |
30 | } | |
31 | ||
32 | /* | |
33 | * rk_image parameters | |
34 | */ | |
35 | U_BOOT_IMAGE_TYPE( | |
36 | rkimage, | |
37 | "Rockchip Boot Image support", | |
f25c1755 | 38 | 0, |
a131c1f4 | 39 | &header, |
9217d93b | 40 | rkcommon_check_params, |
253c60a5 PT |
41 | NULL, |
42 | NULL, | |
a131c1f4 | 43 | rkimage_set_header, |
253c60a5 | 44 | NULL, |
a131c1f4 SG |
45 | rkimage_check_image_type, |
46 | NULL, | |
47 | NULL | |
48 | ); |