Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to boot the kernel from NAND flash.
PostPosted: Fri Sep 07, 2007 2:02 pm 
Offline

Joined: Wed Feb 28, 2007 3:51 pm
Posts: 26
Location: Sweden
This is how to set up u-boot to boot the kernel from the NAND flash at at91sam9261ek.

First off allow run the command help nand, the print out should be something like this.

U-boot> help nand
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read[.jffs2[s]] addr off size
nand write[.jffs2] addr off size - read/write `size' bytes starting
at offset `off' to/from memory address `addr'
nand erase [clean] [off size] - erase `size' bytes from
offset `off' (entire device if not specified)
nand bad - show bad blocks
nand read.oob addr off size - read out-of-band data
nand write.oob addr off size - read out-of-band data

I personally did not get a help print out but the command exist so it dose not mater.

The memory mapping of the at91sam9261ek lets us know that the SDRAMC has the address space 0x20000000 - 0x2FFFFFFF.

The first thing to do is to download the kernel image to the SDRAMC space I used the following command.

U-boot> tftp 0x23000000 uImage

You can run the command md 0x23000000 to se if the image is there or not.
Next is to write the Image to the NAND flash in my case the NAND flash address space is at 0x40000000 - 0x4FFFFFFF.
On the net I found that the command to write the image to the NAND was

U-boot> nand write 0x23000000 0x0 $(filesize)

where the first argument is the position of the image in the SDRAMC and the second is the offset for the address to place the image in the NAND the third is the size of the image. This did not work for me but it might for you so try it.
I am no expert but what I found out was that if the size is a multiple of 512 byte then it worked, but it hade to be a multiple of 2 kB what I mean whit that is that the multiple have to be 4x512=2048. So the size of my image was 0x14F29C and 512 in hex is 0x200 so by using the size 0x14F800 I managed to write it to the NAND. The next multiple is 0x150000 since 0x14F800 + 0x800 = 0x150000. The command that I run was

U-Boot> nand write 0x23000000 0x0 0x150000

If you like you can know restart the system move the image to from the NAND to the SDAMC and boot from there with the commands.

U-Boot> nand read 0x23000000 0x0 0x150000
U-boot> bootm 0x23000000

This is only if you would like to try and see if it worked or not.

The next step is to set some environment variables. The first to set is the autostart by running the command.

U-boot> setenv autostart yes
U-boot> printenv
U-boot> saveenv

Next is to set the bootcmd this is done by running

U-boot> setenv bootcmd nboot 0x23000000 0x0
U-boot> printenv

nboot is the boot command the arguments are the load address for the image in SDRAMC and the offset to where the image is stored in the NAND flash.

restart the system and now you should be able to boot the kernel from the NAND flash


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 09, 2007 8:51 am 
Offline

Joined: Wed Sep 12, 2007 4:25 pm
Posts: 7
in the

U-boot> setenv bootcmd nboot 0x23000000 0x0

command the 0x0 is not a offset in nand flash. Its a device number within nand flash devices connencted to chip.

U-boot> setenv bootcmd nboot 0x23000000 0x0 0x10000

the last parameter in above command is the offset within nand flash device 0.


Help: i am using nand flash to store the kernel image and rmadisk. The 0-10 blocks of my nand device are bad blocks. When i download the imgae using samba-isp it skips the bad blocks and stores to naxt blocks. But when i say bootcmd nboot >0x23000000 0x0 0x0 uboot and >saveenv shows read error after rebooting.

Is u-boot handles the bad blocks at the time of booting?

Is nand flash is secure to store the kernal and ramdisk?

thanks in advance...

_______
prashant


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 28, 2007 11:55 pm 
Offline

Joined: Thu Jul 12, 2007 8:57 am
Posts: 7
I've take a look at u-boot documentation at denx web site, but couldn't find any information about nand subsystem commands.

mikrodidakt, thanks for the guide. It really helped me.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 29, 2007 6:01 pm 
Offline

Joined: Wed Feb 14, 2007 11:17 am
Posts: 67
ayuce wrote:
I've take a look at u-boot documentation at denx web site, but couldn't find any information about nand subsystem commands.

Following commands documentation is available in the u-boot doc/README.nand documentation file :
http://www.denx.de/cgi-bin/gitweb.cgi?p ... EADME.nand


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: