NAND flashing trouble on Sheeva Plug - ideas?

Hello,

Sorry if this is wrong forum. I read many posts here while trying to solve my problem, and the board users were helpful and knowledgeable. If I’m in the wrong place, let me know.

I wish to flash the NAND on my Sheeva Plug with uImage linux kernel.

I believe a bad block in the region intended to hold the uImage file file prevents it.

Why do I think this?

-sh-3.2# flash_erase /dev/mtdblock1

Erase Total 1 Units

-sh-3.2# flash_eraseall /dev/mtd1

Erasing 128 Kibyte @ 1e0000 – 93 % complete.

-sh-3.2# nandwrite -p /dev/mtd1 uImage.sheeva.20090319

Image 2106760 bytes, NAND page 2048 bytes, OOB area 2048 bytes, device size 2097152 bytes

Input file does not fit into device: Success

Data was only partially written due to error

The uImage file is provided - I did not create it. The uImage file I’m trying to flash with is not corrupt, because I boot the exact same file via nfs, and it works fine. (Valid assumption?)

If I get really desperate, I might try re-compiling uImage file to make it smaller, but that leads to solving cross compiler issues and I did not want to go down that path right away…

I think I can work around the problem in a couple of ways;

  1. I think it possible to redefine “partition size” of uImage area (/dev/mtd1) such that the uImage would fit, even with a bad block. Implications seem to be that the rootfs beginning address (/dev/mtd2) will also need to relocate, to accommodate re-sizing the uImage area (/dev/mtd1). I think it means altering bootargs - the hex addresses of uImage location & size, the hex address of root fs location & size.

  2. I think it possible to execute uboot command ‘nand scrub’ and mark bad blocks good, maybe. Implications are more risky here. Block might really be bad, and a corrupt file won’t boot, either. Also, I don’t really know what I’m doing, and I might accidentally erase the uboot code, which is still running fine. If that happens, I’m all done. I’m lacking a JTAG debugger capable of re-flashing uboot code (and lacking knowledge of how to do it comfortably.)

I can try to tell how I got in this state, if that helps.

Any suggestions, guidance, hints, URLs, readme’s, How2s are welcome.

Thanks in advance,

alex

Additional detail below; Sorry if too much.

** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Mar 16 2009 - 18:03:32) Marvell version: 3.4.16

U-Boot code: 00600000 → 0067FFF0 BSS: → 006CEE80

Soc: 88F6281 A0 (DDR2)

CPU running @ 1200Mhz L2 running @ 400Mhz

SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6

DRAM CS[0] base 0x00000000 size 256MB

DRAM CS[1] base 0x10000000 size 256MB

DRAM Total size 512MB 16bit width

Flash: 0 kB

Addresses 8M - 0M are saved for the U-Boot usage.

Mem malloc Initialization (8M - 7M): Done

NAND:512 MB

CPU : Marvell Feroceon (Rev 1)

{ here are some details about Linux version - from nfs booted kernel image }

Marvell>> boot

Using egiga0 device

TFTP from server 192.168.1.103; our IP address is 192.168.1.105

Filename ‘uImage.sheeva.20090319’.

Load address: 0x200000

Loading: T ######################…#deleted#…

done

Bytes transferred = 2106760 (202588 hex)

Booting image at 00200000 …

Image Name: Linux-2.6.22.18

Created: 2009-03-19 9:18:16 UTC

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 2106696 Bytes = 2 MB

Load Address: 00008000

Entry Point: 00008000

Verifying Checksum … OK

OK

Starting kernel …

Uncompressing Linux…

Linux version 2.6.22.18 (dhaval@devbox) (gcc version 4.2.1) #1 Thu Mar 19 14:46:22 IST 2009

CPU: ARM926EJ-S [56251311] revision 1 (ARMv5TE), cr=00053177

Machine: Feroceon-KW

Using UBoot passing parameters structure

