make sure flash_type is defined for all images that need it

do this in setup do detect configuration errors as soon as possible.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Michael Olbrich 2011-06-29 19:58:08 +02:00 committed by Sascha Hauer
parent 0eff6a2b29
commit 90e41d5b8a
3 changed files with 16 additions and 5 deletions

View File

@ -29,11 +29,6 @@ static int jffs2_generate(struct image *image)
int ret;
char *extraargs;
if (!image->flash_type) {
printf("no flash type given for %s\n", image->file);
return -EINVAL;
}
extraargs = cfg_getstr(image->imagesec, "extraargs");
ret = systemp(image, "%s --eraseblock=%d -d %s -o %s %s",
@ -46,6 +41,11 @@ static int jffs2_generate(struct image *image)
static int jffs2_setup(struct image *image, cfg_t *cfg)
{
if (!image->flash_type) {
image_error(image, "no flash type given\n");
return -EINVAL;
}
return 0;
}

View File

@ -88,6 +88,11 @@ static int ubi_setup(struct image *image, cfg_t *cfg)
int autoresize = 0;
struct partition *part;
if (!image->flash_type) {
image_error(image, "no flash type given\n");
return -EINVAL;
}
image->handler_priv = ubi;
list_for_each_entry(part, &image->partitions, list)

View File

@ -20,6 +20,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "genimage.h"
@ -45,6 +46,11 @@ static int ubifs_generate(struct image *image)
static int ubifs_setup(struct image *image, cfg_t *cfg)
{
if (!image->flash_type) {
image_error(image, "no flash type given\n");
return -EINVAL;
}
return 0;
}