diff options
Diffstat (limited to 'patches/genimage-5/0001-image-flash-actually-write-the-image-and-support-par.patch')
-rw-r--r-- | patches/genimage-5/0001-image-flash-actually-write-the-image-and-support-par.patch | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/patches/genimage-5/0001-image-flash-actually-write-the-image-and-support-par.patch b/patches/genimage-5/0001-image-flash-actually-write-the-image-and-support-par.patch deleted file mode 100644 index d6aca3b..0000000 --- a/patches/genimage-5/0001-image-flash-actually-write-the-image-and-support-par.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 3ee54067eece5d8f14bfbcab1cb4f2e717775920 Mon Sep 17 00:00:00 2001 -From: Jan Luebbe <jlu@pengutronix.de> -Date: Wed, 1 May 2013 23:55:46 +0200 -Subject: [PATCH] image-flash: actually write the image and support partition offsets - -Signed-off-by: Jan Luebbe <jlu@pengutronix.de> -Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> ---- - image-flash.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++------ - 1 files changed, 51 insertions(+), 6 deletions(-) - -diff --git a/image-flash.c b/image-flash.c -index 2939db7..f56cfa7 100644 ---- a/image-flash.c -+++ b/image-flash.c -@@ -33,20 +33,37 @@ struct flash_image { - static int flash_generate(struct image *image) - { - struct partition *part; -- struct stat s; -- int ret; -- const char *buf; -+ enum pad_mode mode = MODE_OVERWRITE; -+ const char *outfile = imageoutfile(image); - - list_for_each_entry(part, &image->partitions, list) { - struct image *child; -+ const char *infile; -+ struct stat s; -+ int ret; -+ -+ image_log(image, 1, "writing image partition '%s' (0x%llx@0x%llx)\n", -+ part->name, part->size, part->offset); -+ -+ ret = pad_file(NULL, outfile, part->offset, 0xFF, mode); -+ if (ret) { -+ image_error(image, "failed to pad image to size %lld\n", -+ part->offset); -+ return ret; -+ } -+ mode = MODE_APPEND; -+ -+ if (!part->image) -+ continue; - - child = image_get(part->image); - if (!child) { - image_error(image, "could not find %s\n", part->name); - return -EINVAL; - } -- buf = imageoutfile(child); -- ret = stat(buf, &s); -+ infile = imageoutfile(child); -+ -+ ret = stat(infile, &s); - if (ret) - return -errno; - -@@ -55,6 +72,13 @@ static int flash_generate(struct image *image) - child->file, part->name, (long long)s.st_size, part->size); - return -EINVAL; - } -+ -+ ret = pad_file(infile, outfile, part->size, 0xFF, mode); -+ if (ret) { -+ image_error(image, "failed to write image partition '%s'\n", -+ part->name); -+ return ret; -+ } - } - - return 0; -@@ -88,8 +112,29 @@ static int flash_setup(struct image *image, cfg_t *cfg) - goto err_exceed; - part->size = flashsize - partsize; - } -+ if (part->size % image->flash_type->pebsize) { -+ image_error(image, "part %s size (%lld) must be a " -+ "multiple of erase block size (%i bytes)\n", -+ part->name, part->size, image->flash_type->pebsize); -+ return -EINVAL; -+ } -+ if (part->offset % image->flash_type->pebsize) { -+ image_error(image, "part %s offset (%lld) must be a" -+ "multiple of erase block size (%i bytes)\n", -+ part->name, part->offset, image->flash_type->pebsize); -+ return -EINVAL; -+ } -+ if (part->offset) { -+ if (partsize > part->offset) { -+ image_error(image, "part %s overlaps with previous partition\n", -+ part->name); -+ return -EINVAL; -+ } -+ } else { -+ part->offset = partsize; -+ } - -- partsize += part->size; -+ partsize = part->offset + part->size; - } - - if (partsize > flashsize) { --- -1.7.2.5 - |