[PATCH] new nanddump applet

Baruch Siach baruch at tkos.co.il
Mon Oct 18 09:25:08 UTC 2010


Hi Denys,

On Mon, Oct 18, 2010 at 02:39:04AM +0200, Denys Vlasenko wrote:
> On Tuesday 12 October 2010 09:32, Baruch Siach wrote:
> > Port of the mtd-utils nanddump utility. This nanddump implementation is added
> > to nandwrite.c for the sake of code sharing.
> > 
> > Signed-off-by: Baruch Siach <baruch at tkos.co.il>
> 
> > +/* Buffer for OOB data */
> > +#define NAND_MAX_OOBSIZE 256
> > +static unsigned char oobbuf[NAND_MAX_OOBSIZE];
> 
> This is not good.
> 
> >  	mtdoffset = bb_strtou(opt_s, NULL, 0);
> >  	if (errno)
> >  		bb_error_msg_and_die("invalid number '%s'", opt_s);
> > +	if (do_nanddump && (opts & OPT_l)) {
> > +		unsigned length = bb_strtou(opt_l, NULL, 0);
> > +		if (errno)
> > +			bb_error_msg_and_die("invalid number '%s'", opt_l);
> 
> xstrtou(str, 0) will do "check and abort" internally.
> 
> Applied with some changes. Please try current git and let me know
> if it doesn't work for you.

Thanks. Works great.

It appears though that OOB data may be quite a bit larger than 256 on some 
NAND chips. See mtd-utils commit 96a5eeaf754c34bf684b6957ab8479d8557b3e95 
(mtd-utils: nanddump: Dynamic buffer, increase pagesize/oobsize). I'll send a 
patch that makes oobbuf allocation dynamic, shortly.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


More information about the busybox mailing list