试试这些吧网络功能吧! To enable network support, in uClinux-dist kernel config, Networking -->
Networking support Networking options ---> <*> Packet socket <*> Unix domain sockets TCP/IP networkingDevice Drivers -->Network device support ─>
Network device support Ethernet (10 or 100Mbit)
SMC 91C9x/91C1xxx support # only if you use Altera Nios dev board with SMC91111, [ ] Opencores (Igor) Emac support [ ] MoreThanIP 10_100_1000 Emac support [ ] DM9000 support DM9000A with checksum offloading # only if you use DE2 with DM9000AIf you use Altera's Nios dev board, select "SMC 91C9x/91C1xxx support" . linux-2.6.x/drivers/net/smc91x.c . If you use DE2 board, you should enable "DM9000A with checksum offloading" . linux-2.6.x/drivers/net/dm9ks.c . If you use Altera Stratix dev board, you must change the irq number of the ether chip to a non-zero value in SOPC builder and rebuild.
Then rebuild the kernel, and boot nios2 uclinux. It should detect the SMC 91111 or DM9000 device as eth0. Every board should have a unique ethernet hardware address. In file linux-2.6.x/arch/nios2nommu/kernel/setup.c, kernel get the hw addr from the flash on Altera dev board. You may use 'ifconfig' to find out. If you use custom boards, you need to change setup.c or use ifconfig to set hw address. ifconfig eth0 hw ether 00:07:ed:0a:03:29 # hardware MAC address 00:07:ed:0a:03:<random 00-ff>
Then config the ip address and router. ifconfig eth0 192.168.1.10 # static ip route add default gw 192.168.1.254 # gateway Or, use dhcp client ifconfig eth0 up dhcpcd &
To set name server (DNS) , create the file /etc/resolv.conf , with a line of your name server, eg nameserver 192.168.1.254 Or if you use DHCP, the dhcpcd will create this file. Refer to the end of NFSFileSytem wiki page for a sample dhcpd.conf.
You may use "ntpdate" to get date & time from internet. Set TZ env to your timezone, eg "TZ=CST-8" for east China. Or edit the file vendors/Altera/nios2nommu/TZ , which will be /etc/TZ as the cache of TZ env. /> TZ=CST-8 /> ntpdate pool.ntp.org Looking for host pool.ntp.org and service ntp host found : 71.237.179.90 13 Dec 11:05:33 ntpdate[20]: step time server 71.237.179.90 offset 222059037.166530 sec /> date Wed Dec 13 11:05:39 2006 The telnetd and ftpd should be invoked by inetd with the default config. The BOA is standalone. /> inetd & # start inetd to invoke telnetd and ftpd services [15] /> boa & # start httpd with cgi-demo [16] /> netstat -a Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:http *:* LISTEN tcp 0 0 *:ftp *:* LISTEN tcp 0 0 *:telnet *:* LISTEN Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path You may add these setup for ethernet to the file vendors/Altera/nios2nommu/rc (which will become /etc/rc ) in uClinux-dist dir, follow the setup for "lo" . So that the ethernet will be configed by init. With dm9ks driver in DE2 the ftpd transfer rate is around 1.5-1.7 MByte/s. Jumbo Frames support is enabled by changing the MTU to a value larger than the default of 1500. Use the ifconfig command to increase the MTU size. eg, ifconfig eth<x> mtu 6000 up
|