1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include "imagetool.h"
22#include <compiler.h>
23#include <image.h>
24#include "gpheader.h"
25
26static uint8_t gpimage_header[GPIMAGE_HDR_SIZE];
27
28
29static int gpimage_check_image_types(uint8_t type)
30{
31 if (type == IH_TYPE_GPIMAGE)
32 return EXIT_SUCCESS;
33 return EXIT_FAILURE;
34}
35
36static int gpimage_verify_header(unsigned char *ptr, int image_size,
37 struct image_tool_params *params)
38{
39 struct gp_header *gph = (struct gp_header *)ptr;
40
41 return gph_verify_header(gph, 1);
42}
43
44static void gpimage_print_header(const void *ptr)
45{
46 const struct gp_header *gph = (struct gp_header *)ptr;
47
48 gph_print_header(gph, 1);
49}
50
51static void gpimage_set_header(void *ptr, struct stat *sbuf, int ifd,
52 struct image_tool_params *params)
53{
54 struct gp_header *gph = (struct gp_header *)ptr;
55
56 gph_set_header(gph, sbuf->st_size - GPIMAGE_HDR_SIZE, params->addr, 1);
57}
58
59
60
61
62U_BOOT_IMAGE_TYPE(
63 gpimage,
64 "TI KeyStone GP Image support",
65 GPIMAGE_HDR_SIZE,
66 (void *)&gpimage_header,
67 gpimage_check_params,
68 gpimage_verify_header,
69 gpimage_print_header,
70 gpimage_set_header,
71 NULL,
72 gpimage_check_image_types,
73 NULL,
74 NULL
75);
76