|
楼主 |
发表于 2002-11-8 22:05:07
|
显示全部楼层
[quote:cc06e5ff79="mozilla"]你有没有改过Makefile文件??他怎么用/usr/include/linux/的头文件,用/usr/include/linux/的头文件是会出错的,应该用/lib/modules/2.4.xx-xx/build/include或
/usr/src/linux-2.4/include目录里的头文件.把你的Makefile的内容贴出来.
另外你用uname -r看看输出结果是什么(应该是当前内核的版本号)[/quote]
我并没有修改过Makefile文件,源文件如下:
# This Makefile is automatically generated; do not edit
# Generated on 'builder3' on Tue Aug 27 15:56:49 PDT 2002
LINUX_MODULE=Module-linux
DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -DRM_HEAPMGR -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=3123 -DNV_UNIX -DNV_LINUX -DNVCPU_X86
INCLUDES=-I.
OBJECTS=nv.o os-interface.o os-registry.o
HEADERS=os-interface.h nv-linux.h nv-misc.h nv.h nv-ids.h rmretval.h nvtypes.h nv_ref.h $(VERSION_HDR)
CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wcast-qual -Wno-multichar -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
RESMAN_KERNEL_MODULE=Module-nvkernel
KERNDIR=/lib/modules/$(shell uname -r)
# check for newer paths. if found, use them, otherwise use old paths
# these wouldn't work with the gnu make included with rh6.2
# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
# this is slightly more brain-dead, but works..
ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
KERNINC=$(KERNDIR)/build/include
else
KERNINC=/usr/src/linux/include
endif
ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
INSTALLDIR=$(KERNDIR)/kernel/drivers/video
else
INSTALLDIR=$(KERNDIR)/video
endif
ifeq ($(shell echo $(NVDEBUG)),1)
ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
RMDEBUG=1
endif
endif
ifeq ($(shell echo $(RMDEBUG)),1)
CFLAGS += -DDEBUG -g -fno-common
endif
# this is just plain wrong, get rid of it
BROKENDIR=$(KERNDIR)/kernel/video
INSTALL=$(shell which install)
# determine gcc versions used (kernel, NVdriver)
module_cc:=$(shell $(CC) -v 2>&1 | tail -1)
version="^Linux version [^(]* (.*@.*) (\(.*\)) .*"
kernel_cc:=$(shell cat /proc/version | sed "s/"$(version)"/\1/")
module_cc:=$(shell echo "$(module_cc)" | cut -d ' ' -f 3)
kernel_cc:=$(shell echo "$(kernel_cc)" | cut -d ' ' -f 3)
# allow specification of alternate include file tree on command line and extra defines
ifdef SYSINCLUDE
INCLUDES += -I$(SYSINCLUDE)
else
INCLUDES += -I$(KERNINC)
endif
DEFINES+=$(EXTRA_DEFINES)
# allow build parameters to be passed in through the environment
ifdef BUILD_PARAMS
DEFINES+=-D$(BUILD_PARAMS)
endif
VERSION_HDR=nv_compiler.h
all: install
install: package-install
package-install: NVdriver
@if [ `id -ur` != 0 ]; then \
echo Please run \"make install\" as root.; \
else \
if [ -d $(BROKENDIR) ]; then \
rm -f $(BROKENDIR)/NVdriver; \
rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
fi && \
mkdir -p $(INSTALLDIR) && \
$(INSTALL) -m 0664 -o root -g root NVdriver $(INSTALLDIR)/NVdriver$(O) && \
/sbin/depmod -a && \
/sbin/modprobe NVdriver && \
sh makedevices.sh && \
echo "NVdriver installed successfully."; \
fi
gcc-check:
@if [ -z $(IGNORE_CC_MISMATCH) ]; then \
if [ $(kernel_cc) != $(module_cc) ]; then \
echo " "; \
echo "You appear to be compiling the NVdriver kernel module with "; \
echo "a compiler different from the one that was used to compile "; \
echo "the running kernel. This may be perfectly fine, but there "; \
echo "are cases where this can lead to unexpected behaviour and "; \
echo "system crashes. "; \
echo " "; \
echo "If you know what you are doing and want to override this "; \
echo "check, you can do so by setting IGNORE_CC_MISMATCH. "; \
echo " "; \
echo "In any other case, set the CC environment variable to the "; \
echo "name of the compiler that was used to compile the kernel. "; \
echo " "; \
echo -en "\033[1;31m"; \
echo -e "*** Failed cc sanity check. Bailing out! ***"; \
echo -en "\033[0m"; \
exit 1; \
fi \
fi
NVdriver: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
size $@
$(VERSION_HDR):
echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" > $@
$(LINUX_MODULE): $(OBJECTS)
ld -r -o $@ $(OBJECTS)
%.o: %.c $(HEADERS)
$(CC) -c $(CFLAGS) $<
# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
%.i: %.c
$(CC) $(CFLAGS) -E $< > $@
%.s: %.c
$(CC) $(CFLAGS) -S $< > $@
clean:
$(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver
-include $(OBJECTS:%.o=%.d)
另外,uname -r输出的正是当前内核版本号 |
|