summaryrefslogtreecommitdiff
path: root/tools/imximage.c
diff options
context:
space:
mode:
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>2013-12-01 12:43:10 -0700
committerTom Rini <trini@ti.com>2013-12-13 09:15:32 -0500
commitf86ed6a8d52c99bb2d17d3cac1647edca0c4399c (patch)
tree60918bb807d062bf1ee3771b2ac4ff1057ec5e7a /tools/imximage.c
parentf1cc458cf3b1c972082b14c7901b43300634a78a (diff)
downloadu-boot-imx-f86ed6a8d52c99bb2d17d3cac1647edca0c4399c.zip
u-boot-imx-f86ed6a8d52c99bb2d17d3cac1647edca0c4399c.tar.gz
u-boot-imx-f86ed6a8d52c99bb2d17d3cac1647edca0c4399c.tar.bz2
tools: moved code common to all image tools to a separated module.
In order to avoid duplicating code and keep only one point of modification, the functions, structs and defines useful for "dumpimage" were moved from "mkimage" to a common module called "imagetool". This modification also weakens the coupling between image types (FIT, IMX, MXS, and so on) and image tools (mkimage and dumpimage). Any tool may initialize the "imagetool" through register_image_tool() function, while the image types register themselves within an image tool using the register_image_type() function: +---------------+ +------| fit_image | +--------------+ +-----------+ | +---------------+ | mkimage |--------> | | <-----+ +--------------+ | | +---------------+ | imagetool | <------------| imximage | +--------------+ | | +---------------+ | dumpimage |--------> | | <-----+ +--------------+ +-----------+ | +---------------+ +------| default_image | +---------------+ register_image_tool() register_image_type() Also, the struct "mkimage_params" was renamed to "image_tool_params" to make clear its general purpose. Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/imximage.c')
-rw-r--r--tools/imximage.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/imximage.c b/tools/imximage.c
index 511e3f2..18dc051 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include "mkimage.h"
+#include "imagetool.h"
#include <image.h>
#include "imximage.h"
@@ -520,7 +520,7 @@ static int imximage_check_image_types(uint8_t type)
}
static int imximage_verify_header(unsigned char *ptr, int image_size,
- struct mkimage_params *params)
+ struct image_tool_params *params)
{
struct imx_header *imx_hdr = (struct imx_header *) ptr;
@@ -549,7 +549,7 @@ static void imximage_print_header(const void *ptr)
}
static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
- struct mkimage_params *params)
+ struct image_tool_params *params)
{
struct imx_header *imxhdr = (struct imx_header *)ptr;
uint32_t dcd_len;
@@ -589,7 +589,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
}
}
-int imximage_check_params(struct mkimage_params *params)
+int imximage_check_params(struct image_tool_params *params)
{
if (!params)
return CFG_INVALID;
@@ -611,7 +611,7 @@ int imximage_check_params(struct mkimage_params *params)
(params->xflag) || !(strlen(params->imagename));
}
-static int imximage_generate(struct mkimage_params *params,
+static int imximage_generate(struct image_tool_params *params,
struct image_type_params *tparams)
{
struct imx_header *imxhdr;
@@ -701,5 +701,5 @@ static struct image_type_params imximage_params = {
void init_imx_image_type(void)
{
- mkimage_register(&imximage_params);
+ register_image_type(&imximage_params);
}