Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
nvidia-drivers and kernel-4.0.0
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2176
Location: Near Toronto

PostPosted: Mon Apr 13, 2015 2:07 pm    Post subject: nvidia-drivers and kernel-4.0.0 Reply with quote

nvidia-drivers-340.76 (which I need because of an old 9600GT card)
does not install on new kernel-4.0.0

here's the errors in the build log:

Code:
/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.c:38:5: error: implicit declaration of function ‘read_cr4’ [-Werror=implicit-function-declaration]
     *cr4 = read_cr4();
     ^


/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.c:39:5: error: implicit declaration of function ‘write_cr4’ [-Werror=implicit-function-declaration]
     if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);


cc1: some warnings being treated as errors
/usr/src/linux-4.0.0-gentoo/scripts/Makefile.build:258: recipe for target '/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.o' failed
make[3]: *** [/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.o] Error 1


this is an unsupported kernel but I wonder if anyone has a patch ...
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
houtworm
Guru
Guru


Joined: 08 Mar 2003
Posts: 307
Location: Den Haag, Netherlands

PostPosted: Tue Apr 14, 2015 5:27 am    Post subject: Reply with quote

Same problem here, nvidia-drivers-340.76 because an older card.

There is a patch at https://devtalk.nvidia.com/default/topic/813458/linux-4-0-rc1-346-47-build-error-_cr4-functions-fix/ but it needs a little change because the file that should be patched could not be found.
So I changed it into:
Code:
--- a/kernel/nv-pat.c.orig
+++ b/kernel/nv-pat.c
@@ -35,8 +35,13 @@
     unsigned long cr0 = read_cr0();
     write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
     wbinvd();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
     *cr4 = read_cr4();
     if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
+#else
+    *cr4 = __read_cr4();
+    if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
+#endif
     __flush_tlb();
 }

@@ -46,7 +51,11 @@
     wbinvd();
     __flush_tlb();
     write_cr0((cr0 & 0x9fffffff));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
     if (cr4 & 0x80) write_cr4(cr4);
+#else
+    if (cr4 & 0x80) __write_cr4(cr4);
+#endif
 }

 static int nv_determine_pat_mode(void)


put it in /etc/portage/patches/x11-drivers/nvidia-drivers

So now I am running gentoo-4.0.0 :-)
_________________
niemand is onbekwamer, dan een timmerman zonder hamer

Kees
Back to top
View user's profile Send private message
prffzc
Tux's lil' helper
Tux's lil' helper


Joined: 22 Sep 2005
Posts: 97

PostPosted: Tue Apr 14, 2015 7:10 am    Post subject: Reply with quote

Thank you houtworm!

This worked for me too (older card also).
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2176
Location: Near Toronto

PostPosted: Tue Apr 14, 2015 12:59 pm    Post subject: Reply with quote

Quote:
Thank you houtworm!

This worked for me too (older card also).


ditto here; great work
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
Pryka
l33t
l33t


Joined: 08 Jun 2007
Posts: 632
Location: /dev/null

PostPosted: Thu Apr 16, 2015 5:52 pm    Post subject: Reply with quote

It's not working for me... :(

I wonder why... i have 9600GT and nvidia-drivers-340.76

After putting patch into /etc/portage/patches/x11-drivers/nvidia-drivers/kernel-4.0.0-patch, I still get this:
Code:
/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.c: In function ‘nv_disable_caches’:
/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.c:38:5: error: implicit declaration of function ‘read_cr4’ [-Werror=implicit-function-declaration]
     *cr4 = read_cr4();
     ^
/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.c:39:5: error: implicit declaration of function ‘write_cr4’ [-Werror=implicit-function-declaration]
     if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
     ^
In file included from /usr/src/linux-4.0.0/include/uapi/linux/stddef.h:1:0,
                 from /usr/src/linux-4.0.0/include/linux/stddef.h:4,
                 from /usr/src/linux-4.0.0/include/uapi/linux/posix_types.h:4,
                 from /usr/src/linux-4.0.0/include/uapi/linux/types.h:13,
                 from /usr/src/linux-4.0.0/include/linux/types.h:5,
                 from /usr/src/linux-4.0.0/include/uapi/linux/capability.h:16,
                 from /usr/src/linux-4.0.0/include/linux/capability.h:15,
                 from /usr/src/linux-4.0.0/include/linux/sched.h:15,
                 from /usr/src/linux-4.0.0/include/linux/utsname.h:5,
                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-linux.h:44,
                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-procfs.c:15:
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h: In function ‘copy_from_user’:
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h:712:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (likely(sz < 0 || sz >= n))
                          ^
/usr/src/linux-4.0.0/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’
 # define likely(x) __builtin_expect(!!(x), 1)
                                        ^
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h: In function ‘copy_to_user’:
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h:730:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (likely(sz < 0 || sz >= n))
                          ^
/usr/src/linux-4.0.0/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’
 # define likely(x) __builtin_expect(!!(x), 1)
                                        ^
In file included from /usr/src/linux-4.0.0/include/uapi/linux/stddef.h:1:0,
                 from /usr/src/linux-4.0.0/include/linux/stddef.h:4,
                 from /usr/src/linux-4.0.0/include/uapi/linux/posix_types.h:4,
                 from /usr/src/linux-4.0.0/include/uapi/linux/types.h:13,
                 from /usr/src/linux-4.0.0/include/linux/types.h:5,
                 from /usr/src/linux-4.0.0/include/uapi/linux/capability.h:16,
                 from /usr/src/linux-4.0.0/include/linux/capability.h:15,
                 from /usr/src/linux-4.0.0/include/linux/sched.h:15,
                 from /usr/src/linux-4.0.0/include/linux/utsname.h:5,
                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-linux.h:44,
                 from /var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-usermap.c:15:
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h: In function ‘copy_from_user’:
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h:712:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (likely(sz < 0 || sz >= n))
                          ^
/usr/src/linux-4.0.0/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’
 # define likely(x) __builtin_expect(!!(x), 1)
                                        ^
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h: In function ‘copy_to_user’:
/usr/src/linux-4.0.0/arch/x86/include/asm/uaccess.h:730:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (likely(sz < 0 || sz >= n))
                          ^
/usr/src/linux-4.0.0/include/linux/compiler.h:163:40: note: in definition of macro ‘likely’
 # define likely(x) __builtin_expect(!!(x), 1)
                                        ^
cc1: some warnings being treated as errors
/usr/src/linux-4.0.0/scripts/Makefile.build:258: recipe for target '/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.o' failed
make[3]: *** [/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel/nv-pat.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/usr/src/linux-4.0.0/Makefile:1390: recipe for target '_module_/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel' failed
make[2]: *** [_module_/var/tmp/portage/x11-drivers/nvidia-drivers-340.76/work/kernel] Error 2
make[2]: Leaving directory '/usr/src/linux-4.0.0'
Makefile:145: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-4.0.0'
NVIDIA: left KBUILD.
nvidia.ko failed to build!
Makefile:181: recipe for target 'nvidia.ko' failed
make: *** [nvidia.ko] Error 1
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2176
Location: Near Toronto

PostPosted: Thu Apr 16, 2015 6:05 pm    Post subject: Reply with quote

are you sure the patch is being applied?

shots in the dark:

patch file needs to be of form xxxxx.patch ?

blank space at end of each line of patch (this has bit me) ?
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
Pryka
l33t
l33t


Joined: 08 Jun 2007
Posts: 632
Location: /dev/null

PostPosted: Thu Apr 16, 2015 6:22 pm    Post subject: Reply with quote

Wrong patch name, and after that blank space xD

Thx. :D
Back to top
View user's profile Send private message
gentoosapien
n00b
n00b


Joined: 15 May 2015
Posts: 2

PostPosted: Fri May 15, 2015 10:05 pm    Post subject: Reply with quote

:( what's wrong with me?!

Code:
Failed Patch: linux-4.0.patch !
 *  ( /etc/portage/patches//x11-drivers/nvidia-drivers-340.76/linux-4.0.patch )


Code:
 * Call stack:
 *     ebuild.sh, line   93:  Called pre_src_prepare
 *        bashrc, line    7:  Called epatch_user
 *   environment, line 1732:  Called epatch
 *   environment, line 1705:  Called die
 * The specific snippet of code:
 *               die "Failed Patch: ${patchname}!";


Quote:
albrigth:
blank space at end of each line of patch (this has bit me) ?

double check!

Can somebody help me?! btw, did someone tried with kernel-4.0.3?
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2176
Location: Near Toronto

PostPosted: Fri May 15, 2015 11:46 pm    Post subject: Reply with quote

Quote:
an somebody help me?! btw, did someone tried with kernel-4.0.3?


yes, it worked for me ...

But - strangely - it failed the first time, installed correctly the second time :?
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
gentoosapien
n00b
n00b


Joined: 15 May 2015
Posts: 2

PostPosted: Sat May 16, 2015 2:11 pm    Post subject: Reply with quote

I'v patched the file by hand - the patch from /etc/portage/patch... doesn't applied by user epatch
Quote:
"Failed Patch: ${patchname}!


The Patch works also with kernel 4.0.3 - Thanks a lot for this!
Back to top
View user's profile Send private message
gienah
Developer
Developer


Joined: 24 Nov 2010
Posts: 161
Location: AU

PostPosted: Wed May 20, 2015 1:23 pm    Post subject: Reply with quote

In case there are problems with copy/pasting the patch, I have tar'd up the patches that I use on my system running
kernel 4.0.4-hardened-r1 with x11-drivers/nvidia-drivers-340.76 here:

http://dev.gentoo.org/~gienah/unsupported/etc-portage-patches-x11-drivers-nvidia-drivers-340.76-for-kernel-gt-3.14.tar.gz

to extract, as root:
Code:
cd /
tar xvf etc-portage-patches-x11-drivers-nvidia-drivers-340.76-for-kernel-gt-3.14.tar.gz

If you are not running a hardened kernel then the pax patch can be removed:
Code:
rm /etc/portage/patches/x11-drivers/nvidia-drivers-340.76/nvidia-drivers-331.49-pax-uvm.patch
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum