[pkg-nvidia-devel] Work towards 2.6.29 support.
Lennart Sorensen
lsorense at csclub.uwaterloo.ca
Tue Mar 31 20:45:26 UTC 2009
On Mon, Mar 30, 2009 at 01:56:38PM -0700, Randall Donald wrote:
> On Sat, 2009-03-28 at 12:02 -0400, Lennart Sorensen wrote:
> > On Fri, Mar 27, 2009 at 04:47:41PM -0700, Randall Donald wrote:
> > > Oh Good. I was thinking of maybe upgrading to 180.41 as well but as you
> > > have it compiling with 180.29 we can leave that til another day.
> >
> > Well I checked if nvidia had a newer release yet, but I could only find
> > 180.29, so I didn't persue that.
> >
>
> Well I tried your edits with 180.41 and 2.6.29-1-amd64 and it wouldn't
> compile. Something about agp errors which I don't believe is any issue
> with your changes. Did you get your module to run?
I did a lot more work, and I am now runnign 2.6.29 with 180.29. Turns out
even nvidia's conftest.sh is incomplete. it is also now incompatible with
the linux headers, so I replaced it with a much better (in my opinion)
kbuild compatible system instead.
Here is the main part, which is a conftest.h file. conftest.sh is to
be removed since we no longer need it and in fact have no desire to
generate conftest.h anymore, since the conftest.sh doesn't work with
the kbuild only headers files we now have to deal with.
I have not fixed the hardcoded i386 thing yet.
I should have a complete patch ready pretty soon.
Here is what I currently have done in the /usr/src/modules/nvidia-kernel:
Move everything current (except debian) to nv subdir
New file debian/compat:
5
Updated file debian/rules:
#!/usr/bin/make -f
CFLAGS = -Wall -g
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
# Prefix of the target package name
PACKAGE = nvidia-kernel
-include /usr/share/modass/include/generic.make
-include /usr/share/modass/include/common-rules.make
configure:
binary-modules:
dh_testroot
sed 's/#KVERS#/$(KVERS)/g' debian/control.template > $(CURDIR)/debian/control
sed 's/#KVERS#/$(KVERS)/g' debian/dirs.template > $(CURDIR)/debian/dirs
sed 's/#KVERS#/$(KVERS)/g' debian/override.template > $(CURDIR)/debian/override
dh_prep
# Build the modules
$(MAKE) -C nv LINUXDIR=$(KSRC) KVERREL=$(KVERS)
# Install the modules
dh_installdirs
install -m 0644 $(CURDIR)/debian/override $(CURDIR)/debian/nvidia-kernel-$(KVERS)/usr/share/lintian/overrides/nvidia-kernel-$(KVERS)
install -m 0644 $(CURDIR)/nv/nvidia.ko $(CURDIR)/debian/nvidia-kernel-$(KVERS)/lib/modules/$(KVERS)/nvidia/nvidia.ko ; \
dh_installdocs
dh_installmodules
dh_installchangelogs
dh_installmodules
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
dh_builddeb --destdir=$(KPKG_DEST_DIR)
dh_prep
clean: unpatch
if [ -f $(CURDIR)/debian/control.template ]; then \
cp $(CURDIR)/debian/control.template $(CURDIR)/debian/control; \
fi
dh_testroot
rm -f build-stamp configure-stamp
$(MAKE) clean SYSSRC=$(KSRC) -C $(CURDIR)/$(dirname) -f Makefile $(KPKG_EXTRAV_ARG)
-rm $(CURDIR)/$(dirname)/gcc-check
-rm $(CURDIR)/$(dirname)/cc-sanity-check
-dh_clean
-rm $(CURDIR)/debian/control
-rm $(CURDIR)/debian/dirs
-rm $(CURDIR)/debian/override
unpatch:
if [ -e patch-stamp ]; then \
dpatch deapply-all ; \
rm -rf patch-stamp debian/patched ; \
fi
# The kdist_configure target is called by make-kpkg modules_config. It
# should configure the module so it is ready for compilation (mostly
# useful for calling configure)
kdist_config kdist_configure:
$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules configure
# the kdist_clean target is called by make-kpkg modules_clean. It is
# responsible for cleaning up any changes that have been made by the
# other kdist_commands (except for the .deb files created).
kdist_clean:
$(MAKE) -C nv LINUXDIR=$(KSRC) KVERREL=$(KVERS) clean
dh_clean
.PHONY: clean binary-modules
New file nv/Makefile:
# Makefile -- For the nvidia module
#
# By default, the build is done against the running linux kernel source.
# To build against a different kernel source tree, set LINUXDIR:
#
# make LINUXDIR=/path/to/kernel/source
SHELL=/bin/sh
.SUFFIXES:
ifndef LINUXDIR
RUNNING_REL := $(shell uname -r)
LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \
echo /lib/modules/$(RUNNING_REL)/source; \
else echo /lib/modules/$(RUNNING_REL)/build; fi)
endif
ifndef O
O := $(shell if [ -e /lib/modules/$(RUNNING_REL)/build ]; then \
echo /lib/modules/$(RUNNING_REL)/build; \
else echo ""; fi)
#O := $(LINUXDIR)
endif
ifdef ARCH
MACHINE := $(ARCH)
else
MACHINE := $(shell uname -m)
endif
# Modules for all architectures
MODULE_LIST := nvidia.o
CLEANFILES = *.o *.ko .depend .*.flags .*.d .*.cmd *.mod.c .tmp_versions
# VERSION is not defined from the initial invocation. It is defined when
# this Makefile is invoked from the kernel's root Makefile.
ifndef VERSION
ifdef RUNNING_REL
# SuSE has the version.h and autoconf.h headers for the current kernel
# in /boot as /boot/vmlinuz.version.h and /boot/vmlinuz.autoconf.h.
# Check these first to see if they match the running kernel.
BOOTVERSION_PREFIX = /boot/vmlinuz.
V := $(shell if [ -f $(BOOTVERSION_PREFIX)version.h ]; then \
grep UTS_RELEASE $(BOOTVERSION_PREFIX)version.h | \
cut -d' ' -f3; fi)
ifeq ($(V),"$(RUNNING_REL)")
HEADERFROMBOOT := 1
GETCONFIG := MAKEFILES=$(shell /bin/pwd)/.config
HAVECONFIG := y
endif
# On Red Hat we need to check if there is a .config file in the kernel
# source directory. If there isn't, we need to check if there's a
# matching file in the configs subdirectory.
ifneq ($(HAVECONFIG),y)
HAVECONFIG := $(shell if [ -e $(LINUXDIR)/.config ]; then echo y; fi)
endif
ifneq ($(HAVECONFIG),y)
REL_BASE := $(shell echo $(RUNNING_REL) | sed 's/-.*//')
REL_TYPE := $(shell echo $(RUNNING_REL) | sed 's/[0-9.-]//g')
ifeq ($(REL_TYPE),)
RHCONFIG := configs/kernel-$(REL_BASE)-$(MACHINE).config
else
RHCONFIG := configs/kernel-$(REL_BASE)-$(MACHINE)-$(REL_TYPE).config
endif
HAVECONFIG := $(shell if [ -e $(LINUXDIR)/$(RHCONFIG) ]; then echo y; fi)
ifneq ($(HAVECONFIG),y)
RHCONFIG :=
endif
endif
ifneq ($(HAVECONFIG),y)
ifneq ($(0),$(LINUXDIR))
GETCONFIG += O=$(O)
endif
HAVECONFIG := $(shell if [ -e $(O)/.config ]; then echo y; fi)
endif
ifneq ($(HAVECONFIG),y)
$(error Cannot find a kernel config file)
endif
endif
CLEANCONFIG := $(shell if cmp -s $(LINUXDIR)/.config .config; then echo y; fi)
ifeq ($(CLEANCONFIG),y)
CLEANFILES += $(LINUXDIR)/.config .config $(LINUXDIR)/tmp_include_depends
endif
all: modules
modules: includes
+ln -sf nv-kernel.o.i386 nv-kernel.o
+make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`/bin/pwd` NVSRCDIR=`/bin/pwd` modules
ifeq ($(HEADERFROMBOOT),1)
BOOTHEADERS = version.h autoconf.h
BOOTCONFIG = .config
CLEANFILES += $(BOOTHEADERS) $(BOOTCONFIG)
includes:: $(BOOTHEADERS) $(BOOTCONFIG)
version.h: $(BOOTVERSION_PREFIX)version.h
rm -f $@
ln -s $< $@
autoconf.h: $(BOOTVERSION_PREFIX)autoconf.h
rm -f $@
ln -s $< $@
.config: $(BOOTVERSION_PREFIX)config
rm -f $@
ln -s $< $@
endif
# This prepares an unused Red Hat kernel tree for the build.
ifneq ($(RHCONFIG),)
includes:: $(LINUXDIR)/.config $(LINUXDIR)/tmp_include_depends .config
$(LINUXDIR)/.config: $(LINUXDIR)/$(RHCONFIG)
rm -f $@
ln -s $< $@
.config: $(LINUXDIR)/$(RHCONFIG)
rm -f $@
ln -s $< $@
$(LINUXDIR)/tmp_include_depends:
echo all: > $@
endif
clean cleandir:
rm -rf $(CLEANFILES)
$(MODULE_LIST)::
make modules
install:
make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`/bin/pwd` NVSRCDIR=`/bin/pwd` modules_install
else
# Check for kernel versions that we don't support.
BELOW26 := $(shell if [ $(VERSION) -lt 2 -o $(PATCHLEVEL) -lt 6 ]; then \
echo y; fi)
ifeq ($(BELOW26),y)
$(error Only 2.6.x and later kernels are supported \
($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)))
endif
# This needs to go before all other include paths.
CC += -I$(NVSRCDIR)
include $(NVSRCDIR)/Makefile.kbuild
endif
.PHONY: includes
New file nv/conftest.h:
/* Implement conftest.sh function remap_page_range */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define NV_REMAP_PAGE_RANGE_PRESENT
#define NV_REMAP_PAGE_RANGE_ARGUMENT_COUNT 4
#else
#define NV_REMAP_PAGE_RANGE_PRESENT
#define NV_REMAP_PAGE_RANGE_ARGUMENT_COUNT 5
#endif
#else
#undef NV_REMAP_PAGE_RANGE_PRESENT
#endif
/* Implement conftest.sh function set_pages_uc */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
#ifdef NV_CHANGE_PAGE_ATTR_PRESENT
#undef NV_CHANGE_PAGE_ATTR_PRESENT
#endif
#define NV_SET_PAGES_UC_PRESENT
#else
#undef NV_SET_PAGES_UC_PRESENT
#endif
/* Implement conftest.sh function change_page_attr */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && \
LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
#ifndef NV_SET_PAGES_UC_PRESENT
#define NV_CHANGE_PAGE_ATTR_PRESENT
#endif
#else
#undef NV_CHANGE_PAGE_ATTR_PRESENT
#endif
/* Implement conftest.sh function pci_get_class */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
#define NV_PCI_GET_CLASS_PRESENT
#else
#undef NV_PCI_GET_CLASS_PRESENT
#endif
/* Implement conftest.sh function remap_pfn_range */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
#define NV_REMAP_PFN_RANGE_PRESENT
#else
#undef NV_REMAP_PFN_RANGE_PRESENT
#endif
/* Implement conftest.sh function signal_struct */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
#define NV_SIGNAL_STRUCT_HAS_RLIM
#else
#undef NV_SIGNAL_STRUCT_HAS_RLIM
#endif
/* Implement conftest.sh function agp_backend_acquire */
/* Only kernels sometime before 2.4.0 don't have this function, and who */
/* cares anymore */
#define NV_AGP_BACKEND_ACQUIRE_PRESENT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
#define NV_AGP_BACKEND_ACQUIRE_ARGUMENT_COUNT 1
#else
#define NV_AGP_BACKEND_ACQUIRE_ARGUMENT_COUNT 0
#endif
/* Implement conftest.sh function vmap */
/* I can not find any released kernel that uses the 2 argument variant */
/* of vmap */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)
#define NV_VMAP_PRESENT
#define NV_VMAP_ARGUMENT_COUNT 4
#else
#undef NV_VMAP_PRESENT
#endif
/* Implement conftest.sh function i2c_adapter */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define NV_I2C_ADAPTER_HAS_INC_USE
#define NV_I2C_ADAPTER_HAS_DEC_USE
#else
#undef NV_I2C_ADAPTER_HAS_INC_USE
#undef NV_I2C_ADAPTER_HAS_DEC_USE
#endif
/* Implement conftest.sh function sysctl_max_map_count */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5)
#define NV_SYSCTL_MAX_MAP_COUNT_PRESENT
#else
#undef NV_SYSCTL_MAX_MAP_COUNT_PRESENT
#endif
/* Implement conftest.sh function pm_message_t */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
#define NV_PM_MESSAGE_T_PRESENT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
#define NV_PM_MESSAGE_T_HAS_EVENT
#else
#undef NV_PM_MESSAGE_T_HAS_EVENT
#endif
#else
#undef NV_PM_MESSAGE_T_PRESENT
#endif
/* Implement conftest.sh function pci_choose_state */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
#define NV_PCI_CHOOSE_STATE_PRESENT
#else
#undef NV_PCI_CHOOSE_STATE_PRESENT
#endif
/* Implement conftest.sh function vm_insert_page */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
#define NV_VM_INSERT_PAGE_PRESENT
#else
#undef NV_VM_INSERT_PAGE_PRESENT
#endif
/* Implement conftest.sh function irq_handler_t */
/* I can not find any released kernel that uses the 3 argument variant */
/* of irq_handler_t */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
#define NV_IRQ_HANDLER_T_PRESENT
#define NV_IRQ_HANDLER_T_ARGUMENT_COUNT 2
#else
#undef NV_IRQ_HANDLER_T_PRESENT
#endif
/* Implement conftest.sh function acpi_device_ops */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) && \
LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
#define NV_ACPI_DEVICE_OPS_HAS_MATCH
#else
#undef NV_ACPI_DEVICE_OPS_HAS_MATCH
#endif
/* Implement conftest.sh function acpi_device_id */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
#define NV_ACPI_DEVICE_ID_HAS_DRIVER_DATA
#else
#undef NV_ACPI_DEVICE_ID_HAS_DRIVER_DATA
#endif
/* Implement conftest.sh function acquire_console_sem */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10)
#define NV_ACQUIRE_CONSOLE_SEM_PRESENT
#else
#undef NV_ACQUIRE_CONSOLE_SEM_PRESENT
#endif
/* Implement conftest.sh function kmem_cache_create */
/* Only kernels sometime before 2.4.0 don't have this function, and who */
/* cares anymore */
#define NV_KMEM_CACHE_CREATE_PRESENT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
#define NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT 5
#else
#define NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT 6
#endif
/* Implement conftest.sh function smp_call_function */
/* Only kernels sometime before 2.4.0 don't have this function, and who */
/* cares anymore */
#define NV_SMP_CALL_FUNCTION_PRESENT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
#define NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT 3
#else
#define NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT 4
#endif
/* Implement conftest.sh function on_each_cpu */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define NV_ON_EACH_CPU_PRESENT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
#define NV_ON_EACH_CPU_ARGUMENT_COUNT 3
#else
#define NV_ON_EACH_CPU_ARGUMENT_COUNT 4
#endif
#else
#undef NV_ON_EACH_CPU_PRESENT
#endif
/* Implement conftest.sh function acpi_evaluate_interger */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
#define NV_ACPI_EVALUATE_INTEGER_PRESENT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
typedef unsigned long long nv_acpi_integer_t;
#else
typedef unsigned long nv_acpi_integer_t;
#endif
#else
#undef NV_ON_EACH_CPU_PRESENT
typedef unsigned long nv_acpi_integer_t;
#endif
/* Implement conftest.sh function ioremap_wc */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
#define NV_IOREMAP_WC_PRESENT
#else
#undef NV_IOREMAP_WC_PRESENT
#endif
/* Check for linux/semaphore.h */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
#define NV_LINUX_SEMAPHORE_H_PRESENT
#else
#undef NV_LINUX_SEMAPHORE_H_PRESENT
#endif
/* Check for linux/cred.h */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
#define NV_LINUX_CRED_H_PRESENT
#else
#undef NV_LINUX_CRED_H_PRESENT
#endif
Rename file nv/nv-kernel.o to nv/nv-kernel.o.i386
Removed file nv/conftest.sh
Removed file nv/makefile
Removed file debian/conf.mk
So as I said, I am now running on 2.6.29-1-686 kernel with 180.29
nvidia module.
--
Len Sorensen
More information about the Pkg-nvidia-devel
mailing list