summaryrefslogtreecommitdiff
path: root/tools/mkimage.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/mkimage.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/mkimage.c')
-rw-r--r--tools/mkimage.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/tools/mkimage.c b/tools/mkimage.c
index e12bc31..123d0c7 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -19,7 +19,7 @@ static void usage(void);
struct image_type_params *mkimage_tparams = NULL;
/* parameters initialized by core will be used by the image type code */
-struct mkimage_params params = {
+struct image_tool_params params = {
.os = IH_OS_LINUX,
.arch = IH_ARCH_PPC,
.type = IH_TYPE_KERNEL,
@@ -139,24 +139,8 @@ main (int argc, char **argv)
struct image_type_params *tparams = NULL;
int pad_len = 0;
- /* Init Freescale PBL Boot image generation/list support */
- init_pbl_image_type();
- /* Init Kirkwood Boot image generation/list support */
- init_kwb_image_type ();
- /* Init Freescale imx Boot image generation/list support */
- init_imx_image_type ();
- /* Init Freescale mxs Boot image generation/list support */
- init_mxs_image_type();
- /* Init FIT image generation/list support */
- init_fit_image_type ();
- /* Init TI OMAP Boot image generation/list support */
- init_omap_image_type();
- /* Init Default image generation/list support */
- init_default_image_type ();
- /* Init Davinci UBL support */
- init_ubl_image_type();
- /* Init Davinci AIS support */
- init_ais_image_type();
+ /* Init all image generation/list support */
+ register_image_tool(mkimage_register);
params.cmdname = *argv;
params.addr = params.ep = 0;