ºìÁªLinuxÃÅ»§
Linux°ïÖú

linuxÍø¿¨Çý¶¯³ÌÐòµÄ±àÒëÓë°²×°

·¢²¼Ê±¼ä:2006-08-16 09:05:17À´Ô´:ºìÁª×÷Õß:qingniaox
¡¡¡¡Ò»°ãÀ´Ëµ£¬Ä¿Ç°Ð°æµÄ Linux Ô¤Éè¿ÉÒÔÖ§³ÖµÄÍøÂ翨оƬ×éÊýÁ¿ÒѾ­ºÜÍ걸ÁË£¬ºÜ¶àÍøÂ翨оƬ¶¼ÒѾ­±»Ö§³Ö,

¡¡¡¡ÀýÈçRLT 8139 оƬ ( RealTek 8139 ) µÄÍøÂ翨ËùÒÔʹÓÃÕß¿ÉÒÔºÜÇáÒ×µÄÉ趨ºÃËûÃǵÄÍøÂ翨¡£

¡¡¡¡²»¹ý£¬Èç¹ûÍòÒ»²»ÐÒºËÐÄûÓÐÖ§³Ö¸ÃÍøÂ翨µÄ»°£¬ÄÇô¿ÉÒÔ͸¹ýÖØбàÒëºËÐÄ»òÕß±àÒëÍøÂ翨Çý¶¯Ä£¿é ( Modules )£¬

¡¡¡¡²¢ÇÒ¼ÓÔظÃÄ£¿é£¬½ñÌì¾ÍÊÇÕâôÇÉ,Åöµ½Ò»¸öD-Link µÄDFE-530TX,û·¨,Ö»ÓÐÊÖ¶¯°²×°ÍøÂ翨Çý¶¯³ÌÐòÁË.

¡¡¡¡¿ÉÒÔÓÃÃüÁî# dmesg | grep eth

¡¡¡¡À´²é¿´ÏµÍ³Æô¶¯ÐÅÏ¢,ÏÔʾ³ö eth0 »òÕß eth1 µÄÐÅÏ¢£¬Èç¹ûeth1ûÕÒµ½ÕýÈ·µÄÐÅÏ¢,ÄǾͱíʾ Linux ÎÞ·¨ÕÒµ½¸ÃÓ²¼þ,

¡¡¡¡eth0ÊÇ8139µÄ,ÒѾ­ÏÔʾÕý³£,ÀýÈç:

[root@kindgeorge root]# dmesg | grep eth

eth0: RealTek RTL8139 Fast Ethernet at 0xf0160000, 00:0a:a6:30:0d:0e, IRQ 11

eth0: Identified 8139 chip type 'RTL-8139C'

eth0: Setting 10mbps full-duplex based on auto-negotiated partner ability 4061.



Ò». ²é¿´×Ô¼ºÏµÍ³µÄÄں˰汾.

[root@kindgeorge root]# uname -r

2.4.18-3¡¡

ÎÒÕâÀïÊÇredhat7.3µÄ,ÄÚºË2.4.18-3

Ò»°ãÀ´Ëµ,Õâ¸öÄÚºËÇý¶¯³ÌÐòµÄÄ£¿é»á·ÅÔÚ /lib/modules/2.4.18-3/kernel/drivers/net

¶þ.È·¶¨ÏµÍ³ÊÇ·ñÒѾ­°²×°ÏÂÃæ°ü

1.ÓÉÓÚ±àÒëÐèÒªÓõ½Äں˵ÄÔ´´úÂë°üºÍ±àÒë³ÌÐògcc.ËùÒÔÈç¹ûûÓеĻ°,ÒªÏÈ×°.

²é¿´:

[root@kindgeorge root]# rpm -qa|grep kernel

kernel-2.4.18-3

kernel-source-2.4.18-3

[root@kindgeorge root]# rpm -qa|grep gcc (gccÊDZàÒëÓÃ)

gcc-2.96-110

gcc-g77-2.96-110

gcc-c++-2.96-110

Ò»°ã×°ÁËÄÚºËÔ´°üµÄ»°,¶¼»áÔÚ³öÏÖ/usr/src/linux-2.4,ͬ·¾¶Ï»áÓÐlinux-2.4.18-3µÄÎļþʵ¼ÊĿ¼.

2.Èç¹ûûÓеĻ°,¾ÍÓÃÔ­À´°²×°ÅÌÉϵÄÎļþ°²×°,»áÈ¥ÏÂÔظöÏàͬÄÚºËÔ´°ü°²×°°É

rpm -ivh kernel-source-2.4.18-3.i386.rpm

......

Èý. È¡µÃÇý¶¯³ÌÐòºÍ±àÒë

1. ¿ÉÒÔÖس§¼ÒÌṩµÄ¹âÅÌÌṩ,°Ñ¹âÅÌÉϵÄlinuxĿ¼ÏµÄdlkfet-4.24.tar.gz ¿½±´¹ýÀ´ÓÃ.

2. ´ÓÍøÉÏÏÂÔØÍøÂ翨Çý¶¯³ÌÐò,Ò»°ã³§¼ÒµÄÍøÕ¾¶¼ÌṩÏÂÔسÌÐòµÄ.

ÀýÈç: http://www.d-link.com.cn ÉÏÓÐÏÂÔØ.

[root@kindgeorge root]# cp dlkfet-4.24.tar.gz /usr/src

[root@kindgeorge root]# cd /usr/src/

[root@kindgeorge src]# tar -zxvf dlkfet-4.24.tar.gz

dlkfet-4.24/

dlkfet-4.24/rhine_main.c

dlkfet-4.24/Makefile

dlkfet-4.24/vmns_drv.h

dlkfet-4.24/rhine.h

dlkfet-4.24/.depend.mak

dlkfet-4.24/rhine_vmns.c

dlkfet-4.24/rhine_proc.h

dlkfet-4.24/rhine_proc.c

dlkfet-4.24/rhine_vmns.h

dlkfet-4.24/kcompat.h

dlkfet-4.24/rhine_cfg.h

dlkfet-4.24/.depend

dlkfet-4.24/rhine_wol.c

dlkfet-4.24/rhine_wol.h

dlkfet-4.24/linux.txt

3.ÇëÁôÒâÒ»¿ªÊ¼ÊÇûÓÐ.oÎļþµÄ. ÎÒÃDZàÒëÇ°¿ÉÒÔ¿´¿´Ä¿Â¼µÄlinux.txt,ÊÇÒ»¸ö°üº¬½éÉÜ°²×°ËµÃ÷.ÔÚ½øÈëĿ¼ºó,Ö´ÐÐmake½øÐбàÒë.

[root@kindgeorge src]# cd dlkfet-4.24

[root@kindgeorge dlkfet-4.24]# make

[root@kindgeorge dlkfet-4.24]# ll (±àÒëºó²é¿´Ò»ÏÂ)

total 320

-rw-r--r-- 1 root root 7473 Jan 15 2003 kcompat.h

-rw-r--r-- 1 root root 11491 Jan 20 2003 linux.txt

-rw-r--r-- 1 root root 5219 Dec 10 2002 Makefile

-rw-r--r-- 1 root root 1818 Jan 16 2003 rhine_cfg.h

-rw-r--r-- 1 root root 48715 May 24 18:31 rhinefet.o

-rw-r--r-- 1 root root 42044 Jan 15 2003 rhine.h

-rw-r--r-- 1 root root 78996 Jan 16 2003 rhine_main.c

-rw-r--r-- 1 root root 32760 May 24 18:31 rhine_main.o

-rw-r--r-- 1 root root 14980 Jan 15 2003 rhine_proc.c

-rw-r--r-- 1 root root 1672 Jan 15 2003 rhine_proc.h

-rw-r--r-- 1 root root 12336 May 24 18:31 rhine_proc.o

-rw-r--r-- 1 root root 9172 Jan 15 2003 rhine_vmns.c

-rw-r--r-- 1 root root 1106 Jan 15 2003 rhine_vmns.h

-rw-r--r-- 1 root root 3792 May 24 18:31 rhine_vmns.o

-rw-r--r-- 1 root root 7536 Jan 15 2003 rhine_wol.c

-rw-r--r-- 1 root root 1529 Jan 15 2003 rhine_wol.h

-rw-r--r-- 1 root root 3488 May 24 18:31 rhine_wol.o

-rw-r--r-- 1 root root 6824 Jan 15 2003 vmns_drv.h



4.¾­¹ý±àÒëºó,»á±àÒë³öÒ»¸örhinefet.o Îļþ,Õâ¸ö¾ÍÊÇÇý¶¯Ä£¿é,ÎÒÃÇ°ÑËü¿½±´µ½ÏàÓ¦µØ·½:

[root@kindgeorge dlkfet-4.24]#cp rhinefet.o /lib/modules/2.4.18-3/kernel/drivers/net

[root@kindgeorge dlkfet-4.24]# depmod -a

5.²âÊÔ

(1)¿ÉÒÔÓÃÃüÁîmodprobe rhinefet »ò insmod rhinefet.o ¼ÓÔØ.Èç¹ûû³ö´íÐÅϢ˵Ã÷ok.

(2) ÓÃÃüÁîlsmod ¿ÉÒÔ¿´¿´ÊÇ·ñÒѾ­¼ÓÔØÁË.

[root@kindgeorge dlkfet-4.24]# lsmod

Module Size Used by Not tainted

rhinefet 38752 1

8139too 16448 1

mii 2408 0 [8139too]

ÕâÑù,¿´µ½rhinefetÄ£¿éÒѾ­¼ÓÔØÁË,»ù±¾ÉÏ£¬ÕâÑù¾ÍÖ¤Ã÷ÒѾ­±àÒë³É¹¦.



6. ÈÃËü¿ª»úʱ¼ÓÔØ

[root@kindgeorge dlkfet-4.24]# vi /etc/modules.conf

ÔÚºóÃæ¼ÓÉÏÒ»ÐÐ: alias eth1 rhinefet

7. ÅäÖÃÒ»ÏÂÍøÂç

[root@kindgeorge dlkfet-4.24]# vi /etc/sysconfig/network-scripts/ifcfg-eth1



DEVICE=eth1

BOOTPROTO=static

IPADDR=192.168.4.202

NETMASK=255.255.255.0

NETWORK=192.168.4.0

GATEWAY=192.168.4.250

BROADCAST=192.168.4.255

ONBOOT=yes

8.Æô¶¯Íø¿¨,È»ºóÓÃifconfig²é¿´,

ifup eth1

[root@kindgeorge dlkfet-4.24]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0A:E6:30:0D:0E

inet addr:211.239.218.153 Bcast:211.239.218.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:3780479 errors:0 dropped:0 overruns:0 frame:0

TX packets:3833860 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:100

RX bytes:1118112324 (1066.3 Mb) TX bytes:1111887387 (1060.3 Mb)

Interrupt:11



eth1 Link encap:Ethernet HWaddr 00:0F:3D:82:EC:1D

inet addr:192.168.4.202 Bcast:192.168.4.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:749312 errors:0 dropped:0 overruns:0 frame:0

TX packets:976174 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:100

RX bytes:43695059 (41.6 Mb) TX bytes:1472142037 (1403.9 Mb)

Interrupt:5 Base address:0xe000



9.ÖØÐÂÆô¶¯»úÆ÷,¿ÉÒÔ×Ô¶¯¼ÓÔغÍʹÓÃÁË.´ó¹¦¸æ³É.



Îå. °´ÕÕ°²×°ËµÃ÷µÄ·½·¨×Ô¶¯±àÒë°²×°.

ÔÚ "Èý.3" ÖÐÎÒÃÇÓÃmake ±àÒë,È»ºó½øÐÐÊÖ¶¯µÄ¿½±´. ʵ¼ÊÉÏÔÚlinux.txtÖеݲװ˵Ã÷Ìáµ½ÓÃmake install .

ÄÇÎÒÃÇÀ´¿´¿´ÕâÖÖ·½·¨ÏµÍ³¶¼×öÁËʲô°É.

[root@firewall1 dlkfet-4.24]# make install

gcc -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe -I/lib/modules/2.4.18-3/build/include -I. -Wstrict-prototypes -fomit-frame-pointer -DMODVERSIONS -include /lib/modules/2.4.18-3/build/include/linux/modversions.h -DVMNS -c -o rhine_main.o rhine_main.c

gcc -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe -I/lib/modules/2.4.18-3/build/include -I. -Wstrict-prototypes -fomit-frame-pointer -DMODVERSIONS -include /lib/modules/2.4.18-3/build/include/linux/modversions.h -DVMNS -c -o rhine_proc.o rhine_proc.c

gcc -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe -I/lib/modules/2.4.18-3/build/include -I. -Wstrict-prototypes -fomit-frame-pointer -DMODVERSIONS -include /lib/modules/2.4.18-3/build/include/linux/modversions.h -DVMNS -c -o rhine_wol.o rhine_wol.c

gcc -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe -I/lib/modules/2.4.18-3/build/include -I. -Wstrict-prototypes -fomit-frame-pointer -DMODVERSIONS -include /lib/modules/2.4.18-3/build/include/linux/modversions.h -DVMNS -c -o rhine_vmns.o rhine_vmns.c





**************************************************

Build options:

VERSION 2.4.18-3

SMP Disabled

VMNS Enabled

***************************************************

mkdir -p /lib/modules/2.4.18-3/kernel/drivers/net

install -m 644 -o root rhinefet.o /lib/modules/2.4.18-3/kernel/drivers/net

***** Move official driver via-rhine.o to via-rhine.o.backup

mv /lib/modules/2.4.18-3/kernel/drivers/net/via-rhine.o /lib/modules/2.4.18-3/kernel/drivers/net/via-rhine.o.backup



/sbin/depmod -a || true



°´ÕÕÉÏÃæµÄ½á¹ûÏÔʾÊÇÕâÑùµÄÒ»¸ö¹ý³Ì:

(1)ϵͳ°Ñ.cµÈÎļþ±àÒë³ÉÏàÓ¦µÄ.oÎļþ.

(2)È»ºóÏÔʾϵͳÊÇ·ñÖ§³ÖSMPºÍVMNS,È»ºó°ÑÏàÓ¦µÄ.oÄ£¿éÎļþ¿½±´µ½ÏµÍ³Ó¦¸ÃµÄµØ·½.

(3)²¢ÇÒ°ÑÏàͬоƬµÄ³ÌÐò¹ýʱµÄvia-rhine.o¸ÄΪ±¸·ÝÎļþ.ÈÃϵͳÓÃеÄrhinefet.o

(4)×îºóÖ´ÐÐ/sbin/depmod -a ¸üÐÂÄ£¿é¿âÅäÖÃ. ¿´À´Õâ¸öÒ²ÊǸöÖÇÄܵݲװ·½·¨.

Áù. ÓÃÆäËû·½·¨Çý¶¯.

ÓÉÓÚÊÐÃæÉϺܶàµÄ¸÷ÖÖ¸÷ÑùµÄ°å¿¨,ÓÐÃûÅÆÓÐÔÓÅÆ,¶à²»Ê¤Êý.µ±ÎÒÃÇÄõ½Ò»¿é¿¨,µ«Ò»ÏÂ×ÓûÕÒµ½Ëü±¾ÉíÌṩµÄÔ´³ÌÐò,²»ÄܱàÒë,Ôõô°ìÄØ?

ËùÒÔµ±ÄãÓÐÒ»¿éÍø¿¨²»ÄÜÓÃ,ÔÚÕÒlinuxµÄdriver֮ǰһ¶¨¸ãÇå³þÕâ¸öÍø¿¨ÓõÄʲôоƬ,¸úË­¼æÈÝ,±ÈÈç3c509,ne2000,etherexpressµÈµÈ.

ÕâÑùµÄÐͺÅÒ»°ã¶¼ÔÚÍø¿¨ÉÏ×î´óµÄÒ»¿ìоƬÉÏÓ¡×Å.Èç¹ûоƬÐͺÅÏàͬ,ÄÇôËüÃÇÆäÖÐһЩÊÇ¿ÉÒÔͨÓõÄ.ÎÒÃÇ¿ÉÒÔ³¢ÊÔÒ»ÏÂϵͳÉÏÒѾ­°²×°Á˵ÄÇý¶¯ÊÇ·ñ¿ÉÐÐÁË.½øÈëÇý¶¯Ä¿Â¼/lib/modules/(Äں˰汾)/kernel/drivers/net ¼´¿É·¢ÏÖÒѾ­ÓкܶàÄ£¿éÁË, ÓÃÃüÁîinsmod ÏàӦоƬģ¿éÃû×Ö , Èç¹û²»³É¹¦»á±¨´í,Èç¹ûÕýÈ·Ôò²»ÏÔʾ´íÎóÐÅÏ¢,È»ºóÔÙ½øÐÐÉÏÃæµÄ"Èý.5-9"²½Öè½øÐвâÊÔ.Èç¹û²»ÐÐ,ÔÙÀÏÀÏʵʵµÄÕÒÔ´³ÌÐò°É.
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