env: Kconfig: cosmetics: update comment for SYS_RELOC_GD_ENV_ADDR
[oweals/u-boot.git] / tools / ublimage.c
index 6495db6d6a8bf8488ae56e7740eaa30ed6bd38de..1d2e897f6b35f72aadb72946230563fe78e78ce0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2011
  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
@@ -9,14 +10,9 @@
  * (C) Copyright 2008
  * Marvell Semiconductor <www.marvell.com>
  * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+ 
  */
 
-/* Required to obtain the getline prototype from stdio.h */
-#define _GNU_SOURCE
-
-#include "mkimage.h"
+#include "imagetool.h"
 #include <image.h>
 #include "ublimage.h"
 
@@ -196,7 +192,7 @@ static int ublimage_check_image_types(uint8_t type)
 }
 
 static int ublimage_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct ubl_header *ubl_hdr = (struct ubl_header *)ptr;
 
@@ -214,7 +210,7 @@ static void ublimage_print_header(const void *ptr)
 }
 
 static void ublimage_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
        struct ubl_header *ublhdr = (struct ubl_header *)ptr;
 
@@ -222,7 +218,7 @@ static void ublimage_set_header(void *ptr, struct stat *sbuf, int ifd,
        parse_cfg_file(ublhdr, params->imagename);
 }
 
-int ublimage_check_params(struct mkimage_params *params)
+int ublimage_check_params(struct image_tool_params *params)
 {
        if (!params)
                return CFG_INVALID;
@@ -247,18 +243,17 @@ int ublimage_check_params(struct mkimage_params *params)
 /*
  * ublimage parameters
  */
-static struct image_type_params ublimage_params = {
-       .name           = "Davinci UBL boot support",
-       .header_size    = sizeof(struct ubl_header),
-       .hdr            = (void *)&ublimage_header,
-       .check_image_type = ublimage_check_image_types,
-       .verify_header  = ublimage_verify_header,
-       .print_header   = ublimage_print_header,
-       .set_header     = ublimage_set_header,
-       .check_params   = ublimage_check_params,
-};
-
-void init_ubl_image_type(void)
-{
-       mkimage_register(&ublimage_params);
-}
+U_BOOT_IMAGE_TYPE(
+       ublimage,
+       "Davinci UBL boot support",
+       sizeof(struct ubl_header),
+       (void *)&ublimage_header,
+       ublimage_check_params,
+       ublimage_verify_header,
+       ublimage_print_header,
+       ublimage_set_header,
+       NULL,
+       ublimage_check_image_types,
+       NULL,
+       NULL
+);