PDA

View Full Version : Flash ROM using SPL commands


jockyw2001
16th September 2007, 10:45 AM
In the Excalibur forum we are struggling to flash a file to a particular offset in NAND (http://forum.xda-developers.com/showpost.php?p=1514467&postcount=347) (samsung onedisk flash). The file is 4Mbyte and was dumped with bkondisk (by itsme). Deploying pof's ideas, I have patched Excalibur SPL which bypasses vendor/model and signature checking and raises security level to 0 (http://forum.xda-developers.com/showthread.php?t=329605). Using this SPL the flash commands can be used w/o restrictions :D
A similar patched bootloader exists for Vox S710 (http://forum.xda-developers.com/showpost.php?p=1456194&postcount=44). That SPL includes same commands as the Excalibur SPL.

The SPL offers 2 commands to interactively flash files from MTTY: ls ("load signed"??) and lnbs ("load new binary signed"??)
Afaik the commands are invoked as:
lnbs [pathname [StartAddr [Length [SkipOffset ["cp"]]]]]
ls [pathname [StartAddr [Length [SkipOffset ["cp"]]]]]

The question is what format the files must have and how to figure out start address. I found some info in the Hermes Wiki (http://wiki.xda-developers.com/index.php?pagename=Hermes_BootloaderMFG). I also suggested Excalibur various tests:
1. The file test3.nbs in this case has a 0x20 byte header ("R000FF") which includes data blocksize and signature size and flag. But somehow it doesn't like the start address of which I also don't know how to figure it out for the various ROM parts. How was that done for Hermes? (reversing SPL or sniffing USB)
Cmd>lnbs test3.nbs 500a0000
clean up the image temp buffer at 0x8C080000 Length 0x03900000
MTTYDownloadImage "test3.nbs"
:F=test3.nbs
start download
S
HAddress A0000000h Length 0040034Dh
Start Address out of boundary
checking image header

2. The file test.nb w/o any header, just the 4MB binary file with no modifications
Cmd>ls test.nb 500a0000
clean up the image temp buffer at 0x8C080000 Length 0x03900000
MTTYDownloadImage "test.nb"
:F=test.nb
start download
S
HAddress A0000000h Length 00400000h
Start Address out of boundary
checking image header

3. The file test2.nbh with a full .nbh header and given type 0x300 (GSM Radio code, although the 4MB file also includes config and simlock data etc.). This was actually the most succesful since it passed mosts tests in the SPL. So it seems a valid file, but it couldn't be confirmed that anything was flashed at all.
Cmd>lnbs test2.nbh 500a0000
clean up the image temp buffer at 0x8C080000 Length 0x03900000
MTTYDownloadImage "test2.nbh"
:F=test2.nbh
start download
S
HAddress 00000000h Length 0040054Dh
Start Address out of boundary
checking image headerFirst MTTY record empty
Image Download Finish... please check your image
Please reset the device to restart the program!!
DownloadImage success.

Can anyone with more knowledge about this subject please drop some feedback? Thx!

Cheers
JockyW

Edit: I totally forgot about the wdata command which is used by the official RUU. It can not be used interactive from MTTY, but it is possible to use it from self written programs. I think the idea is that only signed .nbh files (which include ROM type information in the header) can use be flashed using this command:
wdata length checksum
Once all data and the last signature (flag == 2) has been sent to SDRAM and all CRC and sig checks are passed the flashing process starts. The funny thing is that the help text of wdata suggests that also unsigned data can be flashed or be dropped at any memory location. Is this intentional deceiving by HTC ??
Cmd>wdata
Usage:

wdata [StartAddr Len]
Write data to memory(if write to ROM, need erase first).

StartAddr : Start address of memory.

Len : How many bytes will be written.

Length must not more than 0x10000 bytes(buffer limitation).

Write to RAM: 4 bytes(CRC checksum limitation).

1 byte(in user mode).

Write to ROM: 4 bytes(CRC checksum limitation).

2(16-bit)/4(32-bit) bytes(in user mode).

Write to ROM(16-bit data bus): 32 bytes(writebuffer mode).

Write to ROM(32-bit data bus): 64 bytes(writebuffer mode).

Length must be 4 bytes boundary(CRC checksum) if not in user mode.



After command execute, then send out the data to terminal.

Data format: HTCS(4 bytes)+DATA+checksum(4 bytes, if not in user mode)+HTCE(4 bytes).

seu2002
16th September 2007, 11:09 AM
while flashing test2.nbh, wlan data doesn't be modified.

jockyw2001's question is very important to find our wi-fi back. plz help us!Thanks!

details about our problem and what we have done can be seen at http://forum.xda-developers.com/showthread.php?t=328690

arc
16th September 2007, 11:45 AM
jockyw2001
You may use method imei-check - they for flash of the area CID have changed address of the flash splash screen - hereinafter they form file nbh (consists only of splash screen) with necessary area CID.

jockyw2001
16th September 2007, 11:47 AM
jockyw2001
You may use method imei-check - they for flash of the area CID have changed address of the flash splash screen - hereinafter they form file nbh (consists only of splash screen) with necessary area CID.
Ah great! You've got a link as well? Thx!

hdubli
17th September 2007, 05:50 AM
Hi jocky,
interesting thing..
why don;t u try its utils for the above and check..
issue pdcocread -l command and get the header and rom address.
then try with lnbs or ls command to flash back.From whatever I know, lnb and lnbs/ls command can b used when yr device is Super CID.
While flahing ROM, RUU issues set le 1 command and write the ROM using wdata command.You can check these things, with USB monitor :)

arc
17th September 2007, 07:47 AM
hdubli

The commands lnb and lnbs different -
lnb - load the unsigned code.
lnbs- load signed code -have other structure and headline

jockyw2001
17th September 2007, 12:59 PM
issue pdcocread -l command and get the header and rom address.
then try with lnbs or ls command to flash back.From whatever I know, lnb and lnbs/ls command can b used when yr device is Super CID.

hi,
pdocread -l returns:
>pdocread.exe -l
58.82M (0x3ad1000) DSK1:
| 2.09M (0x217400) Part00
| 3.20M (0x333000) Part01
| 53.53M (0x3586800) Part02
59.31M (0x3b4f000) DSK2:
| 59.06M (0x3b0e800) Part00
...You mean the values in parantheses?

On excalibur only signed data is accepted by ls or lnbs (dunno the difference between the two. Anyone?).

I disassembled spl and found the startaddress boundary check routine. In it I see the hardcoded nand address boundaries which have no resemblance whatsoever with pdocread.

I'm now checking arc's hint to patch splash screen flashroutine in same way as imei-check does it. I just hope I can use ls and lnbs (with USPL of course), since that would be far more comfortable :D