summaryrefslogtreecommitdiff
path: root/tools/imagetool.c
diff options
context:
space:
mode:
authorAndreas Bießmann <andreas.devel@googlemail.com>2015-02-08 23:06:10 (GMT)
committerTom Rini <trini@ti.com>2015-02-16 17:41:41 (GMT)
commit1fddd7b63c69b8da40b5dc737db0382f473f9644 (patch)
tree013c7c68d8a517ad77252deb192817b1c58952e6 /tools/imagetool.c
parent312aca4e6964812007c8218c0b4b0737e9e0f46a (diff)
downloadu-boot-1fddd7b63c69b8da40b5dc737db0382f473f9644.tar.xz
tools/imagetool: remove linker script
Commit a93648d197df48fa46dd55f925ff70468bd81c71 introduced linker generated lists for imagetool which is the base for some host tools (mkimage, dumpimage, et al.). Unfortunately some host tool chains do not support the used type of linker scripts. Therefore this commit broke these host-tools for them, namely FreeBSD and Darwin (OS/X). This commit tries to fix this. In order to have a clean distinction between host and embedded code space we need to introduce our own linker generated list instead of re-using the available linker_lists.h provided functionality. So we copy the implementation used in linux kernel script/mod/file2alias.c which has the very same problem (cause it is a host tool). This code also comes with an abstraction for Mach-O binary format used in Darwin systems. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Cc: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Diffstat (limited to 'tools/imagetool.c')
-rw-r--r--tools/imagetool.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/tools/imagetool.c b/tools/imagetool.c
index 148e466..4b0b73d 100644
--- a/tools/imagetool.c
+++ b/tools/imagetool.c
@@ -12,16 +12,16 @@
struct image_type_params *imagetool_get_type(int type)
{
- 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);
+ struct image_type_params **curr;
+ INIT_SECTION(image_type);
+
+ struct image_type_params **start = __start_image_type;
+ struct image_type_params **end = __stop_image_type;
for (curr = start; curr != end; curr++) {
- if (curr->check_image_type) {
- if (!curr->check_image_type(type))
- return curr;
+ if ((*curr)->check_image_type) {
+ if (!(*curr)->check_image_type(type))
+ return *curr;
}
}
return NULL;
@@ -34,16 +34,15 @@ int imagetool_verify_print_header(
struct image_tool_params *params)
{
int retval = -1;
- struct image_type_params *curr;
+ struct image_type_params **curr;
+ INIT_SECTION(image_type);
- 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);
+ struct image_type_params **start = __start_image_type;
+ struct image_type_params **end = __stop_image_type;
for (curr = start; curr != end; curr++) {
- if (curr->verify_header) {
- retval = curr->verify_header((unsigned char *)ptr,
+ if ((*curr)->verify_header) {
+ retval = (*curr)->verify_header((unsigned char *)ptr,
sbuf->st_size, params);
if (retval == 0) {
@@ -51,12 +50,12 @@ int imagetool_verify_print_header(
* Print the image information if verify is
* successful
*/
- if (curr->print_header) {
- curr->print_header(ptr);
+ if ((*curr)->print_header) {
+ (*curr)->print_header(ptr);
} else {
fprintf(stderr,
"%s: print_header undefined for %s\n",
- params->cmdname, curr->name);
+ params->cmdname, (*curr)->name);
}
break;
}