diff options
Diffstat (limited to 'ubi-utils')
| -rw-r--r-- | ubi-utils/mtdinfo.c | 14 | ||||
| -rw-r--r-- | ubi-utils/ubiformat.c | 22 | 
2 files changed, 26 insertions, 10 deletions
| diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c index d919673..ead4bce 100644 --- a/ubi-utils/mtdinfo.c +++ b/ubi-utils/mtdinfo.c @@ -340,7 +340,8 @@ static int print_dev_info(libmtd_t libmtd, const struct mtd_info *mtd_info, int  	return 0;  } -static int print_general_info(libmtd_t libmtd, const struct mtd_info *mtd_info) +static int print_general_info(libmtd_t libmtd, const struct mtd_info *mtd_info, +			      int all)  {  	int i, err, first = 1;  	struct mtd_dev_info mtd; @@ -367,9 +368,14 @@ static int print_general_info(libmtd_t libmtd, const struct mtd_info *mtd_info)  		}  	}  	printf("\n"); -	printf("Sysfs interface supported:      %s\n\n", +	printf("Sysfs interface supported:      %s\n",  	       mtd_info->sysfs_supported ? "yes" : "no"); +	if (!all) +		return 0; + +	printf("\n"); +  	for (i = mtd_info->lowest_mtd_num;  	     i <= mtd_info->highest_mtd_num; i++) {  		err = print_dev_info(libmtd, mtd_info, i); @@ -404,7 +410,7 @@ int main(int argc, char * const argv[])  		return sys_errmsg("cannot get MTD information");  	} -	if (!args.all) { +	if (!args.all && args.node) {  		int mtdn;  		/* @@ -416,7 +422,7 @@ int main(int argc, char * const argv[])  			goto out_libmtd;  		err = print_dev_info(libmtd, &mtd_info, mtdn);  	} else -		err = print_general_info(libmtd, &mtd_info); +		err = print_general_info(libmtd, &mtd_info, args.all);  	if (err)  		goto out_libmtd; diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c index ed2b8d0..a265a9a 100644 --- a/ubi-utils/ubiformat.c +++ b/ubi-utils/ubiformat.c @@ -442,7 +442,7 @@ static int mark_bad(const struct mtd_dev_info *mtd, struct ubi_scan_info *si, in  static int flash_image(libmtd_t libmtd, const struct mtd_dev_info *mtd,  		       const struct ubigen_info *ui, struct ubi_scan_info *si)  { -	int fd, img_ebs, eb, written_ebs = 0, divisor; +	int fd, img_ebs, eb, written_ebs = 0, divisor, skip_data_read = 0;  	off_t st_size;  	fd = open_file(&st_size); @@ -501,12 +501,15 @@ static int flash_image(libmtd_t libmtd, const struct mtd_dev_info *mtd,  			continue;  		} -		err = read_all(fd, buf, mtd->eb_size); -		if (err) { -			sys_errmsg("failed to read eraseblock %d from \"%s\"", -				   written_ebs, args.image); -			goto out_close; +		if (!skip_data_read) { +			err = read_all(fd, buf, mtd->eb_size); +			if (err) { +				sys_errmsg("failed to read eraseblock %d from \"%s\"", +					   written_ebs, args.image); +				goto out_close; +			}  		} +		skip_data_read = 0;  		if (args.override_ec)  			ec = args.ec; @@ -547,6 +550,13 @@ static int flash_image(libmtd_t libmtd, const struct mtd_dev_info *mtd,  				if (mark_bad(mtd, si, eb))  					goto out_close;  			} + +			/* +			 * We have to make sure that we do not read next block +			 * of data from the input image or stdin - we have to +			 * write buf first instead. +			 */ +			skip_data_read = 1;  			continue;  		}  		if (++written_ebs >= img_ebs) | 
