Bug#815986: nvidia-kernel-dkms:amd64: does not build for x86_64 kernel on i386 userspace

Tomas Janousek tomi at nomi.cz
Sat Feb 27 14:43:31 UTC 2016


Hi,

On Sat, Feb 27, 2016 at 04:08:12AM +0100, Andreas Beckmann wrote:
> On 2016-02-26 18:21, Andreas Beckmann wrote:
> > I tried a patch (in svn, but disabled) that adds KBUILD_CFLAGS to
> > NV_CONFTEST_CFLAGS, but that already makes the build fail. (I didn't
> > even think about testing 32/64 bit mixtures).
> 
> OK, I got it working for 355.11:
> * ignore -Werror* flags from KBUILD_CFLAGS to not break conftest.sh
> * use LDFLAGS to pass the correct architecture

Great, thanks!

> In a sid i386 chroot with foreign architecture amd64 I installed
> linux-headers-4.3.*-amd64:amd64 and nvidia-kernel-source:amd64 and
> successfully built a 355.11 module package.
> 
> Now let's get this backported to 352.xx and 340.xx, help would be
> appreciated.

I'm attaching a patch that makes the 352.79-3 build and another one that uses
just the -m% options from KBUILD_CFLAGS, which seems to better match the
"allows building a amd64 kernel module with i386 user space" description. I'm
not entirely sure it's better than just using KBUILD_CFLAGS minus -Werror, but
thought I might as well share the idea. Both build well.

-- 
Tomáš Janoušek, a.k.a. Pivník, a.k.a. Liskni_si, http://work.lisk.in/
-------------- next part --------------
diff --git a/nvidia-modules-common.mk b/nvidia-modules-common.mk
index 726e90a..ca4d825 100644
--- a/nvidia-modules-common.mk
+++ b/nvidia-modules-common.mk
@@ -97,6 +97,7 @@ endif
 CONFTEST := /bin/sh $(src)/conftest.sh "$(CC)" "$(HOST_CC)" $(ARCH) $(KERNEL_SOURCES) $(KERNEL_OUTPUT)
 
 CONFTEST_CFLAGS := $(shell $(CONFTEST) build_cflags)
+CONFTEST_CFLAGS += $(filter-out -Werror%,$(KBUILD_CFLAGS))
 
 KERNEL_UNAME ?= $(shell $(CONFTEST) get_uname)
 MODULE_ROOT := /lib/modules/$(KERNEL_UNAME)/kernel/drivers
-------------- next part --------------
diff --git a/nvidia-modules-common.mk b/nvidia-modules-common.mk
index 726e90a..324ebde 100644
--- a/nvidia-modules-common.mk
+++ b/nvidia-modules-common.mk
@@ -97,6 +97,7 @@ endif
 CONFTEST := /bin/sh $(src)/conftest.sh "$(CC)" "$(HOST_CC)" $(ARCH) $(KERNEL_SOURCES) $(KERNEL_OUTPUT)
 
 CONFTEST_CFLAGS := $(shell $(CONFTEST) build_cflags)
+CONFTEST_CFLAGS += $(filter -m%,$(KBUILD_CFLAGS))
 
 KERNEL_UNAME ?= $(shell $(CONFTEST) get_uname)
 MODULE_ROOT := /lib/modules/$(KERNEL_UNAME)/kernel/drivers


More information about the pkg-nvidia-devel mailing list