OK as often happens when I start typing this has turned into quite a
long discussion of booting.. hopefuly of interest to others as well.

On Tue, 2008-04-22 at 18:00 +0800, jiqing qiang wrote:
> Hi,
> 
>       What tool did you use to flash the SD card? Is it in raw format
> or it has a file system?

The card has a filesystem, but had enough unused sectors at the start
that I was able to write the UBL (I said RBL before, I lied), and wrote
the magic number in at the start of the MBR without affecting the
partition table.. so I have magic number and partition table in the same
sector. A strange hybrid kind of card. I am not using the filesystem for
the DM355 side of things.

To create this I did something like the following.
On the 355:

        dd if=/dev/mtd0 bs=2048 count=1 skip=64 of=magic.bin

this makes a copy of the magic number, which is at the start of block 1
page 0 (2KB pages * 64 = 1 block)

This contains (od -A x -h magic.bin)

000000 ed00 a1ac 0020 0000 0006 0000 0001 0000
000010 0001 0000 0000 0000 0000 0000 0000 0000
000020 0000 0000 0000 0000 0000 0000 0000 0000
*
000800

Which refering to the datasheet means the UBL is 6 pages = 12KB long and
starts at page 1, block 1 (next page after the magic number). So I copy
that:

        dd if=/dev/mtd0 bs=2048 count=6 skip=65 of=ubl.bin

(note skip has gone up by one page)

I copied these files to my development linux machine and edit the magic
numbers for SD: translate 2KB NAND pages into 512KB SD sectors. magic
ends up as this. Note I have also cut it down to the first 512 bytes.
on my linux machine I have "hd" which I prefer to "od", so:


        $ hd sd-magic.bin 
        00000000  00 ed ac a1 20 00 00 00  18 00 00 00 01 00 00 00
        00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        *
        00000200

I put my SD card in (comes up as /dev/sde), it has a partition table I
don't want to overwrite so I just write the first 16 bytes of the magic
number sector:

        dd if=sd-magic.bin bs=16 count=1 of=/dev/sde

And write the UBL starting at sector 1, the second sector:

         dd if=ubl.bin bs=512 count=24 seek=1 of=/dev/sde

Then put that SD card in the board and it boots - loading u-boot from
NAND :(
Not very helpful.

>       PS. has you configured the switch correctly to boot from SD
> card? Normally if you configure the switch to Boot from the SD, it
> should still try this mode even if it fails.

Yes, I changed the switch and with no card or a normal FAT format card
in, I get the boot LED flashing at 4Hz per the datasheet. When I put my
SD card with the magic number and copied UBL, it boots (UBL loads u-boot
from the NAND).

>      Any help will be very appreciated,
> 

I was just reading about an open-source UBL on the development wiki, but
it went down. I was going to look into that to see if it supported
booting from SD (needs to be able to load u-boot from SD).

My motivation here is trying to build an SD card that can bring up a
board that has a blank NAND in it, or recover from a corrupted NAND as I
will be working on firmware update code etc.

-- 
Jon Povey, Design Engineer
Racelogic Limited

Racelogic is a limited company registered in England. Registered number 
2743719. 
Registered Office 5 Little Balmer, Buckingham Ind Pk, Buckingham MK18 1TF.

The information contained in this electronic mail transmission is intended by 
Racelogic Ltd for the use of the named individual or entity to which it is 
directed and may contain information that is confidential or privileged. If you 
have received this electronic mail transmission in error, please delete it from 
your system without copying or forwarding it, and notify the sender of the 
error by reply email so that the sender's address records can be corrected. The 
views expressed by the sender of this communication do not necessarily 
represent those of Racelogic Ltd. Please note that Racelogic reserves the right 
to monitor e-mail communications passing through its network 

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to