Tiny6410 w/o NAND in arcade machine

Ryan
Hi everyone.  My boss has just handed me a device driven by a Tiny6410
without the NAND flash onboard.  IT is hooked to an arcade JAMMA board and
is used as the core of a device called a 138-in-1.

I was handed this because I'm the only fellow here with any *nix
experience.  In looking at the contents of the SD card, I see the boot
image on the FAT partition, and there are two linux partitions.  Is there a
VM or something that I can use with the linux on this card to observe the
boot process?  We don't have any sort of arcade machine here and I tried a
VGA to DVI adapter but it didn't work.

davef
Usually you hook up a RS232 cable (think for the 6410 a null modem cable)
and run minicom on your desktop to observe the boot process.

Good luck

Ryan
I wish it was that simple.  I don't see a port.

Ryan
I can post pics if needed.

davef
Ah, Tiny6410 not mini6410!  You will have to dig into the schematic and
wire up your own DB9 connector for RS232.

Ryan
What about what's on the larger board?  There are a series of ports on
there.

What I'd like to know is why the unit reboots with any other SD card than
what it came with.

davef
> What about what's on the larger board?  There are a series of ports on
> there.

On the mini6410?  I haven't had a close look at that unit, but the mini2440
has one RS232 DB9 connector plus 3 small connectors that have TTL level
signals.  So, one is physically compliant with RS-232 and the other 3 need
TTL to RS232 level converter chips on them or RS485 if you want.

> What I'd like to know is why the unit reboots with any other SD card than
> what it came with. 

There are a number of issues with different types of SD cards and how they
are formatted.  You'll have to search on this forum for solutions.

Good luck!

Ryan
I can post a picture of the larger board.  It appears to be a keyboard
matrix, CGA converter, and sound board in one.

davef
Ah, the larger board is something special ... so I haven't a clue what is
on it.

Still, the tiny6410 should have the USART connections come out to a header
that you could hook up a TTL to RS232 level converter to.

Can JTAG be used to monitor the boot process?  Never used it for anything
other than re-loading the bootloader on the mini2440.

There must be some easy way as I can imagine anyone being able to develop a
Linux system without looking at the boot messages.

There is another way ... you can pipe the boot messages to a file IF you
have some way of reading the file.  SD card? USB flashdrive?

Ryan
Yes, it could write to the SD card couldn't it?

What is strange is that when I diddle around with some of the files it just
goes into a reboot loop.

Juergen Beisert
The S3C6410 CPU comes with an internal ROM (called "iROM") which expects
some kind of board setup software at specific sectors on the SD card. And
these specific sectors depends on the SD card type. They differ if you are
using an SDSC or SDHC/SDXC card. So, every card needs a special treatment
to make it bootable with the S3C6410 iROM.

Ryan
How do I give it this treatment?

Reggie
Ryan, is there any chance you can upload the sd-card image somewhere?

Ryan
Yes.  I'll upload it tonight.

Juergen Beisert
There is a tool to "flash" an SD card in a correct manner. Refer the
download side here.

Ryan
See if this works for you:

http://www.adrive.com/

u> weedsmacker@hotmail.com
p> Arcade11

Ryan Fernandez
I thought that I had done that but I think I might have been wrong.  Which
file is it?

Ryan Fernandez
Did you have a look Reggie?

Juergen Beisert
This one: http://www.friendlyarm.net/dl.php?file=sd-flasher.zip

Reggie
Ryan, I've not had a chance to have a look at it yet, maybe this afternoon.

Ryan Fernandez
Take your time, I'm a patient guy.  As for the larger board here is what it
has:

Sound converter(also to unamplified/amplified sound for the speaker.
VGA/CGA video output
SD reader
USB port
Some sort of KBD Matrix(I think it's an IPAC clone)

What do I do once I prep the SD card with that util anyway?  Sorry, this
isn't my forte.

Reggie
Ryan, you can examine your image using the 'file' command in linux:
file mmc.img

Which should return this:
/mmc.img: x86 boot sector; partition 1: ID=0x6, starthead 1, startsector
35, 199465 sectors; partition 2: ID=0x83, starthead 0, startsector 199500,
588000 sectors; partition 3: ID=0x83, starthead 0, startsector 787500,
686000 sectors, code offset 0x0

armed with that information you can mount the partitions and examine them
on your PC (if you're using linux of course).

If you examine the returned data, you will notice that there are 3
partitions listed, to mount those partitions, you're going to need to know
the startsector of each partition and then multiply it by 512, that will
allow you to tell the mount command what offset it needs to use to find the
start of the partition.

so for each partition, the offset would be:
1) 35x512, offset=offset=17920
2) 199500x512, offset=102144000
3) 787500x512, offset=403200000

you will also need to know the fs type for each partition, the first is
vfat, 2nd is ext3, 3rd I am also assuming is ext3 (I haven't mounted it
yet).

to mount a partition, lets say the 2nd partition, you would do the
following:
sudo mount -oloop,rw,offset=102144000 -text3 /path/to/mmc.img
/path/to/mountdir

you should then be able to examine the contents of the partition but more
importantly you can copy those files onto your SD card once you've
recreated a similar partition structure using gparted or your favourite
partitioning tool.  It basically needs to avoid the first 35 sectors of the
sd card and have a vfat, ext3 and ext3 partition in that order.

armed with that information you should be able to recreate a partition
structure on the new SD card that matches whatever it needs to boot.

please bear in mind that these are rough instructions and in no way
constitute a working method :)

Now I come to think of it, as you have the original SD card, you can just
mount that and copy them (as root) to your new SD card with the above
partition layout (vfat,ext3,ext3).  If you don't copy it as root you'll
probably fail to copy any device nodes across and it will fail to boot.

Reggie
sudo mount -oloop,rw,offset=102144000 -text3 /path/to/mmc.img
/path/to/mountdir

should be one single command and obviously you should change /path/to/ in
each case to the path to mmc.img file and your folder that you're going to
use as a mountpoint.

Reggie
meh, I should think more before I hit enter!!

I would also probably work on the .img file myself, just in case anything
goes wrong.

Lastly, when you created the image, it appears that your 2nd partition was
in need of fsck, it wouldn't let me mount it initally as I had set it to
mount read-only and of course linux doesn't like mounting a dirty
partition.

Ryan Fernandez
Reggie:

Thanks for your help.  I really appreciate it.  Here's another dilemma:

When I try to modify the executable or the games listing, the system
reboots.  I loked and the "launcher" that runs is checking a file called
SD.bin that is stored on the second partition.  If there was a way to stop
this it'd be amazing.

I'll try recreating the card this weekend or tonight.  I really appreciate
your help.

Reggie
You're most welcome Ryan :)

I'm not sure how much more I can help, I don't have a 6410 to test anything
unfortunately.

Is there a flash chip on either of the boards at all?  I noticed there was
a file called serial.bin, if that's checking for a valid serial number,
it's got to grab it from somewhere and if there isn't any nand on there
then it's really got to be on a small flash/nor chip, my guess as these
things are meant to be as cheap as possible that it will be a little 8pin
spi flash chip, microchip or atmel probably.

Ryan Fernandez
Reggie:

I don't think so....maybe there is maybe there isn't.  I don't see one.  I
think ultimately they would be cranking these out as fast as they could. 
You can see online pictures.  I can look tonight.  It's looking at 3
different .bin files I think, games.bin, sn.bin, and runset.bin.  Games.bin
is being checked by the launcher.  If the games list is changed, the system
just reboots.  If there was a way to figure out the format of that file
then the problem would be moot.

Ryan Fernandez
Anything?

Ryan Fernandez
Oh, in inspecting the board, I see a single chip that is 8 pin at U17 but
it's "naked" no markings.

Ryan Fernandez
Oh, did I mention there was a USB port on this gem?

Ryan Fernandez
Anything Reggie?

Ryan Fernandez
Ordering the latest iteration of this board now...

Ryan Fernandez
Ok, I tried copying the partitions over to another SD.  No luck.  I just
get a black screen.

Ryan Fernandez
Ok..figured this out.  Ther protection is all done through a series of
proprietary executables.  Now it's just a matter of replacing them.

Ryan Fernandez
@Jurgen, I'm completely blank on this.  I have the tool but what do I take
from the other card to get it to work here?  Sorry, I'm completely new to
this stuff.

Juergen Beisert
I think you can't get the old content back from the other card. With the
"flashing" tool you prepare a new SD card to be able to boot a S3C64XX
based board. Maybe the remaining space of the other SD card contains a
filesystem where you can copy its content to the new SD card?

Ryan Fernandez
Ok well, it looks as though they have two different programs that
checkthings, IE the serial.bin, and another file.  If those can be replaced
then I'd be happy. However, what I am faced with now is duplicating the
card and making it boot.  So far I have had no luck with a second card no
matter what I do.  What do I need to do/flash in order to get this other
card going?

Juergen Beisert
You can copy this card only for the case they are exactly the same. If they
differ, you can't copy them sector by sector, as the processor's internal
ROM loads the bootloader from the card depending on the sector count of the
card.
You only can copy the regular filesystem content and then make the new card
bootable with the SD Card flashing tool.

Ryan Fernandez
@Juergen

Is there a tutorial on how to do that?  I read the page but did not have a
lot of luck.  This is the first time that I've ever used one of the
FriendlyARM boards.

Juergen Beisert
You should start with the mentioned small Windows tool to "flash" the new
SD card. And see if your boards accept it (e.g. is able to boot from). Then
you should read something about "partition tables" and do something on the
new card similar to the old card you have.

Ryan Fernandez
@Juergen

What do you mean?  I don't have a cd or anything with this...it's just the
bare board.  Is there an image I need to flash that I can DL?

Reggie
how did you make the copy of the sd card?  it looks like it was a dd of the
whole device (rather than just partitions) if that's the case, then you
should be able to just dd that image to a card that is the same size or
bigger.

Ryan Fernandez
I tried that and it didn't work.  Used a different 2gb card.

Ryan Fernandez
Oh, I tried looking at the code and it seems that the only stuff that will
pop out on the screen is text going through tty6.  Is there a way to get a
prompt on tty6 as well?