Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-04-03 Thread Nicholas Kinar
Nicholas Kinar wrote:
>
> I now strongly believe that the bootargs are not being passed in
> properly to the kernel.  Having found a posting on the AT91 website [1],
> I now realize that the Linux kernel has been built with a load address
> of 0x20008000, but must be loaded to different address 0x2008.
>
> Posting:
> [1]
> http://www.at91.com/forum/viewtopic.php/f,12/t,5038/start,0/st,0/sk,t/sd,a/
>
> Now the kernel boots, but as shown below a kernel panic occurs, so I
> think that the issue might be due to the "root=ubi0:container" bootarg.
> How would I set the root bootarg for this particular NAND flash filesystem?
>

Yes, this was exactly the issue; the environment variables were not 
getting passed in properly to the kernel.  Here are the environment 
variables that I used to successfully boot the Linux kernel:

bootargs=noinitrd console=ttyS0,115200 ubi.mtd=1 root=ubi0:rootfs 
mtdparts=flash:10M(kernel),100M(root),-(storage) rw rootfstype=ubifs
nand-boot=ubi part kernel; ubifsmount kernelfs; ubifsload 0x2008 
uImage; bootm 0x2008
bootcmd=run nand-boot

Note that on my setup,  "root=ubi0:rootfs", where "rootfs" is the name 
of the volume on the UBI  "root" partition, which is indicated by 
"ubi.mtd=1".  The UBI device being used in the system is "ubi0".  I've 
also checked to see if support for UBIFS and UBI are compiled into the 
kernel (and not loaded as a module).  I had to pass "noinitrd" to ensure 
that the kernel detected the UBI file system on the flash.  In addition, 
as shown in a U-Boot tutorial 
(http://free-electrons.com/doc/u-boot.pdf), I was able to use a nice 
script (nand-boot) that runs from the bootcmd.

So thank you very much to those on this mailing list who helped me to 
get started with this!

Nicholas


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-04-02 Thread Nicholas Kinar
Nicholas Kinar wrote:
> I then used the "ubifsload" command to load the uImage into SDRAM memory:
> U-Boot>  ubifsload 0x2200 uImage
> Loading file 'uImage' to addr 0x2200 with size 1256920 (0x00132dd8)...
> Done
>
> The "bootargs" environment variable was set to be the following:
>
> U-Boot>  setenv bootargs console=ttyS0,115200 rootfstype=ubifs ubi.mtd=1
> root=ubi0:container mtdparts=flash:10M(kernel),100M(root),-(storage)
>
> However, after running the "bootm" command, I find that I cannot boot
> the Linux kernel, and the booting process hangs:
>
> U-Boot>  bootm
> ## Booting kernel from Legacy Image at 2200 ...
>  Image Name:   Linux-2.6.37
>  Image Type:   ARM Linux Kernel Image (uncompressed)
>  Data Size:1256856 Bytes = 1.2 MiB
>  Load Address: 20008000
>  Entry Point:  20008000
>  Verifying Checksum ... OK
>  Loading Kernel Image ... OK
> OK
>
> Starting kernel ...
>
> In the Linux kernel xconfig, I've switched on support for UBI and
> UBIFS.  I am wondering what might be the problem here.  Are the bootargs
> being passed properly to the Linux kernel?
>
> Nicholas
>

I now strongly believe that the bootargs are not being passed in 
properly to the kernel.  Having found a posting on the AT91 website [1], 
I now realize that the Linux kernel has been built with a load address 
of 0x20008000, but must be loaded to different address 0x2008.

Posting:
[1] 
http://www.at91.com/forum/viewtopic.php/f,12/t,5038/start,0/st,0/sk,t/sd,a/

Now the kernel boots, but as shown below a kernel panic occurs, so I 
think that the issue might be due to the "root=ubi0:container" bootarg.  
How would I set the root bootarg for this particular NAND flash filesystem?

My mtdparts is the following:

U-Boot> mtdparts

device nand0 , # parts = 3
  #: namesizeoffset  mask_flags
  0: kernel  0x00a0  0x  0
  1: root0x0640  0x00a0  0
  2: storage 0x7920  0x06e0  0

active partition: nand0,0 - (kernel) 0x00a0 @ 0x

defaults:
mtdids  : nand0=flash
mtdparts: mtdparts=flash:10M(kernel),100M(root),-(storage)

Now booting the kernel:

U-Boot> bootm 0x2008
## Booting kernel from Legacy Image at 2008 ...
Image Name:   Linux-2.6.37
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:1256880 Bytes = 1.2 MiB
Load Address: 20008000
Entry Point:  20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37 (nkinar@matilda) (gcc version 4.3.5 (Buildroot 
2011.02) ) #3 Sat Apr 2 17:28:21 CST 2011
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Atmel AT91SAM9RL-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 200 MHz, master 100 MHz, main 12.000 MHz
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: console=ttyS0,115200 root=ubi0:container 
mtdparts=flash:10M(kernel),100M(root),-(storage) rw 
rootfstype=ubifs
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 62348k/62348k available, 3188k reserved, 0K highmem
Virtual kernel memory layout:
 vector  : 0x - 0x1000   (   4 kB)
 fixmap  : 0xfff0 - 0xfffe   ( 896 kB)
 DMA : 0xffc0 - 0xffe0   (   2 MB)
 vmalloc : 0xc480 - 0xfee0   ( 934 MB)
 lowmem  : 0xc000 - 0xc400   (  64 MB)
 modules : 0xbf00 - 0xc000   (  16 MB)
   .init : 0xc0008000 - 0xc0023000   ( 108 kB)
   .text : 0xc0023000 - 0xc025537c   (2249 kB)
   .data : 0xc0256000 - 0xc026e3e0   (  97 kB)
NR_IRQS:192
AT91: 128 gpio irqs in 4 banks
Console: colour dummy device 80x30
console [ttyS0] enabled
Calibrating delay loop... 99.53 BogoMIPS (lpj=497664)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
bio: create slab  at 0
SCSI subsystem initialized
i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)
Switching to clocksource pit
NET: Registered protocol family 1
msgmni has been set to 121
io scheduler noop registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
NAND device: Manufacturer ID: 0x20, Chip ID: 0xd5 (ST Micro )
Scanning device for bad blocks
Bad eraseblock 65 at 0x0104
Bad eraseblock 1014 at 0x0fd8
Bad eraseblock 1159 at 0x121c
Bad eraseblock 2072 at 0x2060
Bad eraseblock 2536 at 0x27a0
Bad eraseblock 2540 at 0x27b0
Bad eraseblock 3101 at 0x3074
Bad eraseblock 334

Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-04-02 Thread Nicholas Kinar
On 11-03-29 03:46 PM, Nicholas Kinar wrote:
>> Thanks for your response, Wolfgang - I will switch the file system to
>> UBI/UBIFS, and then post back what I've done.  I've been looking in the
>> include/configs/sheevaplug.h directory, and I think that this small
>> embedded computer is now using UBIFS as the NAND flash file system.  So
>> changing the configs for my embedded system should be reasonably
>> straightforward.
>>

