tools: mkimage: support pack empty file for multi image
Muilt image bootflow requires ramdisk as a mandory component, so that we have to pack a empty ramdisk into multi image at some time. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: I551ae832fbc68514ead0a3337148593e3113394f
This commit is contained in:
parent
a86a723e2e
commit
40d08d0f10
|
|
@ -239,7 +239,7 @@ ulong image_multi_count(const image_header_t *hdr)
|
||||||
size = (uint32_t *)image_get_data(hdr);
|
size = (uint32_t *)image_get_data(hdr);
|
||||||
|
|
||||||
/* count non empty slots */
|
/* count non empty slots */
|
||||||
for (i = 0; size[i]; ++i)
|
for (i = 0; size[i] != IMAGE_PARAM_INVAL; ++i)
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
|
||||||
|
|
@ -709,6 +709,8 @@ int boot_get_kbd(struct lmb *lmb, bd_t **kbd);
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Legacy format specific code (prefixed with image_) */
|
/* Legacy format specific code (prefixed with image_) */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
#define IMAGE_PARAM_INVAL 0xffffffff
|
||||||
|
|
||||||
static inline uint32_t image_get_header_size(void)
|
static inline uint32_t image_get_header_size(void)
|
||||||
{
|
{
|
||||||
return (sizeof(image_header_t));
|
return (sizeof(image_header_t));
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
size = cpu_to_uimage (sbuf.st_size);
|
size = cpu_to_uimage (sbuf.st_size);
|
||||||
} else {
|
} else {
|
||||||
size = 0;
|
size = IMAGE_PARAM_INVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) {
|
if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) {
|
||||||
|
|
@ -650,6 +650,11 @@ copy_file (int ifd, const char *datafile, int pad)
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sbuf.st_size == 0) {
|
||||||
|
(void) close (dfd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, dfd, 0);
|
ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, dfd, 0);
|
||||||
if (ptr == MAP_FAILED) {
|
if (ptr == MAP_FAILED) {
|
||||||
fprintf (stderr, "%s: Can't read %s: %s\n",
|
fprintf (stderr, "%s: Can't read %s: %s\n",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue