blob: f9fdcfa712f00496a88404a0181f783b158859fa [file] [log] [blame]
Simon Glassc9c74032015-08-30 16:55:24 -06001/*
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>
Jeffy Chen06cdc342015-11-27 12:07:17 +080012#include "rkcommon.h"
Simon Glassc9c74032015-08-30 16:55:24 -060013
14static uint32_t header;
15
16static int rkimage_check_params(struct image_tool_params *params)
17{
18 return 0;
19}
20
21static int rkimage_verify_header(unsigned char *buf, int size,
22 struct image_tool_params *params)
23{
24 return 0;
25}
26
27static void rkimage_print_header(const void *buf)
28{
29}
30
31static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
32 struct image_tool_params *params)
33{
Jeffy Chen06cdc342015-11-27 12:07:17 +080034 memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
35 RK_SPL_HDR_SIZE);
Simon Glassc9c74032015-08-30 16:55:24 -060036}
37
38static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
39{
40 return 0;
41}
42
43static int rkimage_check_image_type(uint8_t type)
44{
45 if (type == IH_TYPE_RKIMAGE)
46 return EXIT_SUCCESS;
47 else
48 return EXIT_FAILURE;
49}
50
51/*
52 * rk_image parameters
53 */
54U_BOOT_IMAGE_TYPE(
55 rkimage,
56 "Rockchip Boot Image support",
57 4,
58 &header,
59 rkimage_check_params,
60 rkimage_verify_header,
61 rkimage_print_header,
62 rkimage_set_header,
63 rkimage_extract_subimage,
64 rkimage_check_image_type,
65 NULL,
66 NULL
67);