1a131c1f4SSimon Glass /* 2a131c1f4SSimon Glass * (C) Copyright 2015 Google, Inc 3a131c1f4SSimon Glass * Written by Simon Glass <sjg@chromium.org> 4a131c1f4SSimon Glass * 5a131c1f4SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 6a131c1f4SSimon Glass * 7a131c1f4SSimon Glass * See README.rockchip for details of the rkimage format 8a131c1f4SSimon Glass */ 9a131c1f4SSimon Glass 10a131c1f4SSimon Glass #include "imagetool.h" 11a131c1f4SSimon Glass #include <image.h> 127bf274b9SJeffy Chen #include "rkcommon.h" 13a131c1f4SSimon Glass 14a131c1f4SSimon Glass static uint32_t header; 15a131c1f4SSimon Glass 16a131c1f4SSimon Glass static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd, 17a131c1f4SSimon Glass struct image_tool_params *params) 18a131c1f4SSimon Glass { 197bf274b9SJeffy Chen memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params), 207bf274b9SJeffy Chen RK_SPL_HDR_SIZE); 21cfbcdadeSHeiko Stübner 22cfbcdadeSHeiko Stübner if (rkcommon_need_rc4_spl(params)) 23cfbcdadeSHeiko Stübner rkcommon_rc4_encode_spl(buf, 4, params->file_size); 24a131c1f4SSimon Glass } 25a131c1f4SSimon Glass 26a131c1f4SSimon Glass static int rkimage_check_image_type(uint8_t type) 27a131c1f4SSimon Glass { 28a131c1f4SSimon Glass if (type == IH_TYPE_RKIMAGE) 29a131c1f4SSimon Glass return EXIT_SUCCESS; 30a131c1f4SSimon Glass else 31a131c1f4SSimon Glass return EXIT_FAILURE; 32a131c1f4SSimon Glass } 33a131c1f4SSimon Glass 34a131c1f4SSimon Glass /* 35a131c1f4SSimon Glass * rk_image parameters 36a131c1f4SSimon Glass */ 37a131c1f4SSimon Glass U_BOOT_IMAGE_TYPE( 38a131c1f4SSimon Glass rkimage, 39a131c1f4SSimon Glass "Rockchip Boot Image support", 40a131c1f4SSimon Glass 4, 41a131c1f4SSimon Glass &header, 429217d93bSSimon Glass rkcommon_check_params, 43*253c60a5SPhilipp Tomsich NULL, 44*253c60a5SPhilipp Tomsich NULL, 45a131c1f4SSimon Glass rkimage_set_header, 46*253c60a5SPhilipp Tomsich NULL, 47a131c1f4SSimon Glass rkimage_check_image_type, 48a131c1f4SSimon Glass NULL, 49a131c1f4SSimon Glass NULL 50a131c1f4SSimon Glass ); 51