--- Quote Start ---
Hi,
So I tested 'dhclient' and don't know whether it's fortunate or unfortunate, but it sends DHCP DISCOVER packets from my NEEK. The DHCP server returns an IP address.
Of course, I encountered several bugs.
1) The compiler translates the function
memcpy (&from -> sin_addr, &ip -> ip_src, 4);
in the file '/common/packet.c' to the next machine code
0x0000aeb0 <decode_udp_ip_header+152>: ldw r2,0(r21)
0x0000aeb4 <decode_udp_ip_header+156>: add r17,r16,r19
0x0000aeb8 <decode_udp_ip_header+160>: stw r2,4(fp)
. Unfortunately, the address of 'from -> sin_addr' is word-aligned, so the code 'ldw r2,0(r21)' will evoke SIGBUS error. The detour is to rewrite the function as follows.
{ int i;
unsigned char *pd = &ip -> ip_src, *ps = &from -> sin_addr;
for (i = 0; i < 4; i++)
*pd++ = *ps++;
}
2) Also the checksum is wrong, I only comment the code out.
// if (usum && usum != sum) {
// udp_packets_bad_checksum++;
// if (udp_packets_seen > 4 &&
// (udp_packets_seen / udp_packets_bad_checksum) < 2) {
// note ("%d bad udp checksums in %d packets",
// udp_packets_bad_checksum, udp_packets_seen);
// udp_packets_seen = udp_packets_bad_checksum = 0;
// }
// return -1;
// }
Maybe , the function 'checksum' has some bugs. And 'dhclient-script' is not interpreted well. Maybe we need 'bash'.
I can't understand what you mean, but I think that these malfunctions are not caused by the driver.
Kazu
--- Quote End ---
That's interesting, I didn't run into a SIGBUS or any crashes with dhclient. dhclient-script didn't get installed by uClinux-dist and I didn't see one there, so I just took the one from my desktop and changed bash to hush, so that could be causing problems. Networking does work on the NEEK using your driver patch and the design on the wiki, contrary to what the wiki says about that design! I can get an address with DHCP using dhcpcd (-new) if I comment out the checksum part that causes the SIGBUS. So it does seem that my problem on the custom hardware is not entirely caused by the driver -- though it did work before adding the MMU. Maybe it's the PHY driver.