1 // SPDX-License-Identifier: GPL-2.0+
4 * Texas Instruments Incorporated
5 * Add gpimage format for keystone devices to format spl image. This is
9 * Linaro LTD, www.linaro.org
10 * Author: John Rigby <john.rigby@linaro.org>
11 * Based on TI's signGP.c
14 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
17 * Marvell Semiconductor <www.marvell.com>
18 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
21 #include "imagetool.h"
26 static uint8_t gpimage_header
[GPIMAGE_HDR_SIZE
];
28 /* to be in keystone gpimage */
29 static int gpimage_check_image_types(uint8_t type
)
31 if (type
== IH_TYPE_GPIMAGE
)
36 static int gpimage_verify_header(unsigned char *ptr
, int image_size
,
37 struct image_tool_params
*params
)
39 struct gp_header
*gph
= (struct gp_header
*)ptr
;
41 return gph_verify_header(gph
, 1);
44 static void gpimage_print_header(const void *ptr
)
46 const struct gp_header
*gph
= (struct gp_header
*)ptr
;
48 gph_print_header(gph
, 1);
51 static void gpimage_set_header(void *ptr
, struct stat
*sbuf
, int ifd
,
52 struct image_tool_params
*params
)
54 struct gp_header
*gph
= (struct gp_header
*)ptr
;
56 gph_set_header(gph
, sbuf
->st_size
- GPIMAGE_HDR_SIZE
, params
->addr
, 1);
64 "TI KeyStone GP Image support",
66 (void *)&gpimage_header
,
68 gpimage_verify_header
,
72 gpimage_check_image_types
,