diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2011-11-05 23:27:47 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-11-07 08:35:24 +0100 |
commit | fc8f69c8bb591162d9d29191dcc1feccaf85ed5d (patch) | |
tree | 0751109fc5548b4a043f3cebed8bac8c7009a711 | |
parent | c1bbf2bdb7bce8f7a087cb08e9898dacc49448ce (diff) | |
download | genimage-fc8f69c8bb591162d9d29191dcc1feccaf85ed5d.tar.gz genimage-fc8f69c8bb591162d9d29191dcc1feccaf85ed5d.tar.xz |
allow partitions without image
useful to generate partition table entries
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | genimage.c | 4 | ||||
-rw-r--r-- | image-hd.c | 26 |
2 files changed, 20 insertions, 10 deletions
@@ -148,6 +148,8 @@ static int image_generate(struct image *image) list_for_each_entry(part, &image->partitions, list) { struct image *child; + if (!part->image) + continue; child = image_get(part->image); if (!child) { image_error(image, "could not find %s\n", part->image); @@ -498,6 +500,8 @@ int main(int argc, char *argv[]) struct image *i; if (!part->image) { + if (part->in_partition_table) + continue; image_error(image, "no input file given\n"); goto err_out; } @@ -152,15 +152,13 @@ static int hdimage_generate(struct image *image) struct image *child; const char *infile; - child = image_get(part->image); - infile = imageoutfile(child); - ret = pad_file(NULL, outfile, part->offset, 0x0, mode); if (ret) { image_error(image, "failed to pad image to size %lld\n", part->offset); return ret; } + mode = MODE_APPEND; if (part->extended) { char ebr[4*sizeof(struct partition_entry)+2]; @@ -174,6 +172,12 @@ static int hdimage_generate(struct image *image) } } + if (!part->image) + continue; + + child = image_get(part->image); + infile = imageoutfile(child); + ret = pad_file(infile, outfile, part->size, 0x0, MODE_APPEND); if (ret) { @@ -181,7 +185,6 @@ static int hdimage_generate(struct image *image) part->name); return ret; } - mode = MODE_APPEND; } if (hd->partition_table) { @@ -231,13 +234,16 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) has_extended = partition_table_entries > 4; partition_table_entries = 0; list_for_each_entry(part, &image->partitions, list) { - struct image *child = image_get(part->image); - if (!child) { - image_error(image, "could not find %s\n", part->image); - return -EINVAL; + if (part->image) { + struct image *child = image_get(part->image); + if (!child) { + image_error(image, "could not find %s\n", + part->image); + return -EINVAL; + } + if (!part->size) + part->size = roundup(child->size, hd->align); } - if (!part->size) - part->size = roundup(child->size, hd->align); if (!part->size) { image_error(image, "part %s size must not be zero\n", part->name); |