summaryrefslogtreecommitdiff
path: root/tools/mkimage.c
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2011-09-15 23:50:16 +0000
committerWolfgang Denk <wd@denx.de>2011-10-05 22:03:12 +0200
commitf0662105b674a3874227316abf8536bebc9b5995 (patch)
tree35e46ac50259bf18ab03de3cbfc941e411c8d636 /tools/mkimage.c
parent163967905f9e41232d5f7c525a9811a200fe30ba (diff)
mkimage: Add variable lenght header support
Some images have not a header of fix lenght. The patch will be used for the generation of AIS images, because this header has a variable lenght. The patch adds also the parameter "-s" (skip) to not copy automatically the passed image file. Signed-off-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'tools/mkimage.c')
-rw-r--r--tools/mkimage.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 2f331017548..c307a37615f 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -248,6 +248,9 @@ main (int argc, char **argv)
usage ();
params.imagename = *++argv;
goto NXTARG;
+ case 's':
+ params.skipcpy = 1;
+ break;
case 'v':
params.vflag++;
break;
@@ -361,11 +364,15 @@ NXTARG: ;
}
/*
- * Must be -w then:
- *
- * write dummy header, to be fixed later
+ * In case there an header with a variable
+ * length will be added, the corresponding
+ * function is called. This is responsible to
+ * allocate memory for the header itself.
*/
- memset (tparams->hdr, 0, tparams->header_size);
+ if (tparams->vrec_header)
+ tparams->vrec_header(&params, tparams);
+ else
+ memset(tparams->hdr, 0, tparams->header_size);
if (write(ifd, tparams->hdr, tparams->header_size)
!= tparams->header_size) {
@@ -374,7 +381,9 @@ NXTARG: ;
exit (EXIT_FAILURE);
}
- if (params.type == IH_TYPE_MULTI || params.type == IH_TYPE_SCRIPT) {
+ if (!params.skipcpy &&
+ (params.type == IH_TYPE_MULTI ||
+ params.type == IH_TYPE_SCRIPT)) {
char *file = params.datafile;
uint32_t size;