public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Steven Zedeck <saz@proliphix.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] add explicit bbt creation to commandline
Date: Thu, 11 Feb 2010 18:49:33 -0800 (PST)	[thread overview]
Message-ID: <27558231.post@talk.nabble.com> (raw)
In-Reply-To: <20080706080456.GF4167@prithivi.gnumonks.org>


Hi,
I know this message is about 18 months old. I am using Uboot 2008.10, which
seems to not include support for creating the Nand BBT (bad block table).
Was this patch released and if so when? Forgive me as I don't know how to
find out.

How best to add BBT support to Uboot? I need to have a BBT created such that
Linux can use it when it loads.

I hope you can help.

Thanks in advance,
Steve
P.S.: I snipped out portions of this code to save space in this reply.


Harald Welte wrote:
> 
> [PATCH] add explicit bbt creation to commandline ("nand createbbt"
> command)
> 
> This patch adds user-requested BBT creation. It includes the following
> changes:
>     
> - common/cmd_nand.c: move yes/no decision to separate function
> - do_nand: ask for confirmation for "nand erase"
> - do_nand: add command "nand createbbt" to erase NAND and create a new BBT
>     
> Signed-off-by: Werner Almesberger <werner@openmoko.org>
> Signed-off-by: Harald Welte <laforge@openmoko.org>
> 
> ---
> 
> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> index bb46f34..2f41157 100644
> --- a/common/cmd_nand.c
> +++ b/common/cmd_nand.c
> @@ -162,6 +162,17 @@ out:
>  	return 0;
>  }
>  
> +static int yes(void)
> +{
> +	char c;
> +
> +	c = getc();
> +	if (c != 'y' && c != 'Y')
> +		return 0;
> +	c = getc();
> +	return c == '\r' || c == '\n';
> +}
> +
>  int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
>  {
>  	int i, dev, ret;
> @@ -231,7 +242,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc,
> char *argv[])
>  	    strncmp(cmd, "read", 4) != 0 && strncmp(cmd, "write", 5) != 0 &&
>  	    strcmp(cmd, "scrub") != 0 && strcmp(cmd, "markbad") != 0 &&
>  	    strcmp(cmd, "biterr") != 0 &&
> -	    strcmp(cmd, "lock") != 0 && strcmp(cmd, "unlock") != 0 )
> +	    strcmp(cmd, "lock") != 0 && strcmp(cmd, "unlock") != 0 &&
> +	    strcmp(cmd, "createbbt") != 0 )
>  		goto usage;
>  
>  	/* the following commands operate on the current device */
> @@ -286,13 +298,23 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc,
> char *argv[])
>  			     "are sure of what you are doing!\n"
>  			     "\nReally scrub this NAND flash? <y/N>\n");
>  
> -			if (getc() == 'y' && getc() == '\r') {
> +			if (yes()) {
>  				opts.scrub = 1;
>  			} else {
>  				puts("scrub aborted\n");
>  				return -1;
>  			}
>  		}
> +		else {
> +			if (opts.length == nand->size) {
> +				puts("Really erase everything ? <y/N>\n");
> +				if (!yes()) {
> +					puts("erase aborted\n");
> +					return -1;
> +				}
> +			}
> +		}
> +
>  		ret = nand_erase_opts(nand, &opts);
>  		printf("%s\n", ret ? "ERROR" : "OK");
>  
> @@ -461,6 +483,33 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc,
> char *argv[])
>  		return 0;
>  	}
>  
> +	if (strcmp(cmd, "createbbt") == 0) {
> +		struct nand_chip *nand_chip = nand->priv;
> +		nand_erase_options_t opts;
> +
> +		puts("Create BBT and erase everything ? <y/N>\n");
> +		if (!yes()) {
> +			puts("createbbt aborted\n");
> +			return -1;
> +		}
> +		memset(&opts, 0, sizeof(opts));
> +		opts.length = nand->size;
> +		if (nand_erase_opts(nand, &opts)) {
> +			puts("Erase failed\n");
> +			return 1;
> +.
> .
> .
>  snip....
>  .
> .
> .
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-PATCH--add-explicit-bbt-creation-to-commandline-tp18299804p27558231.html
Sent from the Uboot - Users mailing list archive at Nabble.com.

  parent reply	other threads:[~2010-02-12  2:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-06  8:04 [U-Boot-Users] [PATCH] add explicit bbt creation to commandline Harald Welte
2008-07-06 11:16 ` Jean-Christophe PLAGNIOL-VILLARD
2008-07-06 13:31   ` Wolfgang Denk
2008-07-07 18:39 ` Scott Wood
2010-02-12  2:49 ` Steven Zedeck [this message]
2010-02-12 17:04   ` [U-Boot] " Scott Wood
2010-02-12 17:38     ` Steven Zedeck
2010-02-12 17:48       ` Scott Wood
2010-02-12 18:47         ` Steven Zedeck
2010-02-12 18:53           ` Scott Wood
2010-02-12 19:18             ` Steven Zedeck
2010-02-12 19:36               ` Steven Zedeck
2010-02-12 21:23                 ` Scott Wood
2010-02-13  2:14                   ` Steven Zedeck
2010-02-16 18:35                     ` Scott Wood
2010-02-17 15:38                       ` Steven Zedeck
2010-02-17 19:10                         ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27558231.post@talk.nabble.com \
    --to=saz@proliphix.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox