当前位置: 技术问答>linux和unix
小弟想学着用一下Linux,装好后出现了问题,请各位大哥帮我看看
来源: 互联网 发布时间:2014-10-26
本文导语: 怎么安装驱动程序? 我的网卡驱动程序里面的Linux目录下只有一个C的源程序,是不是还要到Linux下编译,运行才能安装驱动程序? |能不能在Windows编译到Linux下运行,这个我真的不太清楚, 不过,linux...
怎么安装驱动程序?
我的网卡驱动程序里面的Linux目录下只有一个C的源程序,是不是还要到Linux下编译,运行才能安装驱动程序?
我的网卡驱动程序里面的Linux目录下只有一个C的源程序,是不是还要到Linux下编译,运行才能安装驱动程序?
|
能不能在Windows编译到Linux下运行,这个我真的不太清楚, 不过,linux应该是带有compiler的(gcc)。 而网卡驱动程序里面的Linux目录下的C源程序,就是应该在LINUX里面compile的。 把这个XXXX.C放到LINUX/ROOT下的一个自建的临时目录里面,MAKE它(或 ALL)。 算了算了,你还是参考参考下面的E文吧,我就不装大鼻子象了: In Linux, NIC drivers are most commonly configured as loadable modules. The approach of building a monolithic kernel has become obsolete. The driver can be compiled as part of a monolithic kernel, but is strongly discouraged. The remainder of this section assumes the driver is built as a loadable module. In the Linux environment, it is a good idea to rebuild the driver from the source instead of relying on a precompiled version. This approach provides better reliability since a precompiled driver might depend on libraries or kernel features that are not present in a given Linux installation. The 3 files necessary to build Linux device driver are via-rhine.c, via-rhine.h and Makefile. To compile, the Linux installation must include the gcc compiler, the kernel source, and the kernel headers. The Linux driver supports Linux Kernels 2.0.x, 2.2.x and 2.4.x. Copy the files to a directory and enter the following command to compile and link the driver: Floppy disc drive ----------------- cd root mkdir tmp cd tmp mcopy a:linux530_321.tar /root/tmp tar xfv linux530_321.tar make all Installing the Driver ===================== Manual Installation ------------------- Once the driver has been compiled, it must be loaded, enabled, and bound to a protocol stack in order to establish network connectivity. To load a module enter the command: insmod via-rhine.o or insmod via-rhine.o ; add parameter Please reference the list of the command line parameters supported by the Linux device driver below. The insmod command only loads the driver and gives it a name of the form eth0, eth1, etc. To bring the NIC into an operational state, it is necessary to issue the following command: ifconfig eth0 up Finally, to bind the driver to the active protocol (e.g., TCP/IP with Linux), enter the following command: ifup eth0 Note that this is meaningful only if the system can find a configuration script that contains the necessary network information. A sample will be given in the next paragraph. The commands to unload a driver are as follows: ifdown eth0 ifconfig eth0 down rmmod via-rhine.o The following are the commands to list the currently loaded modules and to see the current network configuration. lsmod ifconfig Automated Installation ---------------------- This section describes how to install the driver such that it is automatically loaded and configured at boot time. The following description is based on a Red Hat 6.0/7.0 distribution, but it can easily be ported to other distributions as well. Red Hat v6.x/v7.x ----------------- 1. Copy via-rhine.o to the network modules directory, typically /lib/modules/2.2.x-xx/net or /lib/modules/2.4.x/kernel/drivers/net. 2. Locate the boot module configuration file, most commonly modules.conf or conf.modules in the /etc directory. Add the following lines: alias ethx via-rhine options via-rhine where ethx will be eth0 if the NIC is the only ethernet adapter, eth1 if one other ethernet adapter is installed, etc. Refer to the table in the previous section for the list of optional parameters. 3. Locate the network configuration scripts, normally the /etc/sysconfig/network-scripts directory, and create a configuration script named ifcfg-ethx that contains network information. 4. Note that for most Linux distributions, Red Hat included, a configuration utility with a graphical user interface is provided to perform steps 2 and 3 above, such as netconfig, linuxconf. Configuration Script Sample =========================== Here is a sample of a simple configuration script: DEVICE=eth0 USERCTL=no ONBOOT=yes POOTPROTO=none BROADCAST=207.200.5.255 NETWORK=207.200.5.0 NETMASK=255.255.255.0 IPADDR=207.200.5.2 Troubleshooting =============== Q: Couldn't compiler the driver ? A: Copy all necessary files on same current directory. Make sure all files are Unix file format (no LF). You can use some convertible program conver it from DOS to UNIX. (Like dos2unix, UltraEdit-32 ...). Q: Couldn't compiler at RH7.1 ? A: For whatever reason, RH7.1 broken kernel layout. Traditionaly there is a symlink /usr/src/linux links to /usr/src/linux-2.4.2, but not at RH7.1. The default symlink under RH7.1 is /usr/src/linux-2.4. To Correct this, you need to rename the symlink /usr/src/linux-2.4: Go to the path /usr/src, there are two methods to fix 1.Use mv command to change the path. mv /usr/src/linux-2.4 /usr/src/linux; 2.Create new symlink point to /usr/src/linux-2.4.2 ln -s /usr/src/linux-2.4.2 /usr/src/linux Q: How to compile at SMP system? A: Use the command: make smp
|
to: hem(何明) 听说你要离开公司,打算去哪里? 这两天搞论文,没来这里。
|
to: wt13: 在Linux下安装驱动程序, 一般都是C的源代码, 都需要你自己编译.而且只能在Linux下编译,不能在Windows下编译再到Linux下运行.一般情况下Linux都带有GCC编译器.ZeeGee(ZeeGee)的方法很对, 在Linux下游一个目录是专门放置驱动程序的目录,具体目录名我现在一时记不清了. to: hem(何明)我们都希望你继续干下去,加油.可以留个信箱吗?一起讨论问题,现在我在南京大学,这里用Linux的风气不浓,真希望有个人一起来讨论.我的信箱是shaofanyun@263.net.上次我申请斑竹,CSDN的回信说现在咱们版的人气还不够,我觉得咱们应该提升一下咱们版的人气.
|
to wt13(饿狼):来了来了(其实是班竹把我抓过来的),shaofanyun(烧饭云) 说得很对。因为linux下可执行程序的格式和windows完全不一样。如果是c程序你可以用gcc来编译,如果是C++则用g++来编译。另:详细看一下此网卡的安装说明。
|
Windows当然不行的,用Linux自带的,gcc或g++,照说在同一个目录下应该有一个configure的文件,一般的步骤是: ./configure make make install
|
同意ZeeGee(ZeeGee) 的看法