xref: /openbmc/u-boot/tools/rkimage.c (revision 5be93569)
1 /*
2  * (C) Copyright 2015 Google, Inc
3  * Written by Simon Glass <sjg@chromium.org>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  *
7  * See README.rockchip for details of the rkimage format
8  */
9 
10 #include "imagetool.h"
11 #include <image.h>
12 
13 static uint32_t header;
14 
15 static int rkimage_check_params(struct image_tool_params *params)
16 {
17 	return 0;
18 }
19 
20 static int rkimage_verify_header(unsigned char *buf, int size,
21 				 struct image_tool_params *params)
22 {
23 	return 0;
24 }
25 
26 static void rkimage_print_header(const void *buf)
27 {
28 }
29 
30 static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
31 			       struct image_tool_params *params)
32 {
33 	memcpy(buf, CONFIG_ROCKCHIP_SPL_HDR, 4);
34 }
35 
36 static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
37 {
38 	return 0;
39 }
40 
41 static int rkimage_check_image_type(uint8_t type)
42 {
43 	if (type == IH_TYPE_RKIMAGE)
44 		return EXIT_SUCCESS;
45 	else
46 		return EXIT_FAILURE;
47 }
48 
49 /*
50  * rk_image parameters
51  */
52 U_BOOT_IMAGE_TYPE(
53 	rkimage,
54 	"Rockchip Boot Image support",
55 	4,
56 	&header,
57 	rkimage_check_params,
58 	rkimage_verify_header,
59 	rkimage_print_header,
60 	rkimage_set_header,
61 	rkimage_extract_subimage,
62 	rkimage_check_image_type,
63 	NULL,
64 	NULL
65 );
66