I think PB is using TFTP to load the device? anyone tried to load image
using a tftp client?

Re: downloading image without PB? by Oliver

Oliver
Mon May 30 02:35:05 CDT 2005

Hi mobilevil,

one of my colleagues did this some time ago. As far as i remember you have
to listen for a BOOTME Broadcast Packet. When you receive this one you got
all informations you need to built up a tftp connection (CE Device Ip
Address, Destination Port, etc.).

The fastes way to get into this is to record a PB download with Ethereal and
check how this works. To read the BOOTME Packet you should check out this
one:
http://msdn.microsoft.com/library/en-us/wceoem/html/_wcepb_EDBG_BOOTME_DATA.asp
and if you wanna know how TFTP works this one:
ftp://ftp.rfc-editor.org/in-notes/std/std33.txt
If you try a little search i'm sure you'll find some source code with
working tftp (at least there must be one in the bootloader source code of
WinCE).

Best regards,
Oliver Münchlw

"mobilevil" <mobilevil@mobile.com> schrieb im Newsbeitrag
news:uFJoXQOZFHA.164@TK2MSFTNGP12.phx.gbl...
>I think PB is using TFTP to load the device? anyone tried to load image
>using a tftp client?
>
>



Re: downloading image without PB? by K

K
Mon May 30 02:47:50 CDT 2005

Surely, it is indeed using tftp protocol but using some other port number
rather the defualt one.
You may also refer the following link
http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/msg/4126be0396697de5
or
http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/780fce36830527fc/1a552c61cbff5cf0

"mobilevil" <mobilevil@mobile.com> ¼¶¼g©ó¶l¥ó·s»D:uFJoXQOZFHA.164@TK2MSFTNGP12.phx.gbl...
>I think PB is using TFTP to load the device? anyone tried to load image
>using a tftp client?
>
>



Re: downloading image without PB? by mobilevil

mobilevil
Mon May 30 03:13:23 CDT 2005

but i thought PB is not really sending the nk.bin, but a generated on the
fly file?
seems the generated file contain information on storage address and booting
address also? and it is dividing files into 32M parts?
anyway I go test with tftp.exe now

"K. S. Huang" <ksh_AT_bsquare_DOT_com> wrote in message
news:uHJA3uOZFHA.1368@tk2msftngp13.phx.gbl...
> Surely, it is indeed using tftp protocol but using some other port number
> rather the defualt one.
> You may also refer the following link
> http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/msg/4126be0396697de5
> or
> http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/780fce36830527fc/1a552c61cbff5cf0
>
> "mobilevil" <mobilevil@mobile.com> ¼¶¼g©ó¶l¥ó·s»D:uFJoXQOZFHA.164@TK2MSFTNGP12.phx.gbl...
>>I think PB is using TFTP to load the device? anyone tried to load image
>>using a tftp client?
>>
>>
>
>



Re: downloading image without PB? by Henrik

Henrik
Mon May 30 04:16:26 CDT 2005

NK.bin contains all the information needed to launch the os. A couple
of things to note:
1=2EEboot actually implements a tftp server, so you'd want to run a tftp
client.
2 Eboot waits for a "PUT" of "boot.bin" so you'd have to rename
"nk.bin" to "boot.bin"
3 Eboot listens on port 980 which is not the default TFTP port. Set the
client to use port 980 before downloading (which i beleave you cannot
do with tftp.exe)
4 After the image has been loaded, eboot waits for a "jump" command
from PB to launch the image so you'd have to modify this behaviour _if_
you want the image to automatically launch after the tftp-download.

Henrik

mobilevil wrote:
> but i thought PB is not really sending the nk.bin, but a generated on the
> fly file?
> seems the generated file contain information on storage address and booti=
ng
> address also? and it is dividing files into 32M parts?
> anyway I go test with tftp.exe now
>
> "K. S. Huang" <ksh_AT_bsquare_DOT_com> wrote in message
> news:uHJA3uOZFHA.1368@tk2msftngp13.phx.gbl...
> > Surely, it is indeed using tftp protocol but using some other port numb=
er
> > rather the defualt one.
> > You may also refer the following link
> > http://groups-beta.google.com/group/microsoft.public.windowsce.platbuil=
der/msg/4126be0396697de5
> > or
> > http://groups-beta.google.com/group/microsoft.public.windowsce.platbuil=
der/browse_thread/thread/780fce36830527fc/1a552c61cbff5cf0
> >
> > "mobilevil" <mobilevil@mobile.com> =BC=B6=BCg=A9=F3=B6l=A5=F3=B7s=BBD:u=
FJoXQOZFHA.164@TK2MSFTNGP12.phx.gbl...
> >>I think PB is using TFTP to load the device? anyone tried to load image
> >>using a tftp client?
> >>
> >>
> >
> >


Re: downloading image without PB? by mobilevil

mobilevil
Mon May 30 04:29:30 CDT 2005

ok... hay I've finished the rndis image download, thanks again for you great
help
and the speed is fine, i get 270-300KB/sec.
and I'm making my own tftp client software, file transfer is done and I'm
waiting for a pb compile which contain my debug msg in eboot's edbg command
handler, for me to copy the needed values....
it's a good idea to avoid dry run trace error, and the most important is you
have an excuse to take a break :D

"Henrik Viklund" <slaskhenrik@gmail.com> wrote in message
news:1117444586.759946.120370@g44g2000cwa.googlegroups.com...
NK.bin contains all the information needed to launch the os. A couple
of things to note:
1.Eboot actually implements a tftp server, so you'd want to run a tftp
client.
2 Eboot waits for a "PUT" of "boot.bin" so you'd have to rename
"nk.bin" to "boot.bin"
3 Eboot listens on port 980 which is not the default TFTP port. Set the
client to use port 980 before downloading (which i beleave you cannot
do with tftp.exe)
4 After the image has been loaded, eboot waits for a "jump" command
from PB to launch the image so you'd have to modify this behaviour _if_
you want the image to automatically launch after the tftp-download.

Henrik

mobilevil wrote:
> but i thought PB is not really sending the nk.bin, but a generated on the
> fly file?
> seems the generated file contain information on storage address and
> booting
> address also? and it is dividing files into 32M parts?
> anyway I go test with tftp.exe now
>
> "K. S. Huang" <ksh_AT_bsquare_DOT_com> wrote in message
> news:uHJA3uOZFHA.1368@tk2msftngp13.phx.gbl...
> > Surely, it is indeed using tftp protocol but using some other port
> > number
> > rather the defualt one.
> > You may also refer the following link
> > http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/msg/4126be0396697de5
> > or
> > http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/780fce36830527fc/1a552c61cbff5cf0
> >
> > "mobilevil" <mobilevil@mobile.com>
> > ¼¶¼g©ó¶l¥ó·s»D:uFJoXQOZFHA.164@TK2MSFTNGP12.phx.gbl...
> >>I think PB is using TFTP to load the device? anyone tried to load image
> >>using a tftp client?
> >>
> >>
> >
> >



Re: downloading image without PB? by Wang

Wang
Wed Jun 01 01:46:52 CDT 2005

Hi,Huang,
I have done as you said,and I succeeded when eboot as tftp server,because it
is very simple.

I failed when I used eboot as client.
Eboot can send tftp request to host,but host failed to response.I am sure
host tftp server is right.Because I can get file through windows tftp
client.
I don't know why.
I change EbootSendBootmeAndWaitForTftp as the following:
BOOL EbootSendBootmeAndWaitForTftp (EDBG_ADDR *pEdbgAddr, UCHAR
VersionMajor, UCHAR VersionMinor,
char *szPlatformString, char *szDeviceName,
UCHAR CPUId, DWORD dwBootFlags)
{
DWORD dwCurSec = OEMEthGetSecs () - BOOTME_INTERVAL;
USHORT wLen, wDestPort, wSrcPort, wUDPDataLen, *pwUDPData;
int nRetries = 0;
UINT16 fTftpLinked = 0;

EdbgOutputDebugString ("+EbootSendBootmeAndWaitForTftp\r\n");
while (!fTftpLinked) {
if ((nRetries < MAX_BOOTME_CNT) && (OEMEthGetSecs () - dwCurSec >=
BOOTME_INTERVAL)) {
nRetries ++;
dwCurSec += BOOTME_INTERVAL;
// send a bootme message
EbootSendBootme (pEdbgAddr, VersionMajor, VersionMinor,
szPlatformString, szDeviceName, CPUId, dwBootFlags);
}
// get another frame and pass it to TFTP handler
wLen = sizeof (gFrameBuffer);
/* if (OEMEthGetFrame (gFrameBuffer, &wLen)) { // frame
available?
switch (FRAMETYPE (gFrameBuffer)) {
case 0x0800: // IP packet
if (!EbootCheckUDP(pEdbgAddr, gFrameBuffer, &wDestPort,
&wSrcPort, &pwUDPData, &wUDPDataLen)) { // UDP?
// EDBG command? (should only occur if eshell asked us
to jump to existing image)
if (!EbootProcessEDBG (pEdbgAddr, &gHostAddr,
gFrameBuffer, pwUDPData, wUDPDataLen, &fTftpLinked, &gpCfgData)) {
// no, pass it to TFTP
EbootTFtpReceiver (pEdbgAddr, gFrameBuffer,
wDestPort, wSrcPort, pwUDPData, wUDPDataLen);
}
}
break;
case 0x0806: // ARP packet
if (EbootProcessARP (pEdbgAddr, gFrameBuffer) ==
PROCESS_ARP_RESPONSE) {
EdbgOutputDebugString( "Some other station has IP
Address: %s !!! Aborting.\r\n", inet_ntoa(pEdbgAddr->dwIP));
return FALSE;
}
break;
default:
break;
}
}*/ /////I delete all these lines,because it servers as tftp
server,when as a client,it only need to send a connection request.
EbootTFtpReceiver (pEdbgAddr, gFrameBuffer, wDestPort, wSrcPort,
pwUDPData, wUDPDataLen, &fTftpLinked);
}

EdbgOutputDebugString ("-EbootSendBootmeAndWaitForTftp\r\n");
return TRUE;
}



And change EbootTFtpReceiver as following:

WORD EbootTFtpReceiver( EDBG_ADDR *pMyAddr, BYTE *pFrameBuffer, UINT16
wDestPort, UINT16 wSrcPort, UINT16 *pwUDPData, UINT16 cwUDPDataLength,
UINT16 *fTftpLinked ) {

int i;
UINT16 iLinkSlot = MAX_TFTP_LINKS;

EDBG_ADDR HostAddr;
HostAddr.wMAC[0] = 0x4000;
HostAddr.wMAC[1] = 0x51B8;
HostAddr.wMAC[2] = 0xE5A7;
HostAddr.dwIP = 0x03BEA8C0; //192.168.190.3
HostAddr.wPort = 0x45; //69

/*char szFileName[10];
strcpy(pszFileName, "nk.bin");*/

// Check to see if this is for a link that is currently in use
for( i = 0; i < MAX_TFTP_LINKS; i++ ) {
// Here I don't compare the destination (Odo) port, only the source (host)
because
// this could be a repeat open packet, which we don't want to cause a
second link.
// This could happen if a second open packet comes because we will have
changed the
// destination port with the acknowledge.
if (TFtpLinks[i].State != TFTP_STATE_IDLE && wSrcPort ==
TFtpLinks[i].DestAddr.wPort
&& wDestPort == TFtpLinks[i].SrcAddr.wPort) {
iLinkSlot = i;
break;
}
else if (TFtpLinks[i].State == TFTP_STATE_IDLE)
iLinkSlot = i;
}

// If we broke out of the loop early, then the packet is for a link that is
already open
if (i < MAX_TFTP_LINKS) {
// iLinkSlot is the index of the link this packet belongs too
TFtpStateMachine( wSrcPort, iLinkSlot, pwUDPData, cwUDPDataLength );
}
// Check to see if someone is trying to start a new connection,
// If so, guarantee that there are always TFTP_TX_LINKS link(s) available
to transmit information
else //if (wDestPort == wOdoWellKnownServerPort && MAX_TFTP_LINKS -
nNumTFtpLinksInUse > TFTP_TX_LINKS)
{

// iLinkSlot is the index of a link that is in the IDLE state, giving the
number of a free link
// slot that can be used, the wDestTID and the TFTP Message
//TFtpdFormNewLink( pMyAddr, pFrameBuffer, iLinkSlot, pwUDPData );
TFtpOpen(&HostAddr, pMyAddr, "nk.bin", H2OLink, fTftpLinked);
return 1;
}
/*else {

for( i = 0; i < MAX_TFTP_LINKS; i++ ) {
EdbgOutputDebugString("TFTP link[%u]: State:%u, DestAddr.wPort:
%u, SrcAddr.wPort: %u\n",
i,TFtpLinks[i].State,
ntohs(TFtpLinks[i].DestAddr.wPort),
ntohs(TFtpLinks[i].SrcAddr.wPort));
}
EdbgOutputDebugString("TftpReceiver, port: 0x%X, wkp:
0x%X\n\r",wDestPort,wOdoWellKnownServerPort);
}*/

return 0;

} // TFtpReceiver()



Change TFtpOpen as following:

UINT16 TFtpOpen( EDBG_ADDR *pHostAddr, EDBG_ADDR *pMyAddr, char
*pszFileName, TFtpLinkDir DataDir, UINT16 *fTftpLinked ) {

int i, iLinkSlot = (MAX_TFTP_LINKS - 1);

if (nNumTFtpLinksInUse >= MAX_TFTP_LINKS)
return 0;

if ((strlen(pszFileName) + 1) > MAX_TFTP_FILENAME) return 0;

// Find a link that isn't currently in use
for( i = 0; i < MAX_TFTP_LINKS; i++ ) {
if (TFtpLinks[i].State == TFTP_STATE_IDLE) {
iLinkSlot = i;
break;
}
}

EdbgOutputDebugString( "Begin TFtpOpen function\r\n");
TFtpLinks[iLinkSlot].DataDir = DataDir;
TFtpLinks[iLinkSlot].State = (DataDir == H2OLink) ? TFTP_STATE_XFER_WAIT :
TFTP_STATE_OPEN;
TFtpLinks[iLinkSlot].pfCallBack = NULL;
strcpy( TFtpLinks[iLinkSlot].szFileName, pszFileName );
TFtpLinks[iLinkSlot].wBlockNumber = 0;

// Put in Read Request or Write Request as appropriate
*((UINT16*)(TFtpLinks[iLinkSlot].Buffer)) = htons((DataDir == H2OLink) ? 1
: 2);
TFtpLinks[iLinkSlot].cwMsgLen = 2;
// Put in the file name
strcpy( TFtpLinks[iLinkSlot].Buffer + 2, pszFileName );
TFtpLinks[iLinkSlot].cwMsgLen += strlen( pszFileName ) +1; // A bug.File
should end with '\0'.WangYQ@Jun.1.2005
// Specify octet (binary) mode
strcpy( TFtpLinks[iLinkSlot].Buffer + TFtpLinks[iLinkSlot].cwMsgLen,
"octet" );
TFtpLinks[iLinkSlot].cwMsgLen += 6;

// Send the read/write request packet back to the host
TFtpLinks[iLinkSlot].DestAddr = *pHostAddr;
TFtpLinks[iLinkSlot].DestAddr.wPort = wHostWellKnownServerPort;
TFtpLinks[iLinkSlot].SrcAddr = *pMyAddr;
TFtpLinks[iLinkSlot].SrcAddr.wPort = GenerateSrcPort();
EbootSendUDP(TFTPFrameBuffer, &(TFtpLinks[iLinkSlot].DestAddr),
&(TFtpLinks[iLinkSlot].SrcAddr),
TFtpLinks[iLinkSlot].Buffer,
TFtpLinks[iLinkSlot].cwMsgLen );
TFtpLinks[iLinkSlot].tLastTransmit = OEMEthGetSecs();
TFtpLinks[iLinkSlot].cwRetries = 0;

*fTftpLinked = 1;

return iLinkSlot+1;

}

Is all these changes right?

Thanks.
"K. S. Huang" <ksh_AT_bsquare_DOT_com> дÈëÏûÏ¢ÐÂÎÅ:uHJA3uOZFHA.1368@tk2msftngp13.phx.gbl...
> Surely, it is indeed using tftp protocol but using some other port number
> rather the defualt one.
> You may also refer the following link
> http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/msg/4126be0396697de5
> or
> http://groups-beta.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/780fce36830527fc/1a552c61cbff5cf0
>
> "mobilevil" <mobilevil@mobile.com> ¼¶¼g©ó¶l¥ó·s»D:uFJoXQOZFHA.164@TK2MSFTNGP12.phx.gbl...
>>I think PB is using TFTP to load the device? anyone tried to load image
>>using a tftp client?
>>
>>
>
>



Re: downloading image without PB? by Wang

Wang
Wed Jun 01 08:40:58 CDT 2005

Thank you,Huang,
Now eboot as client can communicate with tftp server.But it always
encounters errors when transporting about 30 tftp packets.
After transporting about 30 tftp packets successfully,eboot can not send ACK
packet,Host will report "Time out occured" after trying sending DATA packets
several times.
Is my tftp server not working properly? But I have tested with Windows tftp
client and works ok. And this time it is Eboot that can not send ACK signal.
I don't know why.Can you give me some suggestions?

Thanks very much.

BTW:I get tftp server from this website(http://www.WinAgents.com). And I
sniffer network through Iris Network Traffic Analyzer.


"K. S. Huang" <ksh_AT_bsquare_DOT_com> дÈëÏûÏ¢ÐÂÎÅ:O2$DZToZFHA.2916@TK2MSFTNGP14.phx.gbl...
> The attachment is the modified version of EBoot library for tftp client
> mode.
> You may need to modify the default server IP in ebsimp.c at about line
> 358.
>
> "Wang Yeqing" <wangyeqing1982@163.com> ¼¶¼g©ó¶l¥ó·s»D:O31DjWnZFHA.2916@TK2MSFTNGP14.phx.gbl...
>> Hi,Huang,
>> I have done as you said,and I succeeded when eboot as tftp server,because
>> it
>> is very simple.
>>
>> I failed when I used eboot as client.
>> Eboot can send tftp request to host,but host failed to response.I am sure
>> host tftp server is right.Because I can get file through windows tftp
>> client.
>> I don't know why.
>> I change EbootSendBootmeAndWaitForTftp as the following:
>> BOOL EbootSendBootmeAndWaitForTftp (EDBG_ADDR *pEdbgAddr, UCHAR
>> VersionMajor, UCHAR VersionMinor,
>> char *szPlatformString, char *szDeviceName,
>> UCHAR CPUId, DWORD dwBootFlags)
>> {
>> DWORD dwCurSec = OEMEthGetSecs () - BOOTME_INTERVAL;
>> USHORT wLen, wDestPort, wSrcPort, wUDPDataLen, *pwUDPData;
>> int nRetries = 0;
>> UINT16 fTftpLinked = 0;
>>
>> EdbgOutputDebugString ("+EbootSendBootmeAndWaitForTftp\r\n");
>> while (!fTftpLinked) {
>> if ((nRetries < MAX_BOOTME_CNT) && (OEMEthGetSecs () - dwCurSec >=
>> BOOTME_INTERVAL)) {
>> nRetries ++;
>> dwCurSec += BOOTME_INTERVAL;
>> // send a bootme message
>> EbootSendBootme (pEdbgAddr, VersionMajor, VersionMinor,
>> szPlatformString, szDeviceName, CPUId, dwBootFlags);
>> }
>> // get another frame and pass it to TFTP handler
>> wLen = sizeof (gFrameBuffer);
>> /* if (OEMEthGetFrame (gFrameBuffer, &wLen)) { // frame
>> available?
>> switch (FRAMETYPE (gFrameBuffer)) {
>> case 0x0800: // IP packet
>> if (!EbootCheckUDP(pEdbgAddr, gFrameBuffer, &wDestPort,
>> &wSrcPort, &pwUDPData, &wUDPDataLen)) { // UDP?
>> // EDBG command? (should only occur if eshell asked us
>> to jump to existing image)
>> if (!EbootProcessEDBG (pEdbgAddr, &gHostAddr,
>> gFrameBuffer, pwUDPData, wUDPDataLen, &fTftpLinked, &gpCfgData)) {
>> // no, pass it to TFTP
>> EbootTFtpReceiver (pEdbgAddr, gFrameBuffer,
>> wDestPort, wSrcPort, pwUDPData, wUDPDataLen);
>> }
>> }
>> break;
>> case 0x0806: // ARP packet
>> if (EbootProcessARP (pEdbgAddr, gFrameBuffer) ==
>> PROCESS_ARP_RESPONSE) {
>> EdbgOutputDebugString( "Some other station has IP
>> Address: %s !!! Aborting.\r\n", inet_ntoa(pEdbgAddr->dwIP));
>> return FALSE;
>> }
>> break;
>> default:
>> break;
>> }
>> }*/ /////I delete all these lines,because it servers as tftp
>> server,when as a client,it only need to send a connection request.
>> EbootTFtpReceiver (pEdbgAddr, gFrameBuffer, wDestPort, wSrcPort,
>> pwUDPData, wUDPDataLen, &fTftpLinked);
>> }
>>
>> EdbgOutputDebugString ("-EbootSendBootmeAndWaitForTftp\r\n");
>> return TRUE;
>> }
>>
>>
>>
>> And change EbootTFtpReceiver as following:
>>
>> WORD EbootTFtpReceiver( EDBG_ADDR *pMyAddr, BYTE *pFrameBuffer, UINT16
>> wDestPort, UINT16 wSrcPort, UINT16 *pwUDPData, UINT16 cwUDPDataLength,
>> UINT16 *fTftpLinked ) {
>>
>> int i;
>> UINT16 iLinkSlot = MAX_TFTP_LINKS;
>>
>> EDBG_ADDR HostAddr;
>> HostAddr.wMAC[0] = 0x4000;
>> HostAddr.wMAC[1] = 0x51B8;
>> HostAddr.wMAC[2] = 0xE5A7;
>> HostAddr.dwIP = 0x03BEA8C0; //192.168.190.3
>> HostAddr.wPort = 0x45; //69
>>
>> /*char szFileName[10];
>> strcpy(pszFileName, "nk.bin");*/
>>
>> // Check to see if this is for a link that is currently in use
>> for( i = 0; i < MAX_TFTP_LINKS; i++ ) {
>> // Here I don't compare the destination (Odo) port, only the source
>> (host)
>> because
>> // this could be a repeat open packet, which we don't want to cause a
>> second link.
>> // This could happen if a second open packet comes because we will have
>> changed the
>> // destination port with the acknowledge.
>> if (TFtpLinks[i].State != TFTP_STATE_IDLE && wSrcPort ==
>> TFtpLinks[i].DestAddr.wPort
>> && wDestPort == TFtpLinks[i].SrcAddr.wPort) {
>> iLinkSlot = i;
>> break;
>> }
>> else if (TFtpLinks[i].State == TFTP_STATE_IDLE)
>> iLinkSlot = i;
>> }
>>
>> // If we broke out of the loop early, then the packet is for a link that
>> is
>> already open
>> if (i < MAX_TFTP_LINKS) {
>> // iLinkSlot is the index of the link this packet belongs too
>> TFtpStateMachine( wSrcPort, iLinkSlot, pwUDPData, cwUDPDataLength );
>> }
>> // Check to see if someone is trying to start a new connection,
>> // If so, guarantee that there are always TFTP_TX_LINKS link(s) available
>> to transmit information
>> else //if (wDestPort == wOdoWellKnownServerPort && MAX_TFTP_LINKS -
>> nNumTFtpLinksInUse > TFTP_TX_LINKS)
>> {
>>
>> // iLinkSlot is the index of a link that is in the IDLE state, giving
>> the
>> number of a free link
>> // slot that can be used, the wDestTID and the TFTP Message
>> //TFtpdFormNewLink( pMyAddr, pFrameBuffer, iLinkSlot, pwUDPData );
>> TFtpOpen(&HostAddr, pMyAddr, "nk.bin", H2OLink, fTftpLinked);
>> return 1;
>> }
>> /*else {
>>
>> for( i = 0; i < MAX_TFTP_LINKS; i++ ) {
>> EdbgOutputDebugString("TFTP link[%u]: State:%u,
>> DestAddr.wPort:
>> %u, SrcAddr.wPort: %u\n",
>> i,TFtpLinks[i].State,
>> ntohs(TFtpLinks[i].DestAddr.wPort),
>> ntohs(TFtpLinks[i].SrcAddr.wPort));
>> }
>> EdbgOutputDebugString("TftpReceiver, port: 0x%X, wkp:
>> 0x%X\n\r",wDestPort,wOdoWellKnownServerPort);
>> }*/
>>
>> return 0;
>>
>> } // TFtpReceiver()
>>
>>
>>
>> Change TFtpOpen as following:
>>
>> UINT16 TFtpOpen( EDBG_ADDR *pHostAddr, EDBG_ADDR *pMyAddr, char
>> *pszFileName, TFtpLinkDir DataDir, UINT16 *fTftpLinked ) {
>>
>> int i, iLinkSlot = (MAX_TFTP_LINKS - 1);
>>
>> if (nNumTFtpLinksInUse >= MAX_TFTP_LINKS)
>> return 0;
>>
>> if ((strlen(pszFileName) + 1) > MAX_TFTP_FILENAME) return 0;
>>
>> // Find a link that isn't currently in use
>> for( i = 0; i < MAX_TFTP_LINKS; i++ ) {
>> if (TFtpLinks[i].State == TFTP_STATE_IDLE) {
>> iLinkSlot = i;
>> break;
>> }
>> }
>>
>> EdbgOutputDebugString( "Begin TFtpOpen function\r\n");
>> TFtpLinks[iLinkSlot].DataDir = DataDir;
>> TFtpLinks[iLinkSlot].State = (DataDir == H2OLink) ? TFTP_STATE_XFER_WAIT
>> :
>> TFTP_STATE_OPEN;
>> TFtpLinks[iLinkSlot].pfCallBack = NULL;
>> strcpy( TFtpLinks[iLinkSlot].szFileName, pszFileName );
>> TFtpLinks[iLinkSlot].wBlockNumber = 0;
>>
>> // Put in Read Request or Write Request as appropriate
>> *((UINT16*)(TFtpLinks[iLinkSlot].Buffer)) = htons((DataDir == H2OLink) ?
>> 1
>> : 2);
>> TFtpLinks[iLinkSlot].cwMsgLen = 2;
>> // Put in the file name
>> strcpy( TFtpLinks[iLinkSlot].Buffer + 2, pszFileName );
>> TFtpLinks[iLinkSlot].cwMsgLen += strlen( pszFileName ) +1; // A bug.File
>> should end with '\0'.WangYQ@Jun.1.2005
>> // Specify octet (binary) mode
>> strcpy( TFtpLinks[iLinkSlot].Buffer + TFtpLinks[iLinkSlot].cwMsgLen,
>> "octet" );
>> TFtpLinks[iLinkSlot].cwMsgLen += 6;
>>
>> // Send the read/write request packet back to the host
>> TFtpLinks[iLinkSlot].DestAddr = *pHostAddr;
>> TFtpLinks[iLinkSlot].DestAddr.wPort = wHostWellKnownServerPort;
>> TFtpLinks[iLinkSlot].SrcAddr = *pMyAddr;
>> TFtpLinks[iLinkSlot].SrcAddr.wPort = GenerateSrcPort();
>> EbootSendUDP(TFTPFrameBuffer, &(TFtpLinks[iLinkSlot].DestAddr),
>> &(TFtpLinks[iLinkSlot].SrcAddr),
>> TFtpLinks[iLinkSlot].Buffer,
>> TFtpLinks[iLinkSlot].cwMsgLen );
>> TFtpLinks[iLinkSlot].tLastTransmit = OEMEthGetSecs();
>> TFtpLinks[iLinkSlot].cwRetries = 0;
>>
>> *fTftpLinked = 1;
>>
>> return iLinkSlot+1;
>>
>> }
>>
>> Is all these changes right?
>>
>> Thanks.
>
>
>



Re: downloading image without PB? by K

K
Wed Jun 01 21:28:47 CDT 2005

I think you'll need to keep on sniffing the packet and also add some debug
message in the EBoot library to find out what's going on.
I have use these code with IXP4xx platforms and it worked fine.

"Wang Yeqing" <wangyeqing1982@163.com> ¼¶¼g©ó¶l¥ó·s»D:Ot7h89qZFHA.3364@TK2MSFTNGP09.phx.gbl...
> Thank you,Huang,
> Now eboot as client can communicate with tftp server.But it always
> encounters errors when transporting about 30 tftp packets.
> After transporting about 30 tftp packets successfully,eboot can not send
> ACK packet,Host will report "Time out occured" after trying sending DATA
> packets several times.
> Is my tftp server not working properly? But I have tested with Windows
> tftp client and works ok. And this time it is Eboot that can not send ACK
> signal.
> I don't know why.Can you give me some suggestions?
>
> Thanks very much.
>
> BTW:I get tftp server from this website(http://www.WinAgents.com). And I
> sniffer network through Iris Network Traffic Analyzer.
>
>



Re: downloading image without PB? by Wang

Wang
Thu Jun 02 01:37:23 CDT 2005

Hi,Huang,
Eboot working as TFTP client is OK.
I use Intel PXA270,and the maximum freq it can work is
624MHz.Unfortunately,it can not work at this freq on my platform because of
power manager.
However,Last night,I put it work in 624MHz,So it can not download as
client.When I put it working in 520MHz,it works well.

There is another point I want to mention.I think eboot should wait some time
before it sends ARP packet and TFTP packet.Because network has not been
connected when eboot sends these packets,So these packet will be lost and
EbootQueryIP always fails.
I don't know whether this is related to my own platform.But I think this is
a good suggestion.So I copy EbootInitEtherTransport as the following,Hope it
will help someone,and Thanks Huang again for your help.

BOOL EbootInitEtherTransport (EDBG_ADDR *pEdbgAddr, LPDWORD pdwSubnetMask,
BOOL *pfJumpImg, // will be set to
TRUE if eshell asked us to jump to existing image
DWORD *pdwDHCPLeaseTime, // this parameter is
overloaded. pass NULL to indicate static IP
UCHAR VersionMajor, UCHAR VersionMinor,
char *szPlatformString, char *szDeviceName,
UCHAR CPUId, DWORD dwBootFlags)
{
DWORD dwCurSec = OEMEthGetSecs ();
// simple check on arguments
if (!pEdbgAddr || !pdwSubnetMask || !szPlatformString) {
return FALSE;
}

// find out IP address and verify it
if (pdwDHCPLeaseTime) {
if (!EbootGetDHCPAddr (pEdbgAddr, pdwSubnetMask, pdwDHCPLeaseTime))
{
return FALSE;
}
} else {
if (!EbootCheckIP (pEdbgAddr)) {
EdbgOutputDebugString ("Some other station has IP Address: %s
!!! Aborting.\r\n", inet_ntoa(pEdbgAddr->dwIP));
return FALSE;
}
// This will tell CheckUDP() to only accept datagrams for our IP
address
ClearPromiscuousIP();
}

//if (!EbootInitTftpSimple (pEdbgAddr, htons(EDBG_DOWNLOAD_PORT),
htons(EDBG_DOWNLOAD_PORT), EDBG_DOWNLOAD_FILENAME)) {
if (!EbootInitTftpSimple (pEdbgAddr, htons(69), htons(69),
EDBG_DOWNLOAD_FILENAME)) {
return FALSE;
}


EdbgOutputDebugString ("+EbootInitEtherTransport\r\n");

while((OEMEthGetSecs() - dwCurSec) < 12);//Add by WangYQ,wait for
network be connected.

EbootSendBootme (pEdbgAddr, VersionMajor, VersionMinor,
szPlatformString, szDeviceName, CPUId, dwBootFlags);


{
//HostAddr.dwIP = inet_addr("192.168.190.3");
HostAddr.dwIP = 0x03BEA8C0; //192.168.190.3
//HostAddr.wMAC[0] = 0xA000;
//HostAddr.wMAC[1] = 0x1FC9;
//HostAddr.wMAC[2] = 0x7B08;
HostAddr.wMAC[0] = 0xFFFF;
HostAddr.wMAC[1] = 0xFFFF;
HostAddr.wMAC[2] = 0xFFFF;
HostAddr.wPort = 69;

if (!EbootQueryIP (pEdbgAddr, &HostAddr))
{
EdbgOutputDebugString ("Can not query the IP Address: %s !!!
Aborting.\r\n", inet_ntoa(HostAddr.dwIP));
return FALSE;
}

EdbgOutputDebugString ("Got the MAC for the IP Address: %s
[%B:%B:%B:%B:%B:%B]\r\n",
inet_ntoa(HostAddr.dwIP),
((PUCHAR)HostAddr.wMAC)[0], ((PUCHAR)HostAddr.wMAC)[1],
((PUCHAR)HostAddr.wMAC)[2], ((PUCHAR)HostAddr.wMAC)[3],
((PUCHAR)HostAddr.wMAC)[4], ((PUCHAR)HostAddr.wMAC)[5]
);

// try to initial a TFTP Client
gLinkHandle = TFtpOpen (&HostAddr, pEdbgAddr, "nk.bin", H2OLink);
}

EbootCheckIP (pEdbgAddr);
#if 0
{
UINT idx;
for (idx = 0; idx <2; idx++)
EbootCheckIP (pEdbgAddr);
}
#endif // 0
//if (!EbootSendBootmeAndWaitForTftp (pEdbgAddr, VersionMajor,
VersionMinor, szPlatformString, szDeviceName, CPUId, dwBootFlags))
// return FALSE;
//EbootSendBootmeAndWaitForTftp (pEdbgAddr, VersionMajor, VersionMinor,
szPlatformString, szDeviceName, CPUId, dwBootFlags);

*pfJumpImg = (NULL != gpCfgData);
return TRUE;
}


"K. S. Huang" <ksh_AT_bsquare_DOT_com> дÈëÏûÏ¢ÐÂÎÅ:%23Z$FiqxZFHA.3976@TK2MSFTNGP15.phx.gbl...
>I think you'll need to keep on sniffing the packet and also add some debug
>message in the EBoot library to find out what's going on.
> I have use these code with IXP4xx platforms and it worked fine.
>
> "Wang Yeqing" <wangyeqing1982@163.com> ¼¶¼g©ó¶l¥ó·s»D:Ot7h89qZFHA.3364@TK2MSFTNGP09.phx.gbl...
>> Thank you,Huang,
>> Now eboot as client can communicate with tftp server.But it always
>> encounters errors when transporting about 30 tftp packets.
>> After transporting about 30 tftp packets successfully,eboot can not send
>> ACK packet,Host will report "Time out occured" after trying sending DATA
>> packets several times.
>> Is my tftp server not working properly? But I have tested with Windows
>> tftp client and works ok. And this time it is Eboot that can not send ACK
>> signal.
>> I don't know why.Can you give me some suggestions?
>>
>> Thanks very much.
>>
>> BTW:I get tftp server from this website(http://www.WinAgents.com). And I
>> sniffer network through Iris Network Traffic Analyzer.
>>
>>
>
>