1*a131c1f4SSimon Glass /* 2*a131c1f4SSimon Glass * (C) Copyright 2015 Google, Inc 3*a131c1f4SSimon Glass * Written by Simon Glass <sjg@chromium.org> 4*a131c1f4SSimon Glass * 5*a131c1f4SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 6*a131c1f4SSimon Glass * 7*a131c1f4SSimon Glass * See README.rockchip for details of the rkimage format 8*a131c1f4SSimon Glass */ 9*a131c1f4SSimon Glass 10*a131c1f4SSimon Glass #include "imagetool.h" 11*a131c1f4SSimon Glass #include <image.h> 12*a131c1f4SSimon Glass 13*a131c1f4SSimon Glass static uint32_t header; 14*a131c1f4SSimon Glass 15*a131c1f4SSimon Glass static int rkimage_check_params(struct image_tool_params *params) 16*a131c1f4SSimon Glass { 17*a131c1f4SSimon Glass return 0; 18*a131c1f4SSimon Glass } 19*a131c1f4SSimon Glass 20*a131c1f4SSimon Glass static int rkimage_verify_header(unsigned char *buf, int size, 21*a131c1f4SSimon Glass struct image_tool_params *params) 22*a131c1f4SSimon Glass { 23*a131c1f4SSimon Glass return 0; 24*a131c1f4SSimon Glass } 25*a131c1f4SSimon Glass 26*a131c1f4SSimon Glass static void rkimage_print_header(const void *buf) 27*a131c1f4SSimon Glass { 28*a131c1f4SSimon Glass } 29*a131c1f4SSimon Glass 30*a131c1f4SSimon Glass static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd, 31*a131c1f4SSimon Glass struct image_tool_params *params) 32*a131c1f4SSimon Glass { 33*a131c1f4SSimon Glass memcpy(buf, "RK32", 4); 34*a131c1f4SSimon Glass } 35*a131c1f4SSimon Glass 36*a131c1f4SSimon Glass static int rkimage_extract_subimage(void *buf, struct image_tool_params *params) 37*a131c1f4SSimon Glass { 38*a131c1f4SSimon Glass return 0; 39*a131c1f4SSimon Glass } 40*a131c1f4SSimon Glass 41*a131c1f4SSimon Glass static int rkimage_check_image_type(uint8_t type) 42*a131c1f4SSimon Glass { 43*a131c1f4SSimon Glass if (type == IH_TYPE_RKIMAGE) 44*a131c1f4SSimon Glass return EXIT_SUCCESS; 45*a131c1f4SSimon Glass else 46*a131c1f4SSimon Glass return EXIT_FAILURE; 47*a131c1f4SSimon Glass } 48*a131c1f4SSimon Glass 49*a131c1f4SSimon Glass /* 50*a131c1f4SSimon Glass * rk_image parameters 51*a131c1f4SSimon Glass */ 52*a131c1f4SSimon Glass U_BOOT_IMAGE_TYPE( 53*a131c1f4SSimon Glass rkimage, 54*a131c1f4SSimon Glass "Rockchip Boot Image support", 55*a131c1f4SSimon Glass 4, 56*a131c1f4SSimon Glass &header, 57*a131c1f4SSimon Glass rkimage_check_params, 58*a131c1f4SSimon Glass rkimage_verify_header, 59*a131c1f4SSimon Glass rkimage_print_header, 60*a131c1f4SSimon Glass rkimage_set_header, 61*a131c1f4SSimon Glass rkimage_extract_subimage, 62*a131c1f4SSimon Glass rkimage_check_image_type, 63*a131c1f4SSimon Glass NULL, 64*a131c1f4SSimon Glass NULL 65*a131c1f4SSimon Glass ); 66