]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - tools/rksd.c
2 * (C) Copyright 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
7 * See README.rockchip for details of the rksd format
10 #include "imagetool.h"
16 static char dummy_hdr
[RK_IMAGE_HEADER_LEN
];
18 static int rksd_verify_header(unsigned char *buf
, int size
,
19 struct image_tool_params
*params
)
24 static void rksd_print_header(const void *buf
)
28 static void rksd_set_header(void *buf
, struct stat
*sbuf
, int ifd
,
29 struct image_tool_params
*params
)
34 size
= params
->file_size
- RK_SPL_HDR_START
;
35 ret
= rkcommon_set_header(buf
, size
, params
);
37 /* TODO(sjg@chromium.org): This method should return an error */
38 printf("Warning: SPL image is too large (size %#x) and will not boot\n",
42 memcpy(buf
+ RK_SPL_HDR_START
, rkcommon_get_spl_hdr(params
),
45 if (rkcommon_need_rc4_spl(params
))
46 rkcommon_rc4_encode_spl(buf
, RK_SPL_START
- 4,
47 params
->file_size
- RK_SPL_START
+ 4);
50 static int rksd_extract_subimage(void *buf
, struct image_tool_params
*params
)
55 static int rksd_check_image_type(uint8_t type
)
57 if (type
== IH_TYPE_RKSD
)
63 /* We pad the file out to a fixed size - this method returns that size */
64 static int rksd_vrec_header(struct image_tool_params
*params
,
65 struct image_type_params
*tparams
)
69 pad_size
= RK_SPL_HDR_START
+ rkcommon_get_spl_size(params
);
70 debug("pad_size %x\n", pad_size
);
72 return pad_size
- params
->file_size
;
80 "Rockchip SD Boot Image support",
83 rkcommon_check_params
,
87 rksd_extract_subimage
,
88 rksd_check_image_type
,