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