public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nicholas Kinar <n.kinar@usask.ca>
To: u-boot@lists.denx.de
Subject: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload
Date: Tue, 29 Mar 2011 14:35:26 -0600	[thread overview]
Message-ID: <4D92428E.6030503@usask.ca> (raw)
In-Reply-To: <20110329125620.387153ac@schlenkerla.am.freescale.net>

On 29/03/2011 11:56 AM, Scott Wood wrote:
> On Tue, 29 Mar 2011 11:37:25 -0600
> Nicholas Kinar<n.kinar@usask.ca>  wrote:
>
>> On 29/03/2011 10:14 AM, Nicholas Kinar wrote:
>>> Also as instructed in the README.NAND, README.JFFS2 and
>>> README.JFFS2_NAND files found in the /doc/ directory, I've tried
>>> defining the following in my
>>> /include/configs/at91sam9rlek.h configuration file:
>>>
>>> #define CONFIG_JFFS2_NAND  1
>>> #define CONFIG_CMD_JFFS2
>>> #define CONFIG_SYS_MAX_FLASH_BANKS 1
>>> #define CONFIG_CMD_NAND        1
>>>
>> I've now added the following #undef to the list of defines above:
>>
>> #undef CONFIG_CMD_FLASH
>>
>> Now after typing "help" at the U-Boot command line, I can finally see
>> the fsload command listed.  However running fsload gives the following
>> error:
>>
>> U-Boot>  fsload
>> support for FLASH devices not present
>> incorrect device: nor0
>>
>> This appears to be due to some code in the /common/cmd_jffs2.c file.
>> Can fsload be only used for NOR memory, or is there a way to use it for
>> NAND flash as well?
> "support for FLASH devices not present" is printed when it's trying to act
> on a device labelled as NOR, but there's no NOR support present.
>
> Try the "chpart" command to switch to a NAND device, and/or make sure that
> your mtdparts variable is set correctly.
>
> -Scott
>

Thank you very much for your response, Scott; this is greatly 
appreciated!  To compile in support for the "chpart" command, I've now 
added the following to my
/include/configs/at91sam9rlek.h file:

#define CFG_NAND_BOOT
#define CONFIG_JFFS2_NAND  1
#define CONFIG_JFFS2_CMDLINE
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_MTDPARTS
#define CONFIG_MTD_DEVICE
#define MTDIDS_DEFAULT      "nand0=nand_flash"
#define MTDPARTS_DEFAULT   "mtdparts=nand_flash:-(jffs2)"
#define CONFIG_SYS_MAX_FLASH_BANKS 1
#undef CONFIG_CMD_FLASH


U-boot compiles cleanly, but I find that after U-Boot loads on my 
embedded hardware, the "mtdids" and "mtdparts" variables are not set in 
the U-Boot environment.  However, since these are environment variables, 
I find that this can be done at the U-Boot command line:

U-Boot> nand info
Device 0: nand0, sector size 256 KiB
U-Boot> setenv mtdids nand0=nand_flash
U-Boot> setenv mtdparts mtdparts=nand_flash:-(jffs2)
U-Boot> chpart nand0,0
partition changed to nand0,0
U-Boot> ls
Scanning JFFS2 FS:   ls: Failed to scan JFFSv2 file structure
U-Boot> fsload
### JFFS2 loading 'uImage' to 0x22000000
Scanning JFFS2 FS:   load: Failed to scan JFFSv2 file structure
### JFFS2 LOAD ERROR<0> for uImage!

Of course, fsload cannot load the uImage, since I am working with a 
blank flash and there is no image pre-loaded on the flash.  Using the 
"saveenv" command, I intend to save these environment variables.

Continuing on, I will load an image on the blank flash, and then I will 
try to load the Linux kernel.  I will then post my results on this 
mailing list as a response.

I have two additional questions associated with booting the kernel from 
NAND flash on my custom hardware:

(1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 
directory influence the robustness of the fsload code?

(2) Does it take a long time to load the Linux kernel from a JFFS2 
filesystem on NAND flash using the fsload command (i.e. 
http://old.nabble.com/Performance-in-Booting-Linux-w--Device-Tree-via-U-Boot-out-of-JFFS2-on-NAND-td15879327.html), 
or has this been cleaned up in the current u-boot-2010.09 code?

Nicholas

  reply	other threads:[~2011-03-29 20:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29 16:14 [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload Nicholas Kinar
2011-03-29 17:37 ` Nicholas Kinar
2011-03-29 17:56   ` Scott Wood
2011-03-29 20:35     ` Nicholas Kinar [this message]
2011-03-29 20:46       ` Scott Wood
2011-03-29 20:57         ` Nicholas Kinar
2011-03-29 21:05       ` Wolfgang Denk
2011-03-29 21:46         ` Nicholas Kinar
2011-03-29 21:51           ` Wolfgang Denk
2011-04-02 17:38             ` Nicholas Kinar
2011-04-03  1:50               ` Nicholas Kinar
2011-04-04  1:25                 ` Nicholas Kinar
2011-03-30  7:17         ` Joakim Tjernlund
2011-03-30  8:54           ` Wolfgang Denk

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=4D92428E.6030503@usask.ca \
    --to=n.kinar@usask.ca \
    --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