标题: 编译网卡驱动过程中的问题 [打印本页] 作者: kenshinji 时间: 2004-04-01 12:51 标题: 编译网卡驱动过程中的问题 请问哪位知道怎么安装realtek8150网卡的驱动么?
该驱动的guide如下:
The procedure to activate rtl8150 on linux is as follows:
step 2: insert the driver as module:
insmod rtl8139.o
(run 'lsmod' to see if the module is inserted)
step 3: bind your card to an IP address:
/sbin/ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
(run 'netstat -i' to see if there is a interface 'eth0')
step 4: add your card to IP routing table and add gateway:
/sbin/route add default gw ${GATEWAY} dev eth0
*make sure that your kernel is version 2.4.0 above. Otherwise, you have to
upgrade your kernel.
//本人在red hat 8.0下编译。作者: kenshinji 时间: 2004-04-01 12:53 标题: 编译网卡驱动过程中的问题 驱动附上
/*
** Pegasus: USB 10/100Mbps/HomePNA (1Mbps) Controller
**
** Copyright (c) 1999,2000 Petko Manolov - Petkan (petkan@dce.bg)
**
**
** ChangeLog:
** .... Most of the time spend reading sources & docs.
** v0.2.x First official release for the Linux kernel.
** v0.3.0 Beutified and structured, some bugs fixed.
** v0.3.x URBifying bulk requests and bugfixing. First relatively
** stable release. Still can touch device's registers only
** from top-halves.
** v0.4.0 Control messages remained unurbified are now URBs.
** Now we can touch the HW at any time.
** v0.4.9 Control urbs again use process context to wait. Argh...
** Some long standing bugs (enable_net_traffic) fixed.
** Also nasty trick about resubmiting control urb from
** interrupt context used. Please let me know how it
** behaves. Pegasus II support added since this version.
** TODO: suppressing HCD warnings spewage on disconnect.
** v0.4.13 Ethernet address is now set at probe(), not at open()
** time as this seems to break dhcpd.
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
**
** ChangeLog of Realtek:
** 1.0.0 First release for RTL8150 USB Fast Ethernet NIC
**
*/
eth_copy_and_sum(skb, rtl8150->;rx_buff, pkt_len, 0);
skb_put(skb, pkt_len);
/// in "Linux Device Drivers", the two statements above should be
/// "memcpy( skb_put( skb, pkt_len), rtl8150->;rx_buff, pkt_len );"
skb->;protocol = eth_type_trans(skb, net);
netif_rx(skb); /// call this system call to transfer the "skb" to the upper layer
rtl8150->;stats.rx_packets++;
rtl8150->;stats.rx_bytes += pkt_len;
netif_wake_queue( net );
info( "-rtl8150_tx_timeout() <=====" );
}
static int rtl8150_start_xmit( struct sk_buff *skb, struct net_device *net )
{
rtl8150_t *rtl8150 = net->;priv;
int count = ((skb->;len) & 0x3f) ? skb->;len : skb->;len+1;
/// increase 64n-length packet by one, because the host controller sometimes doesn't send
/// 0-length usb packet to end the 64n-length packet.
int res;
/// this function is called when "ifconfig ethx xxx ....."
static int rtl8150_open(struct net_device *net)
{
rtl8150_t *rtl8150 = (rtl8150_t *)net->;priv;
int res;
///info( " rtl8150_probe: before check_deice_ids()" );
if ( (dev_indx = check_device_ids(dev->;descriptor.idVendor, dev->;descriptor.idProduct)) == -1 )
{
info( " rtl8150_pbobe: this is not my device!" );
return NULL;
}
///info( " rtl8150_probe: after check_device_ids()" );
///info( " rtl8150_probe: before usb_set_configuration()" );
/// the following is for fixing the bug of 1st-cut, and must be removed in 2nd-cut
dev->;config[0].bConfigurationValue = 1;
////////////////////////////////////////////////
if (usb_set_configuration(dev, dev->;config[0].bConfigurationValue))
{
err("usb_set_configuration() failed");
info( " rtl8150_probe: usb_set_configuration() failed" );
return NULL;
}
///info( " rtl8150_probe: after usb_set_configuration()" );
if(!(rtl8150 = kmalloc(sizeof(struct rtl8150), GFP_KERNEL)))
{
err("out of memory allocating device structure");
info( " rtl8150_probe: out of memory allocating device structure" );
return NULL;
}
/// added by Owen on 01/11/2000
rtl8150->;get_registers_flag = 0;
rtl8150->;set_registers_flag = 0;
///info( " rtl8150_probe: before usb_inc_dev_use()" );
usb_inc_dev_use( dev );
memset(rtl8150, 0, sizeof(struct rtl8150));
///info( " rtl8150_probe: after usb_inc_dev_use()" );
///info( " rtl8150_probe: before init_MUTEX()" );
init_MUTEX( &rtl8150->; ctrl_sem );
///info( " rtl8150_probe: after init_MUTEX()" );
///info( " rtl8150_probe: before init_waitqueue_head()" );
init_waitqueue_head( &rtl8150->;ctrl_wait );
///info( " rtl8150_probe: after init_waitqueue_head()" );
///info( " rtl8150_probe: before init_etherdev()" );
net = init_etherdev( NULL, 0 );
if ( !net )
{
kfree( rtl8150 );
info( " rtl8150_probe: init_etherdev() failed" );
return NULL;
}
///info( " rtl8150_probe: after init_etherdev()" );