{ lots more kernel boot msgs available, not really applicable to my problem.

I can supply any or all of it upon request. }

{ this is env from the uboot, set up to boot NFS. It works. }

Marvell>> printenv

baudrate=115200

loads_echo=0

netmask=255.255.255.0

CASset=min

MALLOC_len=1

ethprime=egiga0

bootargs_end=:::DB88FXX81:eth0:none

standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end)

(more but word-wrapped off terminal)

ethaddr=00:50:43:fd:1d:23

ethmtu=1500

mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs

mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500

usb0Mode=host

yuk_ethaddr=00:00:00:EE:51:81

nandEcc=1bit

netretry=no

rcvrip=169.254.100.100

loadaddr=0x02000000

autoload=no

ethact=egiga0

run_diag=no

ipaddr=192.168.1.105

serverip=192.168.1.103

rootpath=/home/sheeva

image_name=uImage.sheeva.20090319

console=console=ttyS0,115200 mtdparts=nand_flash:0x100000@0x00000(u-boot),0x400000@0x100000(uImage),0x1f800000@0x500000(rootfs)rw

bootargs_root=root=/dev/nfs rw

bootargs=console=ttyS0,115200 mtdparts=nand_flash:0x400000@0x100000(uImage)ro,0x1fC00000@0x500000(rootfs)rw root=/dev/mtdblock2

bootcmd=tftpboot 0x200000 $(image_name);setenv bootargs $(console) $(bootargs_root) nfsroot=$(serverip):$(rootpath) ip=$(ipaddr):$(serverip)$(0

(more but word-wrapped. tftpboot works…)

stdin=serial

stdout=serial

stderr=serial

mainlineLinux=no

enaMonExt=no

enaCpuStream=no

enaWrAllo=no

pexMode=RC

disL2Cache=no

setL2CacheWT=yes

disL2Prefetch=yes

enaICPref=yes

enaDCPref=yes

sata_dma_mode=yes

netbsd_en=no

vxworks_en=no

bootdelay=3

disaMvPnp=no

enaAutoRecovery=yes

Environment size: 1432/131068 bytes

Marvell>>

{ here is the bootargs & bootcmd I use that fails, because uImage incomplete. }

setenv bootargs 'console=ttyS0,115200 mtdparts=nand_flash:0x400000@0x100000(uImage)ro,0x1fC00000@0x500000(

rootfs)rw root=/dev/mtdblock2’

setenv bootcmd 'nand read.e 0x800000 0x100000 0x400000; bootm

0x800000’

{ after I boot via nfs and using above nfs bootargs, see what can be seen on flash. }

-sh-3.2# mtd_debug info /dev/mtd1

mtd.type = MTD_NANDFLASH

mtd.flags = MTD_CAP_NANDFLASH

mtd.size = 2097152 (2M)

mtd.erasesize = 131072 (128K)

mtd.writesize = 2048 (2K)

mtd.oobsize = 64

regions = 0

{ here is link to Sheeva Plug docs; How2 flash NAND, Board drawings, initial (shipped) env }

http://www.marvell.com/products/embedde … ackage.zip

I chose method 1) from previous post. I’ll change bootargs so nfs boots, but defines mtdparts bigger.

Existing Marvell ‘how2’ docs sets initial mtdparts for nfs boot, but it imposes partition structure that will be flashed. The Marvell docs (the addresses they refer to) no longer apply.

Original;

Marvell>> set console 'console=ttyS0,115200

mtdparts=nand_mtd:0x100000@0x000000(u-boot),0x400000@0x10000

0(uImage),0x1f800000@0x500000(rootfs)rw’

I change uImage portion to

0x300000@0x100000(uImage)

existing tftp bootcmd should work. it is;

Marvell>> set bootcmd 'tftpboot 0x2000000 $(image_name);setenv bootargs

$(console) $(bootargs_root) nfsroot=$(serverip):$(rootpath)

ip=$(ipaddr):$(serverip)$(bootargs_end); bootm 0x2000000’

I boot nfs, ok, it booted as usual.

check - cat /proc/mtd

-sh-3.2# cat /proc/mtd

dev: size erasesize name

mtd0: 00100000 00020000 “u-boot”

mtd1: 00300000 00020000 “uImage”

mtd2: 1f800000 00020000 “rootfs”

yes, mtd1 is now bigger.

now back to plugwiki style docs to flash it.

{ http://www.openplug.org/plugwiki/index. … o_the_Plug }

flash_erase /dev/mtdblock1

Erase Total 1 Units

flash_eraseall /dev/mtd1

flash_eraseall: Erasing 128 Kibyte @ 2e0000 – 95 % complete.

flash_erase /dev/mtdblock2

Erase Total 1 Units

flash_eraseall /dev/mtd2

{ large bad block list }

it completes.

cat uImage.sheeva.20090319 > /dev/mtdblock1

succeeds no errors.

nandwrite /dev/mtd2 ubuntu-9.0.5.Release.jffs2

{ scrolls hex addrs of blocks being written }

Now change bootargs to boot flashed image with revised size of uImage, and jffs2 filesys.

Original;

Marvell>> setenv bootargs 'console=ttyS0,115200

mtdparts=nand_flash:0x200000@0x1

00000(uImage)ro,0x1fc00000@0x500000(rootfs)ro root=/dev/mtdblock2’

Marvell>> saveenv

change to nand_flash:0x300000@0x100000(uImage)ro,
0x1f800000@0x500000(rootfs)ro root=/dev/mtdblock2’

Change bootcmd to reflect new starting addr of uImage (I think)

Original;

Marvell>> setenv bootcmd 'nand read.e 0x800000 0x100000 0x400000; bootm

0x800000’

change to 0x300000

it boots from flash again. at least once… :o :smiley:

I got many errors during boot, but kernel seems to behave ok. There is a u-boot variable “standalone” that refers to old hex addresses, maybe it is having an effect… I’ll muck with that later.

Hope this helps other sheeva plug users.

I had problems flashing mtd1 as well, download the latest flash image from the site “uImage.sheeva.040309”.

flash_erase -j /dev/mtd1

nandwrite -p uImage.sheeva.040309

All will be well.

I was moving my system to a SD flash card the wrong way and screwed mine up :slight_smile:

If you need to emergency boot, copy the images to a vfat partition on a usb key and boot from the image there. you can copy the jffs2 files to a ext3 partition on a usb key for emergency reasons as well. or you can boot all of it to nfs…repair the mtd1 and mtd2 and the reboot. set boot args. your back in business!

BESURE YOU DONT TOUCH MTD0! this holds your u-boot image and you will need a jtag programmer to recover from this :slight_smile:

typo on that

nandwrite -p /dev/mtd1 uImage.sheeva.040309

anywho…you get the point :slight_smile:

I can verify that using the later version of uImage works. I had the same error, once I downloaded the April 1.2 release, it worked a charm.

Thanks!

u-boot 1.1.4 is fantasticaly ancient !

Where does u-boot store it’s environment ? in NOR ?

Traditionaly the parititioning of NAND is something like :

  • ~ 256K for u-boot

  • ~32 or 64KB for u-boot environment (redundancy possible)

  • ~4 or ~5MB for a kernel+ramdisk (initramfs, or lots of staticaly compiled modules)

  • The rest for the rootfs

I think you should look into upgrading your u-boot to something thst is not 5 years old :>

Problem is that no one seems to know how to compile a U-Boot that works on the Sheeva Plug. At least, not on any forum. So it would be pretty hard to upgrade to a newer version of U-Boot.

I have performance and power usage numbers if anyone is interested:

http://computingplugs.com/index.php/She … erformance

Ordered one of these actualy. They look like fun :=)