• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1] 2
Author Topic: Cannot boot from NAND after reflash?  (Read 10278 times)
alexbez
Newbie
*

Karma: 0
Posts: 7


View Profile
« on: April 13, 2009, 12:58:26 PM »

Hi,

After experimenting awhile with my Sheeva Plug, I managed to screw up the contents of /dev/mtd2, so I needed to reflash the NAND.
u-Boot (in /dev/mtd0) and uImage (in /dev/mtd1) remain intact.

Booting from tftp worked just fine, so did booting from USB flash drive (two partitions, 1st vfat partition with uImage, 2nd ext2 partition with rootfs from ubuntu.9.04.tar.gz, taken from http://plugcomputer.org/index.php/resources/downloads?func=select&id=2

Here is what I did to restore /dev/mtd2:

1. setenv console 'console=ttyS0,115200 mtdparts=nand_mtd:0x100000@0x000000(u-boot),0x200000@0x100000(uImage),0x1fd00000@0x500000(rootfs)rw'
2. Boot from tftp
3. sh-3.2# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00200000 00020000 "uImage"
mtd2: 1fd00000 00020000 "rootfs"

4. uImage.sheeva.040309 and ubuntu.9.0.5.Release.jffs were put to /sos directory on tftp root on the host
5. # flash_erase /dev/mtdblock1
    # flash_eraseall /dev/mtd1
    # flash_erase /dev/mtdblock2
    # flash_eraseall /dev/mtd2

6. # cat /sos/uImage.sheeva.040309 > /dev/mtdblock1
7. # nandwrite -m /dev/mtd2 /sos/ubuntu-9.0.5.Release.jffs2
8. # mount -t jffs2 /dev/mtdblock2 /mnt

Here comes the surprise: /dev/mtd2 mounts OK, but it is almost empty! Only 3% is used (and originally it was about 35% full!)
But I decided to give it a try anyway  Smiley
9. #umount /mnt
10. #reboot
11. Stopped the boot, got u-Boot prompt
12. >> setenv bootargs 'console=ttyS0,115200 mtdparts=nand_flash:0x200000@0x100000(uImage)ro,0x1fd00000@0x300000(rootfs)ro root=/dev/mtdblock2'
>>  setenv bootcmd 'nand read.e 0x800000 0x100000 0x400000; bootm 0x800000'
>> saveenv
>> boot


...and, of course, after the kernel loads I get:

VFS: Mounted root (jffs2 filesystem).                                                                                                                                     
Freeing init memory: 124K                                                                                                                                                 
Warning: unable to open an initial console.                                                                                                                               
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.     


What else shall I expect? I already knew, that my rootfs is almost empty and there were no /sbin/init in there.
Indeed, I downloaded the .jffs2 filesystem again and repeated the reflashing... with the same result.

What am I doing wrong??? Any help will be greatly appreciated. Thank you.
Logged

----------------------------------
"Everybody is entitled to be stupid,
but some people just abuse the privilege"

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #1 on: April 14, 2009, 05:51:33 PM »

You ever get that sorted? I'm in exactly the same boat. I'm able to successfully boot via nfs/tftp, I'm able to flash a working uImage, but I just don't seem to be able to get the jffs beastie working...
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #2 on: April 14, 2009, 06:16:16 PM »

your mtparts definitions are bad in step 1.  read what I wrote in:

http://openplug.org/plugforum/index.php?topic=52.0

you need to use 0x1fd00000@00300000 if you want to stick with the 2MB uImage partition.

Mark
« Last Edit: April 14, 2009, 06:22:08 PM by kilowatt » Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #3 on: April 14, 2009, 06:18:41 PM »

This is weird; the downloaded filesystem image isn't working for me, but the one on the CD is. Sorta. Hangs for quite a while after bringing up the ethernet device, and this doesn't look too snazzy:


 * Loading hardware drivers... 
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
end_request: I/O error, dev mtdblock0, sector 8
Buffer I/O error on device mtdblock0, logical block 1
end_request: I/O error, dev mtdblock0, sector 16
Buffer I/O error on device mtdblock0, logical block 2
end_request: I/O error, dev mtdblock0, sector 24
Buffer I/O error on device mtdblock0, logical block 3
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
                                                                         [ OK ]
 * Setting the system clock
« Last Edit: April 14, 2009, 06:22:56 PM by plugit » Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #4 on: April 14, 2009, 06:21:22 PM »

your mtparts definitions are bad.  read what I wrote in:

http://openplug.org/plugforum/index.php?topic=52.0

Mark

Hmmm.

Mine look like this:

mtdparts=nand_mtd:0x00100000@0x00000000(uBoot)ro,0x00400000@0x00100000(uImage),0x1fb00000@0x00500000(rootfs)

I'd have thought that would be OK... idk.  Undecided
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #5 on: April 14, 2009, 06:30:30 PM »

That should be ok. 

You should rewite the uImage and the file_system.jff2 make sure you use

flash_eraseall -j /dev/mtd1
flash_eraseall -j /dev/mtd2

nandwrite -pm /dev/mtd1 uImage.sheeva.20090319
nandwrite -pm /dev/mtd2  ubuntu-9.0.5.Release.jffs2

and make sure You use the same mtparts definition in all you different bootargs

Mark
Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #6 on: April 14, 2009, 06:32:30 PM »

Cheers. Giving that a try right now.
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #7 on: April 14, 2009, 06:39:20 PM »

The delay after the ethernet might be it doing DHCP  Does your bootcmd have ip definitions in it?

my full bootargs for nand boot looks like this:

bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=192.168.0.7:192.168.0.4:192.168.0.1:255.255.255.0:DB88FXX81:eth0:none

note that I don't include the definition for the uboot partition in this so it doesn't show up when it is running the kernel.  This causes the uImage to show up at /dev/mtd0 and the file system to be at /dev/mtd1.  If you include the uboot partition change root=/dev/mtdblock1 to root=/dev/mtdblock2

Mark
« Last Edit: April 14, 2009, 06:41:31 PM by kilowatt » Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #8 on: April 14, 2009, 06:41:10 PM »

Here we go:

-sh-3.2# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "uBoot"
mtd1: 00400000 00020000 "uImage"
mtd2: 1fb00000 00020000 "rootfs"

-sh-3.2# flash_eraseall -j /dev/mtd1
Erasing 128 Kibyte @ 3e0000 -- 96 % complete. Cleanmarker written at 3e0000.
-sh-3.2# flash_eraseall -j /dev/mtd2
Erasing 128 Kibyte @ faa0000 -- 49 % complete. Cleanmarker written at faa0000.
Skipping bad block at 0x0fac0000
Erasing 128 Kibyte @ 1fae0000 -- 99 % complete. Cleanmarker written at 1fae0000.

-sh-3.2# nandwrite -pm /dev/mtd1 uImage.sheeva.040309
Writing data to block 0
Writing data to block 20000
[snip]

-sh-3.2# nandwrite -pm /dev/mtd2 ubuntu-9.0.5.Release.jffs2
Writing data to block 0
Writing data to block 20000
[snip]

Marvell>> printenv
baudrate=115200
loads_echo=0
rootpath=/sheevaplug/rootfsv1.0/
netmask=255.255.255.0
CASset=min
MALLOC_len=1
ethprime=egiga0
bootargs_root=root=/dev/mtdblock2 ro
ethmtu=1500
usb0Mode=host
nandEcc=1bit
ethact=egiga0
cesvcid=ULULULULULULPPULULULULULDA
bootargs_end=:::DB88FXX81:eth0:none
image_name=uImage.sheeva.040309
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
yuk_ethaddr=00:00:00:EE:51:81
netretry=no
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
ethaddr=00:50:43:01:C3:38
run_diag=no
ipaddr=192.168.0.3
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
console=console=ttyS0,115200 mtdparts=nand_mtd:0x00100000@0x00000000(uBoot)ro,0x00400000@0x00100000(uImage),0x1fb00000@0x00500000(rootfs)
boottftp=tftpboot 0x2000000 $(image_name)
bootargs_nfs=root=/dev/nfs rw
boot_nfs=run boottftp;setenv bootargs $(console) $(bootargs_nfs) nfsroot=$(serverip):$(rootpath) ip=$(ipaddr):$(serverip)$(bootargs_end);bootm 0x2000000
bootnand=nand read.e 0x2000000 0x00100000 0x00500000
bootargs_nand=root=/dev/mtdblock2 rw
boot_nand=run bootnand;setenv bootargs $(console) $(bootargs_nand) ip=$(ipaddr):$(serverip)$(bootargs_end);bootm 0x2000000
bootargs_sd=root=/dev/mmcblk0p1 rw
boot_sd=run bootnand;setenv bootargs $(console) $(bootargs_sd) ip=$(ipaddr):$(serverip)$(bootargs_end);bootm 0x2000000
serverip=192.168.0.4
bootcmd=run boot_nfs;
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: 1800/131068 bytes
Marvell>> setenv bootcmd 'run boot_nand;'
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #9 on: April 14, 2009, 06:41:37 PM »

And...

fail.

eth0: link up, full duplex, speed 1 Gbps
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 124K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #10 on: April 14, 2009, 06:42:31 PM »

The delay after the ethernet might be it doing DHCP  Does your bootcmd have ip definitions in it?

my full bootargs for nand boot looks like this:

bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=192.168.0.7:192.168.0.4:192.168.0.1:255.255.255.0:DB88FXX81:eth0:none

note that I don't include the definition for the uboot partition in this so it doesn't show up when it is running the kernel.  This causes the uImage to show up at /dev/mtd0 and the file system to be at /dev/mtd1.  If you include the uboot partition change root=/dev/mtdblock1 to root=/dev/mtdblock2

Mark

Ah! Gotcha. Thanks for explaining that bit, wasn't sure about how the enumeration worked.
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #11 on: April 14, 2009, 06:46:58 PM »

I think your bootcmd has a problem.  Mine is.

bootcmd=nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #12 on: April 14, 2009, 06:52:13 PM »

Hmmm. Maybe I've been cutting and pasting configs too liberally. Wink
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #13 on: April 14, 2009, 06:57:25 PM »

Quote
Ah! Gotcha. Thanks for explaining that bit, wasn't sure about how the enumeration worked.

Without the uboot def I get.

root@debian:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00400000 00020000 "uImage"
mtd1: 1fb00000 00020000 "rootfs"
root@debian:~#

and

root@debian:~# ls -l /dev/mtd*
crw-rw---- 1 root root 90, 0 Apr 14 21:01 /dev/mtd0
crw-rw---- 1 root root 90, 1 Apr 14 21:01 /dev/mtd0ro
crw-rw---- 1 root root 90, 2 Apr 14 21:01 /dev/mtd1
crw-rw---- 1 root root 90, 3 Apr 14 21:01 /dev/mtd1ro
brw-rw---- 1 root disk 31, 0 Apr 14 21:01 /dev/mtdblock0
brw-rw---- 1 root disk 31, 1 Apr 14 21:01 /dev/mtdblock1
root@debian:~#

Just the two partitions.






Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #14 on: April 14, 2009, 07:00:34 PM »

I see. Still fails with your bootcmd, btw. I think I may have to give up on this tonight, I've been trying for hours and my eyes are crossing...

Thanks for your help, though!
Logged

Pages: [1] 2
Print
Jump to: