1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02: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:
Guilherme Maciel Ferreira
2015-01-15 02:48:07 -02:00
committed by Tom Rini
parent 067d156075
commit a93648d197
18 changed files with 254 additions and 376 deletions

View File

@@ -29,42 +29,6 @@ struct image_tool_params params = {
.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
main (int argc, char **argv)
{
@@ -75,9 +39,6 @@ main (int argc, char **argv)
struct image_type_params *tparams = NULL;
int pad_len = 0;
/* Init all image generation/list support */
register_image_tool(mkimage_register);
params.cmdname = *argv;
params.addr = params.ep = 0;
@@ -215,7 +176,7 @@ NXTARG: ;
usage ();
/* set tparams as per input type_id */
tparams = imagetool_get_type(params.type, mkimage_tparams);
tparams = imagetool_get_type(params.type);
if (tparams == NULL) {
fprintf (stderr, "%s: unsupported type %s\n",
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];
int offset = 0;
int size;
struct image_type_params *tparams = imagetool_get_type(params.type,
mkimage_tparams);
struct image_type_params *tparams = imagetool_get_type(params.type);
if (pad >= sizeof(zeros)) {
fprintf(stderr, "%s: Can't pad to %d\n",