On 11-03-29 03:51 PM, Wolfgang Denk wrote:
> Dear Nicholas Kinar,
>
> In message<4d92531e.4030...@usask.ca>  you wrote:
>> I would assume that the "fsload" command will also work with UBIFS as well.
> No. UBIFS uses it's own command set; you will use "ubifsload" instead.
>
>> In my custom system, At91Bootstrap is situated on SPI Dataflash.  The
>> At91Bootstrap loads U-Boot from the same Dataflash.  Then, I would like
>> U-Boot to load the Linux kernel from the UBI file system on a large 2
>> GByte NAND flash.  This should be much better than using JFFS2 on the
>> large NAND flash.
> Indeed.
>
> Best regards,
>
> Wolfgang Denk
>

Thanks again for your help, Wolfgang; this is greatly appreciated.  I've 
now set up U-Boot so that I can read and mount UBI partitions on my NAND 
flash.  (Booting the kernel from UBI is another matter - see below for 
further details.)  Qualitatively, I find that UBI mounts much quicker 
than JFFS2, and I will be using this file system for my new embedded system.

To turn on U-Boot support, I had to include the following defines in my 
board config file.  After doing so, I was able see the ubi commands 
after typing the U-Boot help command.  These are the defines from my 
board config file:

#define CONFIG_CMD_NAND
#define CONFIG_CMD_UBI
#define CONFIG_CMD_UBIFS
#define CONFIG_RBTREE
#define CONFIG_MTD_DEVICE
#define CONFIG_MTD_PARTITIONS
#define CONFIG_CMD_MTDPARTS
#define CONFIG_LZO

I set up three partitions on the NAND flash by defining the mtdids and 
mtdparts environment variables.  Here is the output of the "mtdparts" 
command in U-Boot:

