2018-05-07 05:58:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-08-31 06:55:24 +08:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2015 Google, Inc
|
|
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
|
|
*
|
|
|
|
* See README.rockchip for details of the rkimage format
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "imagetool.h"
|
|
|
|
#include <image.h>
|
2015-11-27 12:07:17 +08:00
|
|
|
#include "rkcommon.h"
|
2015-08-31 06:55:24 +08:00
|
|
|
|
|
|
|
static uint32_t header;
|
|
|
|
|
|
|
|
static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
|
|
|
|
struct image_tool_params *params)
|
|
|
|
{
|
2018-10-04 21:32:42 +08:00
|
|
|
memcpy(buf, rkcommon_get_spl_hdr(params), RK_SPL_HDR_SIZE);
|
2017-02-19 02:46:27 +08:00
|
|
|
|
|
|
|
if (rkcommon_need_rc4_spl(params))
|
2019-12-05 18:58:29 +08:00
|
|
|
rkcommon_rc4_encode_spl(buf, 0, params->file_size);
|
2015-08-31 06:55:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rkimage_check_image_type(uint8_t type)
|
|
|
|
{
|
|
|
|
if (type == IH_TYPE_RKIMAGE)
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
else
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* rk_image parameters
|
|
|
|
*/
|
|
|
|
U_BOOT_IMAGE_TYPE(
|
|
|
|
rkimage,
|
|
|
|
"Rockchip Boot Image support",
|
2018-10-04 21:32:42 +08:00
|
|
|
0,
|
2015-08-31 06:55:24 +08:00
|
|
|
&header,
|
2016-05-15 04:02:59 +08:00
|
|
|
rkcommon_check_params,
|
2017-04-17 23:48:06 +08:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2015-08-31 06:55:24 +08:00
|
|
|
rkimage_set_header,
|
2017-04-17 23:48:06 +08:00
|
|
|
NULL,
|
2015-08-31 06:55:24 +08:00
|
|
|
rkimage_check_image_type,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
);
|