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 int rkimage_verify_header(unsigned char *buf, int size, 17a131c1f4SSimon Glass struct image_tool_params *params) 18a131c1f4SSimon Glass { 19a131c1f4SSimon Glass return 0; 20a131c1f4SSimon Glass } 21a131c1f4SSimon Glass 22a131c1f4SSimon Glass static void rkimage_print_header(const void *buf) 23a131c1f4SSimon Glass { 24a131c1f4SSimon Glass } 25a131c1f4SSimon Glass 26a131c1f4SSimon Glass static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd, 27a131c1f4SSimon Glass struct image_tool_params *params) 28a131c1f4SSimon Glass { 297bf274b9SJeffy Chen memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params), 307bf274b9SJeffy Chen RK_SPL_HDR_SIZE); 31*cfbcdadeSHeiko Stübner 32*cfbcdadeSHeiko Stübner if (rkcommon_need_rc4_spl(params)) 33*cfbcdadeSHeiko Stübner rkcommon_rc4_encode_spl(buf, 4, params->file_size); 34a131c1f4SSimon Glass } 35a131c1f4SSimon Glass 36a131c1f4SSimon Glass static int rkimage_extract_subimage(void *buf, struct image_tool_params *params) 37a131c1f4SSimon Glass { 38a131c1f4SSimon Glass return 0; 39a131c1f4SSimon Glass } 40a131c1f4SSimon Glass 41a131c1f4SSimon Glass static int rkimage_check_image_type(uint8_t type) 42a131c1f4SSimon Glass { 43a131c1f4SSimon Glass if (type == IH_TYPE_RKIMAGE) 44a131c1f4SSimon Glass return EXIT_SUCCESS; 45a131c1f4SSimon Glass else 46a131c1f4SSimon Glass return EXIT_FAILURE; 47a131c1f4SSimon Glass } 48a131c1f4SSimon Glass 49a131c1f4SSimon Glass /* 50a131c1f4SSimon Glass * rk_image parameters 51a131c1f4SSimon Glass */ 52a131c1f4SSimon Glass U_BOOT_IMAGE_TYPE( 53a131c1f4SSimon Glass rkimage, 54a131c1f4SSimon Glass "Rockchip Boot Image support", 55a131c1f4SSimon Glass 4, 56a131c1f4SSimon Glass &header, 579217d93bSSimon Glass rkcommon_check_params, 58a131c1f4SSimon Glass rkimage_verify_header, 59a131c1f4SSimon Glass rkimage_print_header, 60a131c1f4SSimon Glass rkimage_set_header, 61a131c1f4SSimon Glass rkimage_extract_subimage, 62a131c1f4SSimon Glass rkimage_check_image_type, 63a131c1f4SSimon Glass NULL, 64a131c1f4SSimon Glass NULL 65a131c1f4SSimon Glass ); 66