U-Boot> mtdparts

device nand0 , # parts = 3
  #: namesizeoffset  mask_flags
  0: kernel  0x00a0  0x  0
  1: root0x0640  0x00a0  0
  2: storage 0x7920  0x06e0  0

active partition: nand0,0 - (kernel) 0x00a0 @ 0x

defaults:
mtdids  : nand0=flash
mtdparts: mtdparts=flash:10M(kernel),100M(root),-(storage)


Then, I switched to each partition using the ubi part commands.  After 
switching to each partition, I created a volume on each partition.  The 
sequence of commands are shown below.  Each command completed 
successfully without errors:

U-Boot> ubi part kernel
U-Boot> ubi create container
U-Boot> ubi part root
U-Boot> ubi create container
U-Boot> ubi part storage
U-Boot> ubi create container


On the host Linux system, I created kernel and root image files using 
the mkfs.ubifs command-line tools (compiled from git):

mkfs.ubifs -x none -r ./images -m 4096 -e 258048 -c 43 -U -v -o kernel.img
mkfs.ubifs -x none -r ./target -m 4096 -e 258048 -c 450 -U -v -o root.img

These image files were transferred to the target system over the serial 
port using the U-Boot "loadb" command.  The image files were then copied 
to each UBI partition using the "ubi write" command.  By using the 
"ubifsmount" command, I am able to mount each of the "container" 
partitions and read the contents using the "ubifsls" command.  For example:

U-Boot> ubi part kernel
Creating 1 MTD partitions on "nand0":
0x-0x00a0 : "mtd=0"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   262144 bytes (256 KiB)
UBI: logical eraseblock size:258048 bytes
UBI: smallest flash I/O unit:4096
UBI: sub-page size:  1024
UBI: VID header offset:  1024 (aligned 1024)
UBI: data offset:4096
UBI: attached mtd1 to ubi0
UBI: MTD device name:"mtd=0"
UBI: MTD device size:10 MiB
UBI: number of good PEBs:40
UBI: number of bad PEBs: 0
UBI: max. allowed volumes:   128
UBI: wear-leveling threshold:4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 40
UBI: number of PEBs reserved for bad PEB handling: 2
UBI: max/mean erase counter: 4/1
U-Boot> ubifsmount container
UBIFS: mounted UBI device 0, volume 0, name "container"
UBIFS: mounted read-only
UBIFS: file system size:   6193152 bytes (6048 KiB, 5 MiB, 24 LEBs)
UBIFS: journal size:   2322433 bytes (2268 KiB, 2 MiB, 8 LEBs)
UBIFS: media format:   w4/r0 (latest is w4/r0)
UBIFS: default compressor: no compression
UBIFS: reserved for root:  0 bytes (0 KiB)
U-Boot> ubifsls
   1256920  Thu Mar 31 16:19:57 2011  uImage


I then used the "ubifsload" command to load the uImage into SDRAM memory:

U-Boot> ubifsload 0x2200 uImage
Loading file 'uImage' to addr 0x2200 wit

Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-30 Thread Wolfgang Denk
Dear Joakim Tjernlund,

In message 
 you 
wrote:
>
> JFFS2 deprecated? It is very stable and works well for NOR based filesystems.

Yes, we consider it deprecated, and we do not use it in any new
projects / products.

> Do you use UBIFS for NOR as well these days?

Yes, we do.  [And yes, we know about the problems it has in certain
configurations, but 1) these are pretty rare these days and 2) we are
working on fixes.]

> > JFFS2 has always been slow, especially when mounting larger file
> > systems.  This is one of the resons we recommend UBIFS instead.
> 
> The u-boot impl. is a bad version of the one in linux. The u-boot
> version should be rewritten/fixed to match current Linux.

Patches welcome.

