• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Another Bad Magic Number problem  (Read 5022 times)
alt.ramfree17
Newbie
*

Karma: 0
Posts: 6


View Profile
« on: November 30, 2009, 07:34:29 AM »

Hi,

  I have been trawling the board for all instances of the Bad Magic Number problem. My problem started when I tried to move the plug OS to the MMC card. I mistakenly save the environment settings w/o testing and the plug refuses to boot anymore. The serial connections no longer connects both in Linux and Windows. I tried refreshing the NAND memory by retracing the steps I did when I upgraded the bundled OS but now all I am getting is this message after I reconnect the USB cable after the uboot.bin has been burned:

Code:
Device NOT ready
   Request Sense returned 00 00 00
** Can't read from device 0 **

** Unable to use usb 0:1 for fatload **

NAND erase: device 0 offset 0x100000, size 0x400000
Erasing at 0x4e0000 -- 100% complete. Cleanmarker written at 0x4e0000.
OK

NAND write: device 0 offset 0x100000, size 0x400000

Writing data at 0x4ff800 -- 100% complete.
 4194304 bytes written: OK
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
## Booting image at 00800000 ...
Bad Magic Number

I have already tried using two different flash drives, although I was able to use the first one to do the upgrade for the first time. The printenv result follows:

Code:
baudrate=115200
loads_echo=0
ipaddr=10.4.50.165
serverip=10.4.50.5
rootpath=/mnt/ARM_FS/
netmask=255.255.255.0
console=a0000
e=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x1ff00000@0x100000(root)
CASset=min
MALLOC_len=1
ethprime=egiga0
bootargs_end=:::DB88FXX81:eth0:none
image_name=uImage
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
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
bootargs_root=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
mtdpartitions=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)
ethaddr=00:50:43:01:c1:e6
real_bootcmd=setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000
bootargs_console=console=ttyS0,115200
recover1=setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset
recover2=run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000
recover3=run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000
recover4=usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd
arcNumber=2097
stdin=serial
stdout=serial
stderr=serial
nandEnvBase=a0000
mainlineLinux=yes
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
pcieTune=no
bootcmd=setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000
bootargs=console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand

Environment size: 2210/131068 bytes

I already tried leaving the unit powered on for an hour after the uboot.bin message got shown in the console but still the same results. Any more ideas that I can try to get my plugcomputer to the same state as it was when it arrived? I know I got a devkit but I am getting confused by the documentation. Thanks.

ciao!
Logged

rooster
Administrator
Sr. Member
*****

Karma: 8
Posts: 311


View Profile
« Reply #1 on: November 30, 2009, 07:52:34 AM »

uboot did not read your DOK, check that the uImage is on the DOK root directory and that it is formatted to FAT16
Logged

mgillespie
Full Member
***

Karma: 8
Posts: 239



View Profile
« Reply #2 on: November 30, 2009, 07:57:50 AM »

I had this problem, and the only way I fixed it was using a different flash drive. 
Logged

mike
Jr. Member
**

Karma: 2
Posts: 55


View Profile
« Reply #3 on: November 30, 2009, 08:18:09 AM »

Hi,

I'm a bit confused by your description...  Do you have the previously working uImage on your thumb drive?  By the looks of it, you are able to connect to the plug via serial cable (that's where the output came from, I take it)....

So, if the goal is to write the uImage to the NAND and get your plug back up and running, you could do the following:

nand device 0
usb start

1.  Have the correct uboot.bin on the first partition of your USB stick, and write it to NAND

nand erase 0x0 0xa0000
fatload usb 0:1 0x8000000 /u-boot.bin
nand write.e 0x8000000 0x0 0xa0000
reset


2. have the uImage you want on the first partition of your USB memory stick and write this to NAND

usb start
nand erase 0x100000 0x400000
fatload usb 0:1 0x8000000 /uImage
nand write.e 0x8000000 0x100000 0x400000

If you want to have your rootfs on a MMC card, then you are done configuring the NAND.  Just have your rootfs on the first partition (ext2 based) of your SD card.

Set the following environment variables, telling uboot to use the MMC for the rootfs and boot from NAND. 

setenv bootargs 'console=ttyS0,115200 root=/dev/mmcblk0p1 rw rootfstype=ext2 rootdelay=10';
setenv boot_nand 'nand read.e 0x2000000 0x100000 0x400000'
setenv bootcmd 'mmcinit;run boot_nand; bootm 0x2000000'


then reset (or save first, if you feel brave :-))


Post back with any questions, but the above works for me.

Mike
« Last Edit: November 30, 2009, 10:14:37 AM by mike » Logged

alt.ramfree17
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #4 on: December 02, 2009, 08:35:00 AM »

@rooster: DOK is another name for flash drive? sorry, im unfamiliar with the term.

@mike: yes, i used this flash drive to flash/upgrade the plug to the latest version when I got it last week so I know it was working. It seems that since then and the weekend the flash drive is no longer usable. I tried your first suggestion and this was the result:

Code:
Marvell>> nand device 0
Device 0: NAND 512MB 3,3V 8-bit... is now current device
Marvell>> usb start
(Re)start USB...
USB:   scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... T T T T 1 Storage Device(s) found
Marvell>> nand erase 0x0 0xa0000

NAND erase: device 0 offset 0x0, size 0xa0000
Erasing at 0x80000 -- 100% complete.                                           
OK                                                                             
Marvell>> fatload usb 0:1 0x8000000 /u-boot.bin                                 
Device NOT ready                                                               
   Request Sense returned 06 28 00                                             
** Can't read from device 0 **                                                 
                                                                               
** Unable to use usb 0:1 for fatload **                                       

Which is pretty similar to what I encountered during the bootup sequence. I guess I have to go find a third flash drive. Sad

ciao!
Logged

mike
Jr. Member
**

Karma: 2
Posts: 55


View Profile
« Reply #5 on: December 02, 2009, 09:31:48 AM »

Hi,

After you execute 'usb start' what happens when you do: 'fatls usb 0:1'?

Do you see the files in that directory?  Specifically, do you see 'u-boot.bin'?


Mike

Logged

alt.ramfree17
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #6 on: December 03, 2009, 08:52:37 AM »

It can't. Sad

Code:
Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x100000, size 0x400000

Reading data from 0x4ff800 -- 100% complete.
 4194304 bytes read: OK
## Booting image at 00800000 ...
Bad Magic Number
Marvell>> usb start
(Re)start USB...
USB:   scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... T T T T 1 Storage Device(s) found
Marvell>> fatls usb 0:1
Device NOT ready
   Request Sense returned 06 28 00
** Can't read from device 0 **

** Unable to use usb 0:1 for fatls **

It may really be time for me to get a new stick. It took me a couple of resets even for the stick to get recognized at the USB start command. Sad

ciao!
Logged

mike
Jr. Member
**

Karma: 2
Posts: 55


View Profile
« Reply #7 on: December 03, 2009, 06:37:39 PM »

Oh well... worth a shot, I guess.

Good luck,
Mike
Logged

alt.ramfree17
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #8 on: December 12, 2009, 01:00:38 AM »

To update the status: the struggle is half-won.

  - using a new stick, i still cannot make the plug boot properly. still the bad magic number error.
  - i tried performing the USB recovery instructions but the plug wont still boot.
  - i tried overwriting the nand again but the bad magic number error still occurs.
  - i tried doing the steps outlined above. same error.
  - in an act of desperation, i performed 1 and 2. now i can boot the plug with the MMC inserted. without the card the plug encounters the magic number error.

Now I just need to make sure to get a good backup of the card contents so if this one fails I can create a new one and put it in. Any suggestion on how to make a MMC->plug memory copy if the root fs is using the MMC?

And I need to figure out if I can make the triple sequence outlined in another thread (USB->MMC->NAND). I am still a bit shaken by the experience of getting the plug to work that I don't know if I am up to doing it this quick. Sad

ciao!
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 443


View Profile WWW
« Reply #9 on: December 12, 2009, 05:09:32 AM »

Any suggestion on how to make a MMC->plug memory copy if the root fs is using the MMC?
You can mount the NAND file ssytems.  First you have to set up the device.  There are instructions for this either in this forum, or on the Wiki.  I do have them at home, but I'm not there at the moment (and can only connect to my Plug from work - not from this coffee shop).  If no-one else comes up with the magic commands I'll try to remember to add them later - so if I forget just remind me....
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #10 on: December 12, 2009, 07:30:23 AM »

Now I just need to make sure to get a good backup of the card contents so if this one fails I can create a new one and put it in. Any suggestion on how to make a MMC->plug memory copy if the root fs is using the MMC?
Do you want to make backup of MMC? Do you have another computer with card reader? if you do then you can make duplication of your MMC content through this second computer. OR if you have to use the plug internal NAND to backup please run
Code:
cat /proc/mtd
and post the resolut, I just want to make sure I know your configuration before I give you instruction on how to make backup.

Quote
And I need to figure out if I can make the triple sequence outlined in another thread (USB->MMC->NAND). I am still a bit shaken by the experience of getting the plug to work that I don't know if I am up to doing it this quick. Sad
Are you talking about boot sequence?
Logged

Good Luck Smiley

birdman
Sr. Member
****

Karma: 4
Posts: 443


View Profile WWW
« Reply #11 on: December 12, 2009, 10:18:37 AM »

If no-one else comes up with the magic commands I'll try to remember to add them later
This entry indicates how to mount filesystems from NAND, so you could then rsync to it.
Logged

alt.ramfree17
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #12 on: December 16, 2009, 07:23:21 PM »

@ccp: the mtd has the following contents:

Code:
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 1fb00000 00020000 "root"

I am already using cp -aP to preserve the attributes for copying the content of the MMC card for safekeeping but I would really like the NAND to function as a fallback in case this card goes kaput. I'll try the post linked by birdman for the meantime.

I already tried the instructions in http://www.plugcomputer.org/plugwiki/index.php/Multi-Boot using the first partition of my Caviar Green HD but all I am getting is that there are empty flash at some address (see below[1] but that is good for another post).

Btw, I love this forum. Experts and users are very responsive. I hope to be able to contribute someday. Smiley


[1] The JFFS option might have something to do with it?
Code:
...snip...
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040800: 0x6909 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040804: 0x03eb instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040808: 0x0076 instead
Further such events for this erase block will not be printed
Old JFFS2 bitmask found at 0x0004590c
You cannot use older JFFS2 filesystems with newer kernels
Empty flash at 0x00045a0c ends at 0x00046000
Empty flash at 0x000463a4 ends at 0x00046800
Empty flash at 0x00046ee0 ends at 0x00047000
Empty flash at 0x00047998 ends at 0x00048000
Empty flash at 0x00048988 ends at 0x00049000
...snip...

ciao!
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #13 on: December 16, 2009, 08:26:44 PM »

@alt.ramfree17 for reply12,

I am rather confuse you situation, it seems to me that you

A. boot from MMC
B. mount rootfs from MMC (second partition?)

And you wish to,

A. backup your kernel on MMC (first partition?) to NAND
B. backup your MMC rootfs to NAND.

So base on th assumption above, I suggest you can,

A. to backup your kernel to NAND do
Code:
Marvell>> reset
Marvell>> mmcinit
Marvell>> fatload mmc 0 0x02000000 /path/to/uImage
Marvell>> fatload mmc 0 0x01100000 /path/to/uInitrd|uInitramfs  #<- Do this step only if you have initrd or initramfs image.
# Now you load your working kernel in RAM, we write it NAND (mtd1:  "uImage")
Marvell>> nand erase clean 0x00100000
Marvell>> nand write.e 0x02000000 0x00100000 0x400000 #<- the 0x400000 is assume you do not have initrd/initramfs.
Marvell>> nand write.e 0x01100000 0x00100000+(you kernel size) initrd size   
                                                      # if you do have initrd/initramfs then need to change the 0x400000 to much smaller number
                                                      # but still big enough to fit in the kernel.
# You kernel now saved in NAND read it back and check
Marvell>> nand read.e 0x08000000 0x00100000 0x400000
Marvell>> cmp.b 0x08000000 0x02000000 0x400000
# you should see "Total of XXX bytes were the same"

B. to back up file system.
Code:
# First boot to linux then login as root

root # [ -e /tmp/a ] || mkdir /tmp/a
root # mount -o bind / /tmp/a
root # [ -e /tmp/b ] || mkdir /tmp/b
root # mount -t jffs2 /dev/mmcblk0p2 /tmp/b
root # tar -C /tmp/a -cf - . | tar -C /tmp/b -xf -
root # umount /tmp/b
root # umount /tmp/a

If you need to more help, please clearly define your question, post the relevant information I see what I can do. (it is very difficult to read the thread from beginning while working on some important project Grin


Good Luck Smiley
Logged

Good Luck Smiley

A_W
Newbie
*

Karma: 1
Posts: 25


View Profile
« Reply #14 on: December 17, 2009, 12:47:15 AM »

Hi,

I'm a bit confused by your description...  Do you have the previously working uImage on your thumb drive?  By the looks of it, you are able to connect to the plug via serial cable (that's where the output came from, I take it)....

So, if the goal is to write the uImage to the NAND and get your plug back up and running, you could do the following:

nand device 0
usb start

1.  Have the correct uboot.bin on the first partition of your USB stick, and write it to NAND

nand erase 0x0 0xa0000
fatload usb 0:1 0x8000000 /u-boot.bin
nand write.e 0x8000000 0x0 0xa0000
reset

OK, so far so good, but now the plug doesn't start. I get no response at all through the serial terminal. The blue LED doesn't light up either.
« Last Edit: December 17, 2009, 12:54:48 AM by A_W » Logged

Pages: [1]
Print
Jump to: