Blame view
tools/rksd.c
1.59 KB
f9a3c278b
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/* * (C) Copyright 2015 Google, Inc * Written by Simon Glass <sjg@chromium.org> * * SPDX-License-Identifier: GPL-2.0+ * * See README.rockchip for details of the rksd format */ #include "imagetool.h" #include <image.h> #include <rc4.h> #include "mkimage.h" #include "rkcommon.h" |
f9a3c278b
|
15 |
static void rksd_set_header(void *buf, struct stat *sbuf, int ifd, |
2fb371ff6
|
16 |
struct image_tool_params *params) |
f9a3c278b
|
17 18 19 |
{ unsigned int size; int ret; |
366aad4d9
|
20 21 22 |
/* * We need to calculate this using 'RK_SPL_HDR_START' and not using * 'tparams->header_size', as the additional byte inserted when |
2fb371ff6
|
23 24 |
* 'is_boot0' is true counts towards the payload (and not towards the * header). |
366aad4d9
|
25 |
*/ |
7bf274b9c
|
26 27 |
size = params->file_size - RK_SPL_HDR_START; ret = rkcommon_set_header(buf, size, params); |
f9a3c278b
|
28 29 |
if (ret) { /* TODO(sjg@chromium.org): This method should return an error */ |
366aad4d9
|
30 31 32 |
printf("Warning: SPL image is too large (size %#x) and will " "not boot ", size); |
f9a3c278b
|
33 |
} |
f9a3c278b
|
34 |
} |
f9a3c278b
|
35 36 37 38 39 40 41 |
static int rksd_check_image_type(uint8_t type) { if (type == IH_TYPE_RKSD) return EXIT_SUCCESS; else return EXIT_FAILURE; } |
f9a3c278b
|
42 43 44 |
static int rksd_vrec_header(struct image_tool_params *params, struct image_type_params *tparams) { |
c25b8c3af
|
45 |
/* |
ad972ac3d
|
46 47 |
* Pad to a 2KB alignment, as required for init_size by the ROM * (see https://lists.denx.de/pipermail/u-boot/2017-May/293268.html) |
c25b8c3af
|
48 |
*/ |
ad972ac3d
|
49 |
return rkcommon_vrec_header(params, tparams, RK_INIT_SIZE_ALIGN); |
f9a3c278b
|
50 51 52 53 54 55 56 57 |
} /* * rk_sd parameters */ U_BOOT_IMAGE_TYPE( rksd, "Rockchip SD Boot Image support", |
111bcc4fb
|
58 59 |
0, NULL, |
7bf274b9c
|
60 |
rkcommon_check_params, |
2fb371ff6
|
61 62 |
rkcommon_verify_header, rkcommon_print_header, |
f9a3c278b
|
63 |
rksd_set_header, |
2fb371ff6
|
64 |
NULL, |
f9a3c278b
|
65 66 67 68 |
rksd_check_image_type, NULL, rksd_vrec_header ); |