Linux 15.070 Themen, 107.540 Beiträge

Treiber-Kompilierung für Netzwerkkarte unter Debian Woody

gerfield / 2 Antworten / Baumansicht Nickles

Hi,

ich habe folgendes Problem: Ich möchte einen Debian Woody-PC mit einer Netzwerkkarte von Allnet mit Via-Chipsatz ausstatten. Dieser liegt auch eine Diskette mir Treiber und Anleitung für Linux bei (s. unten). Nach dieser Anleitung soll man nun das Verzeichnis entpacken (das habe ich geschafft :D) und den Treiber kompilieren. Wie soll ich das machen? Es liegt zwar ein "Makefile" drin, aber das gibt folgende Fehlermeldung aus:

pserver:/temp/rhinefet# ./Makefile
./Makefile: VMNS: command not found
./Makefile: OBJS: command not found
./Makefile: SRC: command not found
./Makefile: TARGET: command not found
./Makefile: shell: command not found
./Makefile: shell: command not found
./Makefile: shell: command not found
./Makefile: shell: command not found
./Makefile: shell: command not found
./Makefile: shell: command not found
./Makefile: KSP: command not found
./Makefile: line 16: syntax error near unexpected token \'($(VMNS),1)\'
./Makefile: line 16: \'ifseq ($(VMNS,1)\'
pserver:/temp/rhinefet#



Nun die Anleitung:



**
**
** VIA Rhine Family Fast Ethernet Adapter
**
** Linux Driver
**
** v4.20 Aug. 2002
**
**


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.
rhinefet.h The linux core driver header file
rhinefet.c The linux core driver source code 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
vmns_drv.h The vmns driver support 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 (rhinefet.tgz) from DOS disk, (mcopy below is one tool in
mtools, if you didn\'t install mtools, you can type
\'mount -t msdos /dev/fd0 /mnt\' and use \'cp /mnt/rhinefet.tgz /temp\'
command to copy the driver to the temporary directory):
mcopy a:rhinefet.tgz .

3) untar the archive file:

tar xzvf rhinefet.tgz
cd rhinefet

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

8) Use ifconfig command to assign the IP address, where # is network
interface number:
ifconfig eth#



Und das steht in der Datei "Makefile":


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 ($(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







Ich als Anfänger weiß nicht mehr weiter. Hoffe ihr könnt mir helfen. Schon mal Danke im vorraus!
GrußgerfieldIn a world without walls and fenceswho needs Windows and Gates?
bei Antwort benachrichtigen
Pashka gerfield „Treiber-Kompilierung für Netzwerkkarte unter Debian Woody“
Optionen
Kernel Supported
================
This driver support linux kernel version 2.2.x and 2.4.x now.

------------------------------------------------------------------------------------
Welchen Kernel hast du, nicht zufällig 2.6x ?

MfG
Pashka
bei Antwort benachrichtigen
gerfield Nachtrag zu: „Treiber-Kompilierung für Netzwerkkarte unter Debian Woody“
Optionen

Hi,

an alle Leute eine Erklärung, was ich nun mit Hilfe von KarstenW und zaphod herrausgefunden habe:

Um die Datei "rhinefet.o" zu erzeugen, wird nicht "./Makefile" ausgeführt, sondern einfach nur "make". Das Makefile ist nur für die Koordination des make-Abläufes zuständig. Ich hatte aber noch weiterhin das Problem, dass er bei "make" nicht die Kernel-Sourcen findet, diese müssen nach installiert werden. Mit "apt-cdrom (add)" oder "apt-setup" die CD-Roms einlesen lassen und dann mit "apt-get install kernel-sourcexxxxxxxx" installieren. Danach funktioniert make und die Treiberdatei wird erzeugt. Alles weitere steht in der Anleitung (weiter oben).

Mein Problem ist nun aber, dass meine Festplatte (da nur Prinserver und mit 270MB + 60MB Swap bestückt) voll ist und ich erst eine neue kaufen muss. Dann geht es weiter ................... wünscht mir Glück.

GrußgerfieldIn a world without walls and fenceswho needs Windows and Gates?
bei Antwort benachrichtigen