Nevertheless, the Linux mount times for JFFS2 are still slower than
UBIFS times, aren't they?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"A fractal is by definition a set for which the Hausdorff Besicovitch
dimension strictly exceeds the topological dimension."
- Mandelbrot, _The Fractal Geometry of Nature_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-30 Thread Joakim Tjernlund
>
> Dear Nicholas Kinar,
>
> In message <4d92428e.6030...@usask.ca> you wrote:
> >
> > (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2
> > directory influence the robustness of the fsload code?
>
> JFFS2 is more or less deprecated these days.  FOr new projects, we
> recommend to use UBI/ UBIFS instead.

JFFS2 deprecated? It is very stable and works well for NOR based filesystems.
Do you use UBIFS for NOR as well these days?

>
> > (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.
>
> JFFS2 has always been slow, especially when mounting larger file
> systems.  This is one of the resons we recommend UBIFS instead.

The u-boot impl. is a bad version of the one in linux. The u-boot
version should be rewritten/fixed to match current Linux.

 Jocke

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Wolfgang Denk
Dear Nicholas Kinar,

In message <4d92531e.4030...@usask.ca> you wrote:
>
> I would assume that the "fsload" command will also work with UBIFS as well.

No. UBIFS uses it's own command set; you will use "ubifsload" instead.

> In my custom system, At91Bootstrap is situated on SPI Dataflash.  The 
> At91Bootstrap loads U-Boot from the same Dataflash.  Then, I would like 
> U-Boot to load the Linux kernel from the UBI file system on a large 2 
> GByte NAND flash.  This should be much better than using JFFS2 on the 
> large NAND flash.

Indeed.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"One day," said a dull voice from down below, "I'm going to  be  back
in  form again and you're going to be very sorry you said that. For a
very long time. I might even go so far as to make even more Time just
for you to be sorry in."  - Terry Pratchett, _Small Gods_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Nicholas Kinar
On 29/03/2011 3:05 PM, Wolfgang Denk wrote:
> Dear Nicholas Kinar,
>
> In message<4d92428e.6030...@usask.ca>  you wrote:
>> (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2
>> directory influence the robustness of the fsload code?
> JFFS2 is more or less deprecated these days.  FOr new projects, we
> recommend to use UBI/ UBIFS instead.
>
>> (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.
> JFFS2 has always been slow, especially when mounting larger file
> systems.  This is one of the resons we recommend UBIFS instead.
>
>> or has this been cleaned up in the current u-boot-2010.09 code?
> v2010.09 is in no way "current".  The latest release available at this
> moment is v2010.12, and v2011.03 is a mere few days aways.
>
> Best regards,
>
> Wolfgang Denk
>

Thanks for your response, Wolfgang - I will switch the file system to 
UBI/UBIFS, and then post back what I've done.  I've been looking in the 
include/configs/sheevaplug.h directory, and I think that this small 
embedded computer is now using UBIFS as the NAND flash file system.  So 
changing the configs for my embedded system should be reasonably 
straightforward.

I would assume that the "fsload" command will also work with UBIFS as well.

In my custom system, At91Bootstrap is situated on SPI Dataflash.  The 
At91Bootstrap loads U-Boot from the same Dataflash.  Then, I would like 
U-Boot to load the Linux kernel from the UBI file system on a large 2 
GByte NAND flash.  This should be much better than using JFFS2 on the 
large NAND flash.

Nicholas



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Wolfgang Denk
Dear Nicholas Kinar,

In message <4d92428e.6030...@usask.ca> you wrote:
>
> (1) Does replacing jffs2_1pass.c with jffs2_nand_1pass.c in the fs/jffs2 
> directory influence the robustness of the fsload code?

JFFS2 is more or less deprecated these days.  FOr new projects, we
recommend to use UBI/ UBIFS instead.

> (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. 

JFFS2 has always been slow, especially when mounting larger file
systems.  This is one of the resons we recommend UBIFS instead.

> or has this been cleaned up in the current u-boot-2010.09 code?

v2010.09 is in no way "current".  The latest release available at this
moment is v2010.12, and v2011.03 is a mere few days aways.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
It seems intuitively obvious to me, which  means  that  it  might  be
wrong. -- Chris Torek
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Nicholas Kinar
On 29/03/2011 2:46 PM, Scott Wood wrote:
> On Tue, 29 Mar 2011 14:35:26 -0600
> Nicholas Kinar  wrote:
>
>> 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?
> I haven't used U-Boot's jffs2 support (the previous answer was from reading
> the source code), so I can't help here, sorry.
>
> -Scott
>
>

That is fine, Scott; your previous answer was extremely helpful, and I 
think that I am now well on my way to booting the Linux kernel from NAND 
flash on my new embedded system.

Thanks again,

Nicholas
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Scott Wood
On Tue, 29 Mar 2011 14:35:26 -0600
Nicholas Kinar  wrote:

> 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?

I haven't used U-Boot's jffs2 support (the previous answer was from reading
the source code), so I can't help here, sorry.

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Nicholas Kinar
On 29/03/2011 11:56 AM, Scott Wood wrote:
> On Tue, 29 Mar 2011 11:37:25 -0600
> Nicholas Kinar  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_NAND1
>>>
>> 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 0x2200
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


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Scott Wood
On Tue, 29 Mar 2011 11:37:25 -0600
Nicholas Kinar  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_NAND1
> >
> 
> 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

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Nicholas Kinar
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_NAND1
>

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?



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

2011-03-29 Thread Nicholas Kinar
Hello,

I've designed a custom circuit board based around the AT91SAM9RL64 
processor from Atmel.  This is an ARM9 AT91SAM9 series chip.  The Atmel 
evaluation kit for this processor is supported by U-Boot, and the 
configuration header file can be found in the u-boot-2010.09 source code 
distribution (/include/configs/at91sam9rlek.h).

To support my custom hardware, I've made small changes to the 
/include/configs/at91sam9rlek.h configuration file and to the files in 
the /board/atmel/at91sam9rlek/ directory.

On my custom circuit board, the AT91bootstrap first-order bootloader is 
loaded from SPI Dataflash.  In turn, the AT91bootstrap code loads U-Boot 
to SDRAM memory and then jumps to the load address.  The U-Boot binary 
is also stored on SPI dataflash.  I am able to successfully load U-Boot 
on my custom hardware, and I am able to use the nand subsystem commands 
to access the NAND flash.

I would like to use the fsload command to load the Linux kernel from a 
JFFS2 filesystem written to the NAND flash, but to me it is not 
immediately clear what I need to modify in the U-Boot code to be able to 
do this.  Perhaps the YAFFS filesystem would be more appropriate?

I've found several mailing list threads on a related question, but I 
still can't determine how to boot from NAND flash.  Does fsload only 
support NOR flash, or is it possible to use fsload on NAND flash?

[1] http://lists.denx.de/pipermail/u-boot/2007-December/027578.html
[2] http://www.mail-archive.com/u-boot@lists.denx.de/msg28173.html
[3] http://old.nabble.com/NAND-boot-from-file-td7930776.html
[4] 
http://blackfin.uclinux.org/gf/project/u-boot/forum/?_forum_action=ForumMessageBrowse&thread_id=17711&action=ForumBrowse

As suggested in thread [4] above, I tried replacing jffs2_1pass.c with 
jffs2_nand_1pass.c in the fs/jffs2 directory.

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_NAND1

However, after making these changes, the compilation process does not 
work, with the following error being reported:

make[1]: Entering directory 
`/home/nkinar/DEVICE-CODE/uboot/u-boot-2010.09/common'
arm-none-linux-gnueabi-gcc  -g  -Os   -fno-common -ffixed-r8 
-msoft-float  -D__KERNEL__ -DTEXT_BASE=0x23f0 
-I/home/nkinar/DEVICE-CODE/uboot/u-boot-2010.09/include -fno-builtin 
-ffreestanding -nostdinc -isystem 
/home/nkinar/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1/include
 
-pipe  -DCONFIG_ARM -D__ARM__ -marm  -mabi=aapcs-linux 
-mno-thumb-interwork -march=armv5te  -Wall -Wstrict-prototypes 
-fno-stack-protector   \
 -o cmd_jffs2.o cmd_jffs2.c -c
cmd_jffs2.c: In function 'mtd_device_validate':
cmd_jffs2.c:172:24: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'flash_info'
cmd_jffs2.c:172:24: error: 'flash_info' undeclared (first use in this 
function)
cmd_jffs2.c:172:24: note: each undeclared identifier is reported only 
once for each function it appears in
cmd_jffs2.c:172:35: error: expected expression before ']' token
cmd_jffs2.c: In function 'get_part_sector_size_nor':
cmd_jffs2.c:275:22: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'flash_info'
cmd_jffs2.c:275:22: error: 'flash_info' undeclared (first use in this 
function)
cmd_jffs2.c:275:33: error: expected expression before ']' token
cmd_jffs2.c:279:2: error: 'flash_info_t' undeclared (first use in this 
function)
cmd_jffs2.c:279:16: error: 'flash' undeclared (first use in this function)
make[1]: *** [cmd_jffs2.o] Error 1
make[1]: Leaving directory 
`/home/nkinar/DEVICE-CODE/uboot/u-boot-2010.09/common'
make: *** [common/libcommon.a] Error 2

What do I need to update in U-Boot to be able to use fsload on my custom 
hardware?



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot