Bonjour
je cherche la procédure pour compiler un drivers sous linux.
Je possède une carte réseau DLINK DFE-530TX (et le drivers constructeur sous linux), dans le fichier txt il est dit que le drivers doit être compile pour qu’un fichier « rhinefet.o »
Je ne sais pas comment faire, faut il executer le fichier makefile ou le compiler et avec quoi ?
Merci de m’aider je suis débutant
J ai installe mandrake 10 avec les outils de développent, j ai besoin du drivers pour faire fonctionner une « mnf»
Fichier TXT
‘D-Link DFE-530TX PCI Fast Ethernet Adapter Installation
for Linux
v4.24 Jan. 2003
Introduction:
=============
The instructions listed below are for linux driver installation. You must
compile the source code to generate rhinefet.o and use insmod command to
insert rhinefet.o as module.
Contents of the Subdirectory:
=============================
linux.txt This file.
rhine_main.c The linux core driver source code file
rhine_proc.c The linux core driver source code file
rhine_wol.c The linux core driver source code file
rhine_drv.h The linux core dirver header file
rhine_wol.h The linux core driver header file
rhine_proc.h The linux core driver header file
rhine.h The linux core driver header file
Makefile Makefile for generating driver object file
rhine_vmns.c The vmns driver support source file
rhine_vmns.h The vmns driver support header file
rhine_cfg.h The vmns driver support header file
kcompat.h The linux core driver header file
Kernel Supported
================
This driver support linux kernel version 2.2.x and 2.4.x now.
Installation
============
Please enter the following commands at the UNIX prompt. Remember, UNIX is
case sensitive.
1) Create a temporary directory:
mkdir /temp
2) Change to the temporary directory:
cd /temp
2) Copy driver (dlkfet-4.24.tar.gz) from released CD, (If you didn't mount
CD drive before, you can type
'mkdir /cdrom'
'mount -r -t iso9660 -o conv=auto /dev/cdrom /cdrom' and use
'cp /cdrom/LINUX/dlkfet-4.24.tar.gz /temp'
command to copy the driver to the temporary directory):
cp /<cdrom_mount_point>/LINUX/dlkfet-4.24.tar.gz .
3) untar the archive file:
tar xzvf dlkfet-4.24.tar.gz
cd dlkfet-4.24
4) Compile the driver source files and it will generate rhinefet.o, and
copy it to correct driver installation path (The installation directory
is different in different kernel versions. In 2.4.x kernel, the path is
/lib/modules/KERNEL_VERSION/kernel/drivers/net/, and in 2.2.x kernel,
the path is /lib/modules/KERNEL_VERSION/net/, the KERNEL_VERSION (see
above) means the kernel version of your Linux distribution. If you don't
know your kernel version , please run 'uname -r' command in command
line. The kernel version will look like '2.2.16', '2.4.2-2smp' etc.) :
make install
5) Check configuration file (/etc/modules.conf or /etc/conf.modules,it
depend on your Linux distribution) for loading kernel modules. Make sure
there is the following content in the configuration file, where # is
interface number (eg: alias eth0 rhinefet):
alias eth# rhinefet
6) Reboot now:
shutdown -r now
7) Install your driver module (If the driver module is in the wrong place,
an error message will appear, and say that can't find the driver
module):
insmod rhinefet
Use ifconfig command to assign the IP address, where # is network
interface number:
ifconfig eth# <IP>
9) Check the interface works:
ping <remote_host_IP>
Uninstallation
==============
Please enter the following commands to uninstall your driver:
make uninstall
Note
====
1) Make sure the link file /usr/src/linux (or /usr/src/linux-2.4) is linked
to correctly kernel sources directory (eg: if you run 'uname -r', it
appears "2.4.2-2", then the link file must be linked to
/usr/src/linux-2.4.2 directory, or you will fail in compiling),
and make sure there are kernel header files in /usr/src/linux/include
directory (or /usr/src/linux-2.4/include), we need kernel header files
in compling.
2) If you can't install driver in SUSE Linux using insmod or modprobe
commands, and error messages appear (see below), please run 'uname -r'
in command line. And make sure the result of 'uname -r' (eg: 2.4.2-4GB)
is the same with the definition of UTS_RELEASE in
/usr/src/linux/include/linux/version.h. If not, please modify the
definition of UTS_RELEASE in /usr/src/linux/include/linux/version.h.
rhinefet.o: kernel-module version mismatch
rhinefet.o was compiled for kernel version 2.4.2
while this kernel is version 2.4.2-4GB.
3) Make sure that your kernel is built with network, fast_ethernet
and module support. Otherwise, you have to rebuild your kernel (see
below).
1. Go to /usr/src/linux (or /usr/src/linux-2.4) directory:
cd /usr/src/linux
2: Run 'make menuconfig' or 'make config' in text mode, or 'make
xconfig' in graphic mode.
3: Mark the options list above.
4: Exit and rebuild your kernel:
make dep;make clean;make bzImage
The file 'bzImage' will be at /usr/src/linux/arch/i386/boot/bzImage
5: Modify /etc/lilo.conf.(this file specifies where kernel image is)
6: Run 'lilo'
7: Reboot, and select the correct kernel image to boot your system.
4) You can use the utility (like netconfig, linuxconf) in your Linux
distribution to set your network parameters(like ip,gateway). These
parameters will be used at boot time. The following is the demonstration
to show how to use linuxconf (it's a utitlity in RedHat Linux 6.x) set
the network paramters.
1. Run linuxconf:
linuxconf
2. Enter setting in the Config/Networking/Client tasks/Basic host information/
and fill out the following information. Where 'xxx' is the IP address
what you have.
IP address: xxx.xxx.xxx.xxx
Netmask: 255.255.255.xxx
Net device: eth0
Kernel module: rhinefet
5) If you can't install driver at boot time.
If you can install your driver using insmod command, but you can't
install it at boot time, please check whether the driver is in the
correct directory (eg: /lib/modules/2.2.XXX/net/), and check the
/lib/modules/2.2.XXX/modules.dep file, it must include the following
line:
/lib/modules/2.2.XXX/net/rhinefet.o:
You can insert this line using depmod command or insert it manually.
Also, you must consult your Linux distribution installation guide
and learn how to set the IP address of your network interface and
up it at boot time.
6) If you can't compile this driver, and parse error messages appear,
please make sure your source code text format is right. You must convert
your source code text format from MS-DOS to UNIX, as show below (see
Solution 1 and 2).
Make sure the files in floppy disk are not dlkfet-4.24.tar.gz file. They
must be the source code text files (5 files), dlkfet-4.24.tar.gz is not
a text file, so it can't be converted.
Solution1:
If you use mcopy command to copy your driver from floppy disk to
linux, you can type:
mcopy -t a:\* .
then it will convert the format for you.
Solution2:
If you use mount command to mount floppy disk to linux, you can
type:
mount -t vfat -o conv=t /dev/fd0 /mnt/floppy
then, when you copy files from /mnt/floppy, these files format will
be right.
Module Parameter:
=================
The following parameters can be set when we install the driver module. You can add this parameters when
you execute 'insmod' or 'modprobe' command to install the driver (as below).
insmod rhinefet.o parameter=value1,value2,value3,...
For example, if you have 3 NIC cards, and you want to set the speed_duplex paramter value of them .
You can type the following command to set it.
insmod rhinefet.o speed_duplex=1,2,3
Then, the parameter value of first card will be 1 (100Mbps half duplex mode), the second card will
be 2 (100Mbps full duplex mode), and the third card will be 3 (10Mbps half duplex mode).
Remember, our driver only support 8 cards parameter setting.
1) speed_duplex
speed_duplex[] is used for setting the speed and duplex mode of NIC.
Value:
0: indicate autonegotiation for both speed and duplex mode (Default).
1: indicate 100Mbps half duplex mode
2: indicate 100Mbps full duplex mode
3: indicate 10Mbps half duplex mode
4: indicate 10Mbps full duplex mode
2) enable_tagging (For management adapter only)
enable_tagging[] is used for enabling VLAN ID setting and enabling
priority transmit.
Value:
0: disable VID setting and priority transmit (Default).
1: enable VID setting and priority transmit.
3) VID_setting (For management adapter only)
VID_setting[] is used for setting the VLAN ID of NIC.
Value:
0: default VID.
1-4094: other VIDs.
4) csum_offload (For management adapter only)
csum_offload[] is used for setting the checksum offload ability of NIC.
Value:
0: disable csum_offload (Default).
1: enable checksum offload. (We only support RX checksum offload now)
5) txcsum_offload (For management adapter only)
csum_offload[] is used for setting the checksum offload ability of NIC.
Value:
0: disable (default)
1: enable
6) flow_control
flow_control[] is used for setting the flow control ability of NIC.
Value:
1: hardware deafult (Default). Use Hardware default value in ANAR.
2: disable PAUSE in ANAR.
3: enable PAUSE in ANAR.
7) IP_byte_align
IP_byte_align[] is used for IP header DWORD byte aligned (For IPVS environment).
(In some enviroment, the IP header should be DWORD byte aligned,or the packet
will be droped when we receive it. (eg: IPVS))
Value:
0: indicate the IP header won't be DWORD byte aligned (Default).
1: indicate the IP header will be DWORD byte aligned.
tx_thresh
tx_thresh[] is used for controlling the transmit fifo threshold.
Value:
0: indicate the txfifo threshold is 128 bytes (Default).
1: indicate the txfifo threshold is 256 bytes.
2: indicate the txfifo threshold is 512 bytes.
3: indicate the txfifo threshold is 1024 bytes.
4: indicate that we use store and forward
9) rx_thresh
rx_thresh[] is used for controlling the receive fifo threshold.
Value:
0: indicate the rxfifo threshold is 64 bytes (Default).
1: indicate the rxfifo threshold is 32 bytes.
2: indicate the rxfifo threshold is 128 bytes.
3: indicate the rxfifo threshold is 256 bytes.
4: indicate the rxfifo threshold is 512 bytes.
5: indicate the rxfifo threshold is 768 bytes.
6: indicate the rxfifo threshold is 1024 bytes.
7: indicate that we use store and forward
10) DMA_length
DMA_length[] is used for controlling the DMA length.
Value:
0: 8 DWORDs
1: 16 DWORDs (Deafult)
2: 32 DWORDs
3: 64 DWORDs
4: 128 DWORDs
5: 256 DWORDs
6: SF(flush till emply)
7: SF(flush till emply)
Edition du fichier Makefile
DEBUG = 0
VMNS = 1
OBJS := rhine_main.o rhine_proc.o rhine_wol.o
SRC = rhine_main.c rhine_proc.c rhine_wol.c
TARGET = rhinefet.o
KSP := /lib/modules/$(shell uname -r)/build \
/usr/src/linux-$(shell uname -r) \
/usr/src/linux-$(shell uname -r | sed 's/-.*//') \
/usr/src/kernel-headers-$(shell uname -r) \
/usr/src/kernel-source-$(shell uname -r) \
/usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
/usr/src/linux
ifeq ($(VMNS),1)
OBJS+=rhine_vmns.o
SRC+=rhine_vmns.c
endif
test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))
KSRC := $(firstword $(KSP))
#KSRC :=/usr/src/ksrc/RedHat/7.2/linux-2.4.7-10alt-ent
ifeq (,$(KSRC))
$(error Linux kernel source not found)
endif
VERSION_FILE := $(KSRC)/include/linux/version.h
CONFIG_FILE := $(KSRC)/include/linux/config.h
ifeq (,$(wildcard $(VERSION_FILE)))
$(error Linux kernel source not configured - missing version.h)
endif
ifeq (,$(wildcard $(CONFIG_FILE)))
$(error Linux kernel source not configured - missing config.h)
endif
ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
CC := kgcc gcc cc
else
CC := gcc cc
endif
test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))
CC := $(foreach cc, $(CC), $(test_cc))
CC := $(firstword $(CC))
CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe
CFLAGS += -I$(KSRC)/include -I. -Wstrict-prototypes -fomit-frame-pointer
CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")
KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \
awk '{ print $$3 }' | sed 's/\"//g')
KERVER2=$(shell uname -r | cut -d. -f2)
.SILENT: $(TARGET) clean
ifeq ($(TARGET), rhinefet.o)
ifneq ($(KVER),$(shell uname -r))
$(warning ***)
$(warning *** Warning: kernel source version ($(KVER)))
$(warning *** does not match running kernel ($(shell uname -r)))
$(warning *** Continuing with build,)
$(warning *** resulting driver may not be what you want)
$(warning ***)
endif
endif
INSTDIR := $(shell find /lib/modules/$(KVER) -name $(TARGET) -printf "%h\n" | sort | head -1)
ifeq (,$(INSTDIR))
ifeq (,$(KERVER2))
ifneq (,$(wildcard /lib/modules/$(KVER)/kernel))
INSTDIR := /lib/modules/$(KVER)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(KVER)/net
endif
else
ifneq ($(KERVER2),2)
INSTDIR := /lib/modules/$(KVER)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(KVER)/net
endif
endif
endif
# look for SMP in config.h
SMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \
grep CONFIG_SMP | awk '{ print $$3 }')
ifneq ($(SMP),1)
SMP := 0
endif
ifeq ($(VMNS), 1)
CFLAGS += -DVMNS
endif
ifeq ($(DEBUG), 1)
CFLAGS += -DRHINE_DBG
endif
ifeq ($(TARGET), rhinefet.o)
ifneq ($(SMP),$(shell uname -a | grep SMP > /dev/null 2>&1 && echo 1 || echo 0))
$(warning ***)
ifeq ($(SMP),1)
$(warning *** Warning: kernel source configuration (SMP))
$(warning *** does not match running kernel (UP))
else
$(warning *** Warning: kernel source configuration (UP))
$(warning *** does not match running kernel (SMP))
endif
$(warning *** Continuing with build,)
$(warning *** resulting driver may not be what you want)
$(warning ***)
endif
endif
ifeq ($(SMP), 1)
CFLAGS += -D__SMP__
endif
$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
$(LD) -r $^ -o $@
echo; echo
echo "**************************************************"
echo "Build options:"
echo " VERSION $(KVER)"
echo -n " SMP "
if [ "$(SMP)" = "1" ]; \
then echo "Enabled"; else echo "Disabled"; fi
echo -n " VMNS "
if [ "$(VMNS)" = "1" ]; \
then echo "Enabled"; else echo "Disabled"; fi
echo "***************************************************"
install: clean $(TARGET)
mkdir -p $(MOD_ROOT)$(INSTDIR)
install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR)
@if [ -f $(MOD_ROOT)$(INSTDIR)/via-rhine.o ] ; then \
echo "***** Move official driver via-rhine.o to via-rhine.o.backup" ; \
echo "mv $(MOD_ROOT)$(INSTDIR)/via-rhine.o $(MOD_ROOT)$(INSTDIR)/via-rhine.o.backup";\
mv $(MOD_ROOT)$(INSTDIR)/via-rhine.o $(MOD_ROOT)$(INSTDIR)/via-rhine.o.backup ; \
echo ;\
fi ;
@if [ -f $(MOD_ROOT)$(INSTDIR)/linuxfet.o ] ; then \
echo "***** Move previous driver linuxfet.o to linuxfet.o.backup" ; \
echo "mv $(MOD_ROOT)$(INSTDIR)/linuxfet.o $(MOD_ROOT)$(INSTDIR)/linuxfet.o.backup";\
mv $(MOD_ROOT)$(INSTDIR)/linuxfet.o $(MOD_ROOT)$(INSTDIR)/linuxfet.o.backup ; \
echo ;\
fi ;
ifeq (,$(MOD_ROOT))
/sbin/depmod -a || true
else
/sbin/depmod -b $(MOD_ROOT) -a || true
endif
uninstall:
rm -f $(INSTDIR)/$(TARGET)
@if [ -f $(MOD_ROOT)$(INSTDIR)/via-rhine.o.backup ] ; then \
echo "***** Restore official driver vai-rhine.o from $(MOD_ROOT)$(INSTDIR)".; \
echo "mv $(MOD_ROOT)$(INSTDIR)/via-rhine.o.backup $(MOD_ROOT)$(INSTDIR)/via-rhine.o";\
mv $(MOD_ROOT)$(INSTDIR)/via-rhine.o.backup $(MOD_ROOT)$(INSTDIR)/via-rhine.o ;\
fi
/sbin/depmod -a
clean:
rm -f $(TARGET) $(SRC:.c=.o) *~
-include .depend.mak