mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
imagetool: replace image registration function by linker_lists feature
The registration was introduced in commit f86ed6a8d5
This commit also removes all registration functions, and the member "next"
from image_type_params struct
Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
This commit is contained in:
parent
067d156075
commit
a93648d197
18 changed files with 254 additions and 376 deletions
|
@ -122,6 +122,8 @@ HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
|
||||||
HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
|
HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
|
||||||
HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
|
HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
|
||||||
|
|
||||||
|
HOSTLDFLAGS += -T $(srctree)/tools/imagetool.lds
|
||||||
|
|
||||||
hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
|
hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
|
||||||
hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
|
hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
|
||||||
HOSTCFLAGS_mkexynosspl.o := -pedantic
|
HOSTCFLAGS_mkexynosspl.o := -pedantic
|
||||||
|
|
|
@ -413,19 +413,17 @@ int aisimage_check_params(struct image_tool_params *params)
|
||||||
/*
|
/*
|
||||||
* aisimage parameters
|
* aisimage parameters
|
||||||
*/
|
*/
|
||||||
static struct image_type_params aisimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "TI Davinci AIS Boot Image support",
|
aisimage,
|
||||||
.header_size = 0,
|
"TI Davinci AIS Boot Image support",
|
||||||
.hdr = NULL,
|
0,
|
||||||
.check_image_type = aisimage_check_image_types,
|
NULL,
|
||||||
.verify_header = aisimage_verify_header,
|
aisimage_check_params,
|
||||||
.print_header = aisimage_print_header,
|
aisimage_verify_header,
|
||||||
.set_header = aisimage_set_header,
|
aisimage_print_header,
|
||||||
.check_params = aisimage_check_params,
|
aisimage_set_header,
|
||||||
.vrec_header = aisimage_generate,
|
NULL,
|
||||||
};
|
aisimage_check_image_types,
|
||||||
|
NULL,
|
||||||
void init_ais_image_type(void)
|
aisimage_generate
|
||||||
{
|
);
|
||||||
register_image_type(&aisimage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -324,19 +324,17 @@ static int atmel_vrec_header(struct image_tool_params *params,
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct image_type_params atmelimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "ATMEL ROM-Boot Image support",
|
atmelimage,
|
||||||
.header_size = 0,
|
"ATMEL ROM-Boot Image support",
|
||||||
.hdr = NULL,
|
0,
|
||||||
.check_image_type = atmel_check_image_type,
|
NULL,
|
||||||
.verify_header = atmel_verify_header,
|
atmel_check_params,
|
||||||
.print_header = atmel_print_header,
|
atmel_verify_header,
|
||||||
.set_header = atmel_set_header,
|
atmel_print_header,
|
||||||
.check_params = atmel_check_params,
|
atmel_set_header,
|
||||||
.vrec_header = atmel_vrec_header,
|
NULL,
|
||||||
};
|
atmel_check_image_type,
|
||||||
|
NULL,
|
||||||
void init_atmel_image_type(void)
|
atmel_vrec_header
|
||||||
{
|
);
|
||||||
register_image_type(&atmelimage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -150,19 +150,17 @@ static int image_extract_datafile(void *ptr, struct image_tool_params *params)
|
||||||
/*
|
/*
|
||||||
* Default image type parameters definition
|
* Default image type parameters definition
|
||||||
*/
|
*/
|
||||||
static struct image_type_params defimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "Default Image support",
|
defimage,
|
||||||
.header_size = sizeof(image_header_t),
|
"Default Image support",
|
||||||
.hdr = (void*)&header,
|
sizeof(image_header_t),
|
||||||
.check_image_type = image_check_image_types,
|
(void *)&header,
|
||||||
.verify_header = image_verify_header,
|
image_check_params,
|
||||||
.print_header = image_print_contents,
|
image_verify_header,
|
||||||
.set_header = image_set_header,
|
image_print_contents,
|
||||||
.extract_datafile = image_extract_datafile,
|
image_set_header,
|
||||||
.check_params = image_check_params,
|
image_extract_datafile,
|
||||||
};
|
image_check_image_types,
|
||||||
|
NULL,
|
||||||
void init_default_image_type(void)
|
NULL
|
||||||
{
|
);
|
||||||
register_image_type(&defimage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,41 +20,6 @@ static struct image_tool_params params = {
|
||||||
.type = IH_TYPE_KERNEL,
|
.type = IH_TYPE_KERNEL,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* dumpimage_register() - register respective image generation/list support
|
|
||||||
*
|
|
||||||
* the input struct image_type_params is checked and appended to the link
|
|
||||||
* list, if the input structure is already registered, issue an error
|
|
||||||
*
|
|
||||||
* @tparams: Image type parameters
|
|
||||||
*/
|
|
||||||
static void dumpimage_register(struct image_type_params *tparams)
|
|
||||||
{
|
|
||||||
struct image_type_params **tp;
|
|
||||||
|
|
||||||
if (!tparams) {
|
|
||||||
fprintf(stderr, "%s: %s: Null input\n", params.cmdname,
|
|
||||||
__func__);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* scan the linked list, check for registry and point the last one */
|
|
||||||
for (tp = &dumpimage_tparams; *tp != NULL; tp = &(*tp)->next) {
|
|
||||||
if (!strcmp((*tp)->name, tparams->name)) {
|
|
||||||
fprintf(stderr, "%s: %s already registered\n",
|
|
||||||
params.cmdname, tparams->name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add input struct entry at the end of link list */
|
|
||||||
*tp = tparams;
|
|
||||||
/* mark input entry as last entry in the link list */
|
|
||||||
tparams->next = NULL;
|
|
||||||
|
|
||||||
debug("Registered %s\n", tparams->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dumpimage_extract_datafile -
|
* dumpimage_extract_datafile -
|
||||||
*
|
*
|
||||||
|
@ -70,8 +35,12 @@ static int dumpimage_extract_datafile(void *ptr, struct stat *sbuf)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
struct image_type_params *curr;
|
struct image_type_params *curr;
|
||||||
|
struct image_type_params *start = ll_entry_start(
|
||||||
|
struct image_type_params, image_type);
|
||||||
|
struct image_type_params *end = ll_entry_end(
|
||||||
|
struct image_type_params, image_type);
|
||||||
|
|
||||||
for (curr = dumpimage_tparams; curr != NULL; curr = curr->next) {
|
for (curr = start; curr != end; curr++) {
|
||||||
if (curr->verify_header) {
|
if (curr->verify_header) {
|
||||||
retval = curr->verify_header((unsigned char *)ptr,
|
retval = curr->verify_header((unsigned char *)ptr,
|
||||||
sbuf->st_size, ¶ms);
|
sbuf->st_size, ¶ms);
|
||||||
|
@ -104,9 +73,6 @@ int main(int argc, char **argv)
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
struct image_type_params *tparams = NULL;
|
struct image_type_params *tparams = NULL;
|
||||||
|
|
||||||
/* Init all image generation/list support */
|
|
||||||
register_image_tool(dumpimage_register);
|
|
||||||
|
|
||||||
params.cmdname = *argv;
|
params.cmdname = *argv;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "li:o:p:V")) != -1) {
|
while ((opt = getopt(argc, argv, "li:o:p:V")) != -1) {
|
||||||
|
@ -142,7 +108,7 @@ int main(int argc, char **argv)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
/* set tparams as per input type_id */
|
/* set tparams as per input type_id */
|
||||||
tparams = imagetool_get_type(params.type, dumpimage_tparams);
|
tparams = imagetool_get_type(params.type);
|
||||||
if (tparams == NULL) {
|
if (tparams == NULL) {
|
||||||
fprintf(stderr, "%s: unsupported type %s\n",
|
fprintf(stderr, "%s: unsupported type %s\n",
|
||||||
params.cmdname, genimg_get_type_name(params.type));
|
params.cmdname, genimg_get_type_name(params.type));
|
||||||
|
|
|
@ -162,19 +162,17 @@ static int fit_check_params(struct image_tool_params *params)
|
||||||
(params->lflag && (params->dflag || params->fflag)));
|
(params->lflag && (params->dflag || params->fflag)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct image_type_params fitimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "FIT Image support",
|
fitimage,
|
||||||
.header_size = sizeof(image_header_t),
|
"FIT Image support",
|
||||||
.hdr = (void*)&header,
|
sizeof(image_header_t),
|
||||||
.verify_header = fit_verify_header,
|
(void *)&header,
|
||||||
.print_header = fit_print_contents,
|
fit_check_params,
|
||||||
.check_image_type = fit_check_image_types,
|
fit_verify_header,
|
||||||
.fflag_handle = fit_handle_file,
|
fit_print_contents,
|
||||||
.set_header = NULL, /* FIT images use DTB header */
|
NULL,
|
||||||
.check_params = fit_check_params,
|
NULL,
|
||||||
};
|
fit_check_image_types,
|
||||||
|
fit_handle_file,
|
||||||
void init_fit_image_type (void)
|
NULL /* FIT images use DTB header */
|
||||||
{
|
);
|
||||||
register_image_type(&fitimage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -60,18 +60,17 @@ static void gpimage_set_header(void *ptr, struct stat *sbuf, int ifd,
|
||||||
/*
|
/*
|
||||||
* gpimage parameters
|
* gpimage parameters
|
||||||
*/
|
*/
|
||||||
static struct image_type_params gpimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "TI KeyStone GP Image support",
|
gpimage,
|
||||||
.header_size = GPIMAGE_HDR_SIZE,
|
"TI KeyStone GP Image support",
|
||||||
.hdr = (void *)&gpimage_header,
|
GPIMAGE_HDR_SIZE,
|
||||||
.check_image_type = gpimage_check_image_types,
|
(void *)&gpimage_header,
|
||||||
.verify_header = gpimage_verify_header,
|
gpimage_check_params,
|
||||||
.print_header = gpimage_print_header,
|
gpimage_verify_header,
|
||||||
.set_header = gpimage_set_header,
|
gpimage_print_header,
|
||||||
.check_params = gpimage_check_params,
|
gpimage_set_header,
|
||||||
};
|
NULL,
|
||||||
|
gpimage_check_image_types,
|
||||||
void init_gpimage_type(void)
|
NULL,
|
||||||
{
|
NULL
|
||||||
register_image_type(&gpimage_params);
|
);
|
||||||
}
|
|
||||||
|
|
|
@ -10,68 +10,15 @@
|
||||||
|
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
|
|
||||||
/*
|
struct image_type_params *imagetool_get_type(int type)
|
||||||
* Callback function to register a image type within a tool
|
|
||||||
*/
|
|
||||||
static imagetool_register_t register_func;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* register_image_tool -
|
|
||||||
*
|
|
||||||
* The tool provides its own registration function in order to all image
|
|
||||||
* types initialize themselves.
|
|
||||||
*/
|
|
||||||
void register_image_tool(imagetool_register_t image_register)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Save the image tool callback function. It will be used to register
|
|
||||||
* image types within that tool
|
|
||||||
*/
|
|
||||||
register_func = image_register;
|
|
||||||
|
|
||||||
/* Init ATMEL ROM Boot Image generation/list support */
|
|
||||||
init_atmel_image_type();
|
|
||||||
/* 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 Altera SOCFPGA support */
|
|
||||||
init_socfpga_image_type();
|
|
||||||
/* Init TI Keystone boot image generation/list support */
|
|
||||||
init_gpimage_type();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* register_image_type -
|
|
||||||
*
|
|
||||||
* Register a image type within a tool
|
|
||||||
*/
|
|
||||||
void register_image_type(struct image_type_params *tparams)
|
|
||||||
{
|
|
||||||
register_func(tparams);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct image_type_params *imagetool_get_type(
|
|
||||||
int type,
|
|
||||||
struct image_type_params *tparams)
|
|
||||||
{
|
{
|
||||||
struct image_type_params *curr;
|
struct image_type_params *curr;
|
||||||
|
struct image_type_params *start = ll_entry_start(
|
||||||
|
struct image_type_params, image_type);
|
||||||
|
struct image_type_params *end = ll_entry_end(
|
||||||
|
struct image_type_params, image_type);
|
||||||
|
|
||||||
for (curr = tparams; curr != NULL; curr = curr->next) {
|
for (curr = start; curr != end; curr++) {
|
||||||
if (curr->check_image_type) {
|
if (curr->check_image_type) {
|
||||||
if (!curr->check_image_type(type))
|
if (!curr->check_image_type(type))
|
||||||
return curr;
|
return curr;
|
||||||
|
@ -89,7 +36,12 @@ int imagetool_verify_print_header(
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
struct image_type_params *curr;
|
struct image_type_params *curr;
|
||||||
|
|
||||||
for (curr = tparams; curr != NULL; curr = curr->next) {
|
struct image_type_params *start = ll_entry_start(
|
||||||
|
struct image_type_params, image_type);
|
||||||
|
struct image_type_params *end = ll_entry_end(
|
||||||
|
struct image_type_params, image_type);
|
||||||
|
|
||||||
|
for (curr = start; curr != end; curr++) {
|
||||||
if (curr->verify_header) {
|
if (curr->verify_header) {
|
||||||
retval = curr->verify_header((unsigned char *)ptr,
|
retval = curr->verify_header((unsigned char *)ptr,
|
||||||
sbuf->st_size, params);
|
sbuf->st_size, params);
|
||||||
|
|
|
@ -19,6 +19,16 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <u-boot/sha1.h>
|
#include <u-boot/sha1.h>
|
||||||
|
|
||||||
|
/* define __KERNEL__ in order to get the definitions
|
||||||
|
* required by the linker list. This is probably not
|
||||||
|
* the best way to do this */
|
||||||
|
#ifndef __KERNEL__
|
||||||
|
#define __KERNEL__
|
||||||
|
#include <linker_lists.h>
|
||||||
|
#undef __KERNEL__
|
||||||
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
#include "fdt_host.h"
|
#include "fdt_host.h"
|
||||||
|
|
||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||||
|
@ -127,29 +137,8 @@ struct image_type_params {
|
||||||
*/
|
*/
|
||||||
int (*vrec_header) (struct image_tool_params *,
|
int (*vrec_header) (struct image_tool_params *,
|
||||||
struct image_type_params *);
|
struct image_type_params *);
|
||||||
/* pointer to the next registered entry in linked list */
|
|
||||||
struct image_type_params *next;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Tool registration function.
|
|
||||||
*/
|
|
||||||
typedef void (*imagetool_register_t)(struct image_type_params *);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initializes all image types with the given registration callback
|
|
||||||
* function.
|
|
||||||
* An image tool uses this function to initialize all image types.
|
|
||||||
*/
|
|
||||||
void register_image_tool(imagetool_register_t image_register);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register a image type within a tool.
|
|
||||||
* An image type uses this function to register itself within
|
|
||||||
* all tools.
|
|
||||||
*/
|
|
||||||
void register_image_type(struct image_type_params *tparams);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* imagetool_get_type() - find the image type params for a given image type
|
* imagetool_get_type() - find the image type params for a given image type
|
||||||
*
|
*
|
||||||
|
@ -161,9 +150,7 @@ void register_image_type(struct image_type_params *tparams);
|
||||||
* if input type_id is not supported by any of image_type_support
|
* if input type_id is not supported by any of image_type_support
|
||||||
* returns NULL
|
* returns NULL
|
||||||
*/
|
*/
|
||||||
struct image_type_params *imagetool_get_type(
|
struct image_type_params *imagetool_get_type(int type);
|
||||||
int type,
|
|
||||||
struct image_type_params *tparams);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* imagetool_verify_print_header() - verifies the image header
|
* imagetool_verify_print_header() - verifies the image header
|
||||||
|
@ -201,24 +188,37 @@ int imagetool_save_datafile(
|
||||||
/*
|
/*
|
||||||
* There is a c file associated with supported image type low level code
|
* There is a c file associated with supported image type low level code
|
||||||
* for ex. default_image.c, fit_image.c
|
* for ex. default_image.c, fit_image.c
|
||||||
* init_xxx_type() is the only function referred by image tool core to avoid
|
|
||||||
* a single lined header file, you can define them here
|
|
||||||
*
|
|
||||||
* Supported image types init functions
|
|
||||||
*/
|
*/
|
||||||
void init_default_image_type(void);
|
|
||||||
void init_atmel_image_type(void);
|
|
||||||
void init_pbl_image_type(void);
|
|
||||||
void init_ais_image_type(void);
|
|
||||||
void init_kwb_image_type(void);
|
|
||||||
void init_imx_image_type(void);
|
|
||||||
void init_mxs_image_type(void);
|
|
||||||
void init_fit_image_type(void);
|
|
||||||
void init_ubl_image_type(void);
|
|
||||||
void init_omap_image_type(void);
|
|
||||||
void init_socfpga_image_type(void);
|
|
||||||
void init_gpimage_type(void);
|
|
||||||
|
|
||||||
void pbl_load_uboot(int fd, struct image_tool_params *mparams);
|
void pbl_load_uboot(int fd, struct image_tool_params *mparams);
|
||||||
|
|
||||||
|
#define U_BOOT_IMAGE_TYPE( \
|
||||||
|
_id, \
|
||||||
|
_name, \
|
||||||
|
_header_size, \
|
||||||
|
_header, \
|
||||||
|
_check_params, \
|
||||||
|
_verify_header, \
|
||||||
|
_print_header, \
|
||||||
|
_set_header, \
|
||||||
|
_extract_datafile, \
|
||||||
|
_check_image_type, \
|
||||||
|
_fflag_handle, \
|
||||||
|
_vrec_header \
|
||||||
|
) \
|
||||||
|
ll_entry_declare(struct image_type_params, _id, image_type) = { \
|
||||||
|
.name = _name, \
|
||||||
|
.header_size = _header_size, \
|
||||||
|
.hdr = _header, \
|
||||||
|
.check_params = _check_params, \
|
||||||
|
.verify_header = _verify_header, \
|
||||||
|
.print_header = _print_header, \
|
||||||
|
.set_header = _set_header, \
|
||||||
|
.extract_datafile = _extract_datafile, \
|
||||||
|
.check_image_type = _check_image_type, \
|
||||||
|
.fflag_handle = _fflag_handle, \
|
||||||
|
.vrec_header = _vrec_header \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _IMAGETOOL_H_ */
|
#endif /* _IMAGETOOL_H_ */
|
||||||
|
|
24
tools/imagetool.lds
Normal file
24
tools/imagetool.lds
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011-2012 The Chromium OS Authors.
|
||||||
|
* Use of this source code is governed by a BSD-style license that can be
|
||||||
|
* found in the LICENSE file.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
*/
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
.u_boot_list : {
|
||||||
|
KEEP(*(SORT(.u_boot_list*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
__u_boot_sandbox_option_start = .;
|
||||||
|
_u_boot_sandbox_getopt : { *(.u_boot_sandbox_getopt) }
|
||||||
|
__u_boot_sandbox_option_end = .;
|
||||||
|
|
||||||
|
__bss_start = .;
|
||||||
|
}
|
||||||
|
|
||||||
|
INSERT BEFORE .data;
|
|
@ -694,19 +694,17 @@ static int imximage_generate(struct image_tool_params *params,
|
||||||
/*
|
/*
|
||||||
* imximage parameters
|
* imximage parameters
|
||||||
*/
|
*/
|
||||||
static struct image_type_params imximage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "Freescale i.MX Boot Image support",
|
imximage,
|
||||||
.header_size = 0,
|
"Freescale i.MX Boot Image support",
|
||||||
.hdr = NULL,
|
0,
|
||||||
.check_image_type = imximage_check_image_types,
|
NULL,
|
||||||
.verify_header = imximage_verify_header,
|
imximage_check_params,
|
||||||
.print_header = imximage_print_header,
|
imximage_verify_header,
|
||||||
.set_header = imximage_set_header,
|
imximage_print_header,
|
||||||
.check_params = imximage_check_params,
|
imximage_set_header,
|
||||||
.vrec_header = imximage_generate,
|
NULL,
|
||||||
};
|
imximage_check_image_types,
|
||||||
|
NULL,
|
||||||
void init_imx_image_type(void)
|
imximage_generate
|
||||||
{
|
);
|
||||||
register_image_type(&imximage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -905,19 +905,17 @@ static int kwbimage_check_params(struct image_tool_params *params)
|
||||||
/*
|
/*
|
||||||
* kwbimage type parameters definition
|
* kwbimage type parameters definition
|
||||||
*/
|
*/
|
||||||
static struct image_type_params kwbimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "Marvell MVEBU Boot Image support",
|
kwbimage,
|
||||||
.header_size = 0, /* no fixed header size */
|
"Marvell MVEBU Boot Image support",
|
||||||
.hdr = NULL,
|
0,
|
||||||
.vrec_header = kwbimage_generate,
|
NULL,
|
||||||
.check_image_type = kwbimage_check_image_types,
|
kwbimage_check_params,
|
||||||
.verify_header = kwbimage_verify_header,
|
kwbimage_verify_header,
|
||||||
.print_header = kwbimage_print_header,
|
kwbimage_print_header,
|
||||||
.set_header = kwbimage_set_header,
|
kwbimage_set_header,
|
||||||
.check_params = kwbimage_check_params,
|
NULL,
|
||||||
};
|
kwbimage_check_image_types,
|
||||||
|
NULL,
|
||||||
void init_kwb_image_type (void)
|
kwbimage_generate
|
||||||
{
|
);
|
||||||
register_image_type(&kwbimage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,42 +29,6 @@ struct image_tool_params params = {
|
||||||
.imagename2 = "",
|
.imagename2 = "",
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* mkimage_register -
|
|
||||||
*
|
|
||||||
* It is used to register respective image generation/list support to the
|
|
||||||
* mkimage core
|
|
||||||
*
|
|
||||||
* the input struct image_type_params is checked and appended to the link
|
|
||||||
* list, if the input structure is already registered, error
|
|
||||||
*/
|
|
||||||
void mkimage_register (struct image_type_params *tparams)
|
|
||||||
{
|
|
||||||
struct image_type_params **tp;
|
|
||||||
|
|
||||||
if (!tparams) {
|
|
||||||
fprintf (stderr, "%s: %s: Null input\n",
|
|
||||||
params.cmdname, __FUNCTION__);
|
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* scan the linked list, check for registry and point the last one */
|
|
||||||
for (tp = &mkimage_tparams; *tp != NULL; tp = &(*tp)->next) {
|
|
||||||
if (!strcmp((*tp)->name, tparams->name)) {
|
|
||||||
fprintf (stderr, "%s: %s already registered\n",
|
|
||||||
params.cmdname, tparams->name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add input struct entry at the end of link list */
|
|
||||||
*tp = tparams;
|
|
||||||
/* mark input entry as last entry in the link list */
|
|
||||||
tparams->next = NULL;
|
|
||||||
|
|
||||||
debug ("Registered %s\n", tparams->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -75,9 +39,6 @@ main (int argc, char **argv)
|
||||||
struct image_type_params *tparams = NULL;
|
struct image_type_params *tparams = NULL;
|
||||||
int pad_len = 0;
|
int pad_len = 0;
|
||||||
|
|
||||||
/* Init all image generation/list support */
|
|
||||||
register_image_tool(mkimage_register);
|
|
||||||
|
|
||||||
params.cmdname = *argv;
|
params.cmdname = *argv;
|
||||||
params.addr = params.ep = 0;
|
params.addr = params.ep = 0;
|
||||||
|
|
||||||
|
@ -215,7 +176,7 @@ NXTARG: ;
|
||||||
usage ();
|
usage ();
|
||||||
|
|
||||||
/* set tparams as per input type_id */
|
/* set tparams as per input type_id */
|
||||||
tparams = imagetool_get_type(params.type, mkimage_tparams);
|
tparams = imagetool_get_type(params.type);
|
||||||
if (tparams == NULL) {
|
if (tparams == NULL) {
|
||||||
fprintf (stderr, "%s: unsupported type %s\n",
|
fprintf (stderr, "%s: unsupported type %s\n",
|
||||||
params.cmdname, genimg_get_type_name(params.type));
|
params.cmdname, genimg_get_type_name(params.type));
|
||||||
|
@ -466,8 +427,7 @@ copy_file (int ifd, const char *datafile, int pad)
|
||||||
uint8_t zeros[4096];
|
uint8_t zeros[4096];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int size;
|
int size;
|
||||||
struct image_type_params *tparams = imagetool_get_type(params.type,
|
struct image_type_params *tparams = imagetool_get_type(params.type);
|
||||||
mkimage_tparams);
|
|
||||||
|
|
||||||
if (pad >= sizeof(zeros)) {
|
if (pad >= sizeof(zeros)) {
|
||||||
fprintf(stderr, "%s: Can't pad to %d\n",
|
fprintf(stderr, "%s: Can't pad to %d\n",
|
||||||
|
|
|
@ -2312,25 +2312,18 @@ fail:
|
||||||
/*
|
/*
|
||||||
* mxsimage parameters
|
* mxsimage parameters
|
||||||
*/
|
*/
|
||||||
static struct image_type_params mxsimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "Freescale MXS Boot Image support",
|
mxsimage,
|
||||||
.header_size = 0,
|
"Freescale MXS Boot Image support",
|
||||||
.hdr = NULL,
|
0,
|
||||||
.check_image_type = mxsimage_check_image_types,
|
NULL,
|
||||||
.verify_header = mxsimage_verify_header,
|
mxsimage_check_params,
|
||||||
.print_header = mxsimage_print_header,
|
mxsimage_verify_header,
|
||||||
.set_header = mxsimage_set_header,
|
mxsimage_print_header,
|
||||||
.check_params = mxsimage_check_params,
|
mxsimage_set_header,
|
||||||
.vrec_header = mxsimage_generate,
|
NULL,
|
||||||
};
|
mxsimage_check_image_types,
|
||||||
|
NULL,
|
||||||
void init_mxs_image_type(void)
|
mxsimage_generate
|
||||||
{
|
);
|
||||||
register_image_type(&mxsimage_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
void init_mxs_image_type(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -162,18 +162,17 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd,
|
||||||
/*
|
/*
|
||||||
* omapimage parameters
|
* omapimage parameters
|
||||||
*/
|
*/
|
||||||
static struct image_type_params omapimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "TI OMAP CH/GP Boot Image support",
|
omapimage,
|
||||||
.header_size = OMAP_FILE_HDR_SIZE,
|
"TI OMAP CH/GP Boot Image support",
|
||||||
.hdr = (void *)&omapimage_header,
|
OMAP_FILE_HDR_SIZE,
|
||||||
.check_image_type = omapimage_check_image_types,
|
(void *)&omapimage_header,
|
||||||
.verify_header = omapimage_verify_header,
|
gpimage_check_params,
|
||||||
.print_header = omapimage_print_header,
|
omapimage_verify_header,
|
||||||
.set_header = omapimage_set_header,
|
omapimage_print_header,
|
||||||
.check_params = gpimage_check_params,
|
omapimage_set_header,
|
||||||
};
|
NULL,
|
||||||
|
omapimage_check_image_types,
|
||||||
void init_omap_image_type(void)
|
NULL,
|
||||||
{
|
NULL
|
||||||
register_image_type(&omapimage_params);
|
);
|
||||||
}
|
|
||||||
|
|
|
@ -308,19 +308,17 @@ int pblimage_check_params(struct image_tool_params *params)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* pblimage parameters */
|
/* pblimage parameters */
|
||||||
static struct image_type_params pblimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "Freescale PBL Boot Image support",
|
pblimage,
|
||||||
.header_size = sizeof(struct pbl_header),
|
"Freescale PBL Boot Image support",
|
||||||
.hdr = (void *)&pblimage_header,
|
sizeof(struct pbl_header),
|
||||||
.check_image_type = pblimage_check_image_types,
|
(void *)&pblimage_header,
|
||||||
.check_params = pblimage_check_params,
|
pblimage_check_params,
|
||||||
.verify_header = pblimage_verify_header,
|
pblimage_verify_header,
|
||||||
.print_header = pblimage_print_header,
|
pblimage_print_header,
|
||||||
.set_header = pblimage_set_header,
|
pblimage_set_header,
|
||||||
};
|
NULL,
|
||||||
|
pblimage_check_image_types,
|
||||||
void init_pbl_image_type(void)
|
NULL,
|
||||||
{
|
NULL
|
||||||
pbl_size = 0;
|
);
|
||||||
register_image_type(&pblimage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -241,19 +241,17 @@ static void socfpgaimage_set_header(void *ptr, struct stat *sbuf, int ifd,
|
||||||
sign_buffer(buf, 0, 0, data_size, 0);
|
sign_buffer(buf, 0, 0, data_size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct image_type_params socfpgaimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "Altera SOCFPGA preloader support",
|
socfpgaimage,
|
||||||
.vrec_header = socfpgaimage_vrec_header,
|
"Altera SOCFPGA preloader support",
|
||||||
.header_size = 0, /* This will be modified by vrec_header() */
|
0, /* This will be modified by vrec_header() */
|
||||||
.hdr = (void *)buffer,
|
(void *)buffer,
|
||||||
.check_image_type = socfpgaimage_check_image_types,
|
socfpgaimage_check_params,
|
||||||
.verify_header = socfpgaimage_verify_header,
|
socfpgaimage_verify_header,
|
||||||
.print_header = socfpgaimage_print_header,
|
socfpgaimage_print_header,
|
||||||
.set_header = socfpgaimage_set_header,
|
socfpgaimage_set_header,
|
||||||
.check_params = socfpgaimage_check_params,
|
NULL,
|
||||||
};
|
socfpgaimage_check_image_types,
|
||||||
|
NULL,
|
||||||
void init_socfpga_image_type(void)
|
socfpgaimage_vrec_header
|
||||||
{
|
);
|
||||||
register_image_type(&socfpgaimage_params);
|
|
||||||
}
|
|
||||||
|
|
|
@ -244,18 +244,17 @@ int ublimage_check_params(struct image_tool_params *params)
|
||||||
/*
|
/*
|
||||||
* ublimage parameters
|
* ublimage parameters
|
||||||
*/
|
*/
|
||||||
static struct image_type_params ublimage_params = {
|
U_BOOT_IMAGE_TYPE(
|
||||||
.name = "Davinci UBL boot support",
|
ublimage,
|
||||||
.header_size = sizeof(struct ubl_header),
|
"Davinci UBL boot support",
|
||||||
.hdr = (void *)&ublimage_header,
|
sizeof(struct ubl_header),
|
||||||
.check_image_type = ublimage_check_image_types,
|
(void *)&ublimage_header,
|
||||||
.verify_header = ublimage_verify_header,
|
ublimage_check_params,
|
||||||
.print_header = ublimage_print_header,
|
ublimage_verify_header,
|
||||||
.set_header = ublimage_set_header,
|
ublimage_print_header,
|
||||||
.check_params = ublimage_check_params,
|
ublimage_set_header,
|
||||||
};
|
NULL,
|
||||||
|
ublimage_check_image_types,
|
||||||
void init_ubl_image_type(void)
|
NULL,
|
||||||
{
|
NULL
|
||||||
register_image_type(&ublimage_params);
|
);
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue