• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Bad Magic Number  (Read 4818 times)
Kenton1
Newbie
*

Karma: 1
Posts: 12


View Profile
« on: January 29, 2010, 06:19:50 AM »

Hi All,
I've attempted to recompile Uimage based on "SheevaPlug Development Kit - Configuring the kernel with LSP for KW_A0_based device-Rev1.2.pdf"
I used:
sudo make ARCH=arm mrproper
sudo make ARCH=arm menuconfig
sudo make -j1 ARCH=arm  CROSS_COMPILE=/home/gcc/bin/arm-none-linux-gnueabi- uImage

and generated an image ok, however it is smaller than the supplied uImage.sheeva.040309.

It FLASHs ok but when boots I get the following:
NAND read: device 0 offset 0x100000, size 0x300000

reading NAND page at offset 0x100000 failed
 3145728 bytes read: ERROR
## Booting image at 00800000 ...
Bad Magic Number


my environment variables are as follows:

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/m
tdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x20
00000;
ethaddr=00:50:43:26:28:14
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
netretry=no
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
ethact=egiga0
bootargs_root=root=/dev/nfs rw
run_diag=no
rootpath=/home/rootfsv1.0
console=console=ttyS0,115200 mtdparts=:0x100000@0x000000(uboot), 0x300000@0x1000
00(uImage),0x1fc00000@0x400000(rootfs)rw
nandEcc=4
ipaddr=192.168.19.137
serverip=192.168.19.135
image_name=uImage.sheeva.280110
bootargs=console=ttyS0, 115200 mtdparts=nand_mtd:0x100000@0x00000(uboot), 0x3000
00@0x100000(uImage)ro, 0x1fC00000@0x400000(rootfs)rw root=/dev/mtdblock2
bootcmd=nand read.e 0x800000 0x100000 0x300000; bootm 0x800000
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: 1340/131068 bytes
Marvell>>


Can anyone suggest how I find where the problem is ?

Thanks.
Logged

fragfutter
Sr. Member
****

Karma: 12
Posts: 280


View Profile
« Reply #1 on: January 29, 2010, 07:08:46 AM »

you can verify if the uImage is valid using

"mkimage -l arch/arm/boot/images/uImage"

and yes you won't necessary get the same image size (brownie points for figuring out why yourself).

To test if the image is working, you can boot into u-boot, load the image using tftpboot and start it (kernel will panic shortly after, but then you already know if it is working).
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #2 on: January 29, 2010, 08:02:42 AM »

Hi Kenton1,

Why change the size from 0x400000 to 0x300000? Do you plan to use initrd/initramfs later?

The message reading NAND page at offset 0x100000 failed is a bad sign. this may be indicate you have some bad blocks in your NAND at that region.

To verify if the uImage you flush to NAND validity you can do at u-boot prompt
Code:
Marvell>> nand read.e 0x800000 0x100000 0x400000
Marvell>> imi 0x800000
The imi ... should report no CRC error otherwise it is possible your flush did not succeed.

If it is possible please post the flashing process, the commands you use and the process output this will help understand the setup.

A note, if you plan to use later version of Linux OS (>2.6.30) , in the bootargs the word nand_mtd need to change to orion_nand or else there may be problem for Linux to read NAND device.
Logged

Good Luck Smiley

Kenton1
Newbie
*

Karma: 1
Posts: 12


View Profile
« Reply #3 on: January 29, 2010, 09:42:35 AM »

Thanks for the replies,
Are the Load addres and entry points ok ?

The mkimage output was:

Image Name:   Linux-2.6.22.18
Created:      Thu Jan 28 11:11:46 2010
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2038076 Bytes = 1990.31 kB = 1.94 MB
Load Address: 0x00008000
Entry Point:  0x00008000


I did a: tftpboot 0x100000 uImage.sheeva.200110  then a: bootm 0x100000  and the uImage booted prompt: root@debian:~#

As far as flashing the image i followed the instructions in rev 1.2 of the "Writing Jaunty Filsystem on the NAND flash" document.
The uImage size is specified here as 0x300000

6. Confirm that the NAND erase and write binaries are included. These should be found in
the ‘usr/sbin’ directory on giving the commands below.
-sh-3.2# find . -name flash_eraseall
-sh-3.2# find . -name nandwrite
7. Erase the partitions on the NAND excluding the U-Boot partition (which is usually mtd0).
In case you erase partition ‘mtd0’, refer to the document ‘SheevaPlug-devkit Board
Bring-up using JTAG-Rev1.2.pdf’, to bring up the SheevaPlug board.
-sh-3.2# flash_eraseall /dev/mtd1
-sh-3.2# flash_eraseall -j /dev/mtd2
8. Write the uImage to the NAND flash using the command below.
-sh-3.2# nandwrite –p /dev/mtd1 uImage.sheeva.040309
9. Write the filesystem jffs2 image onto the NAND flash. Note the number of blocks that are
used by the data. This is the length of the image which will be needed in the boot
arguments (similarly you can choose to utilize the NAND flash space up to 506 MB by
writing the hex value of the flash space) while editing the bootargs command in U-Boot.
-sh-3.2# nandwrite –p /dev/mtd2 ubuntu-9.0.5.Release.jffs2
10. Create a mount directory, if none, and mount the jffs2 image on the NAND flash
mtdblock2.
-sh-3.2# mkdir mnt1
-sh-3.2#
-sh-3.2# mount -t jffs2 /dev/mtdblock2 /mnt1
11. Restart the system and enter the U-Boot prompt by stopping the autoboot.
12. At the U-Boot prompt, change the following parameters.
a. Marvell>> setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:
0x100000@0x00000(uboot),
0x300000@0x100000(uImage)ro,0x1fC00000@0x400000(rootfs)rw
root=/dev/mtdblock2'
b. Marvell>> saveenv
c. Marvell>> setenv bootcmd 'nand read.e 0x800000 0x100000 0x300000; bootm
0x800000'
d. Marvell>> saveenv
13. Reboot the system and the system should boot from NAND flash.


Thanks again
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #4 on: January 29, 2010, 10:12:02 AM »

I am not familiar with that document, I suspect there may be some error in the document that cause your problem.

I recommend you flush kernel use u-boot since you have tftp setup. here is how
Code:
Marvell>> tftp 0x02000000 uImage.sheeva.200110
Marvell>> imi 0x02000000 #<- this will verify tftp did load uImage connectly.
Marvell>> nand erase clean 0x100000 0x400000
Marvell>> nand write.e 0x02000000 0x100000 0x400000
After this you can reset to boot.

Another note, your bootargs have one mistake, the console=ttyS0, 115200 between ttyS0 and 115200 should not have a space, it need to be link like this console=ttyS0,115200.

Good luck Smiley
Logged

Good Luck Smiley

fragfutter
Sr. Member
****

Karma: 12
Posts: 280


View Profile
« Reply #5 on: January 29, 2010, 03:10:22 PM »

Load Address and Entry Point are correct for the sheevaplug and the kernel is obviously working. Try to flash it from u-boot.
Logged

Kenton1
Newbie
*

Karma: 1
Posts: 12


View Profile
« Reply #6 on: February 01, 2010, 08:28:00 AM »

Hi,
Thanks for the help.
With the manual tftp load and nand write I have manged to boot from FLASH to root@debian:~#.
I'm not sure why the -sh-3.2# nandwrite doesn't work though.
As linux boots up there are a number of errors, I have attached the output. Please could someone take a look and let me know which ones I should be concerned about.

Thanks,

* ubuntu_boot_flash.txt (13.56 KB - downloaded 221 times.)
Logged

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #7 on: February 01, 2010, 08:54:42 AM »

In the kernel MTD check it report bad block in 0x60000, this is very bad sign! You may want to return this plug for a replacement.

It looks like you rebuild your kernel from source code? if its true then I recommend you move on to more current kernel. There are some errors about MMC/SD card they are relate to the older kernel.

Also the kernel parameter mtdparts was setup with space after comma, there should not be any space in any of kernel parameter like "key=A,B,C".

Good luck Smiley
Logged

Good Luck Smiley

Pages: [1]
Print
Jump to: