Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
nVidia 'invalid module format' fix for new kernels (script)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
hollywoodb
Apprentice
Apprentice


Joined: 05 Nov 2003
Posts: 259
Location: MN, U.S.A.

PostPosted: Wed May 05, 2004 9:02 pm    Post subject: nVidia 'invalid module format' fix for new kernels (script) Reply with quote

If you've emerged nvidia-kernel with a newer (>=2.6.5) kernel, this script should take care of it for you.

There is also a patch available for this, but I've had problems patching some sources, and some people have had trouble applying the patch themselves.

This script does NOT patch anything. It backs up the unpatched files, replaces them with the patched ones, then restores the backups again. It also emerges nvidia-kernel for you. It should leave no trace in the kernel source directory.

THIS SCRIPT WILL NOT WORK UNLESS YOU HAVE ALREADY COMPILED YOUR KERNEL. (actually emerging nvidia-kernel won't work if you have not yet compiled the kernel you wish to emerge nvidia-kernel against).

Also, /usr/src/linux must point to the kernel you wish to emerge nvidia-kernel against.

The script should run out of any directory, but I recommend running it out of /root/.

Simply extract the archive (tar -zxpf nvidia-kernel_fixed.tar.gz).
It will create a script file and another tar file (prepatched.tar.gz).
Then run the script as you would any other (/path/to/script or if you are in the directory, ./<scriptfile>)

Here is the actual code of the script, it uses very basic commands and should be understandable by anyone. The only real special thing this tarball contains is the prepatched files. It is quite easy to also do this by hand.

Code:

#! /bin/sh

# extract the prepatched files
tar -zxpf prepatched.tar.gz

# make backups of unpatched files that are to be replaced
cp /usr/src/linux/include/linux/module.h /usr/src/linux/include/linux/module.h.backup
cp /usr/src/linux/scripts/Makefile.modpost /usr/src/linux/scripts/Makefile.modpost.ba
ckup
cp /usr/src/linux/scripts/modpost.c /usr/src/linux/scripts/modpost.c.backup

# replace unpatched files with patched files
cp module.h /usr/src/linux/include/linux/module.h
cp Makefile.modpost /usr/src/linux/scripts/Makefile.modpost
cp modpost.c /usr/src/linux/scripts/modpost.c

# emerge nvidia-kernel
emerge nvidia-kernel

# restore unpatched files from backups
mv /usr/src/linux/include/linux/module.h.backup /usr/src/linux/include/linux/module.h
mv /usr/src/linux/scripts/Makefile.modpost.backup /usr/src/linux/scripts/Makefile.mod
post
mv /usr/src/linux/scripts/modpost.c.backup /usr/src/linux/scripts/modpost.c

# say all done
echo "All Done!"



I will not be held responsible for any negative effects this script may have on your system (although I can't think of anything that could go wrong).

Script can be found here:
http://hollywoodb.netfirms.com/nvidia-kernel_fixed.tar.gz

If NetFirms won't let you download it using that link, go through this page:
http://hollywoodb.netfirms.com/nvidia.html

NetFirms can be a real pita, mirrored again here:
http://www.geocities.com/hollywoodbungalow/nvidia-kernel_fixed.tar.gz

I would be happy to accept some dev.gentoo.org webspace, since my amazing scripting capabilities are so evident with the script above ;)


Last edited by hollywoodb on Wed May 12, 2004 12:52 am; edited 3 times in total
Back to top
View user's profile Send private message
dsd
Developer
Developer


Joined: 30 Mar 2003
Posts: 2162
Location: nr London

PostPosted: Wed May 05, 2004 9:08 pm    Post subject: Reply with quote

another approach would be to try the ebuilds i have posted on bug 48030...
they could do with some extra testing ;)
_________________
http://dev.gentoo.org/~dsd
Back to top
View user's profile Send private message
hollywoodb
Apprentice
Apprentice


Joined: 05 Nov 2003
Posts: 259
Location: MN, U.S.A.

PostPosted: Wed May 05, 2004 9:13 pm    Post subject: Reply with quote

wasn't aware they existed :)
I'll check those out also.
Back to top
View user's profile Send private message
Isaiah
Guru
Guru


Joined: 25 Feb 2003
Posts: 359

PostPosted: Thu May 06, 2004 3:19 pm    Post subject: Reply with quote

dsd wrote:
another approach would be to try the ebuilds i have posted on bug 48030...
they could do with some extra testing ;)

I gave one (using M="${S}") a shot - ended up having to copy the makefile and syfs-support-patch from portage to the overlay dir to get it to compile - unfortunately, the nvidia module still didn't load :?
Back to top
View user's profile Send private message
dsd
Developer
Developer


Joined: 30 Mar 2003
Posts: 2162
Location: nr London

PostPosted: Thu May 06, 2004 3:25 pm    Post subject: Reply with quote

Isaiah wrote:
I gave one (using M="${S}") a shot - ended up having to copy the makefile and syfs-support-patch from portage to the overlay dir to get it to compile - unfortunately, the nvidia module still didn't load :?

which kernel are you running?
_________________
http://dev.gentoo.org/~dsd
Back to top
View user's profile Send private message
Isaiah
Guru
Guru


Joined: 25 Feb 2003
Posts: 359

PostPosted: Thu May 06, 2004 3:40 pm    Post subject: Reply with quote

dsd wrote:
Isaiah wrote:
I gave one (using M="${S}") a shot - ended up having to copy the makefile and syfs-support-patch from portage to the overlay dir to get it to compile - unfortunately, the nvidia module still didn't load :?

which kernel are you running?

I'm running lokean-sources-2.6.5-r2, but before we go with that I'm happy to report the other one (using addwrite) worked 8) Now, before we go with that I'll admit I may have updated some other stuff in between trying out these two ebuilds. I can try the other one again if you would like me to. Right now, I'm just thankful the nvidia module is loading 8)
Back to top
View user's profile Send private message
dsd
Developer
Developer


Joined: 30 Mar 2003
Posts: 2162
Location: nr London

PostPosted: Thu May 06, 2004 3:58 pm    Post subject: Reply with quote

Isaiah wrote:
I'm running lokean-sources-2.6.5-r2,


Ah. thats the issue then. i'm assuming this kernel is basically 2.6.5 plus some extra patches (e.g. the one that breaks nvidia).

The M= ebuild checks for a species of 2.6.6(-rc1) or newer, and if found, it uses the new M="${S}" kbuild stuff. if not, it resorts to using the previous build method (the one in use in portage at the moment). the issue here is that the new ebuild magic was not kicking in for your slightly-obscure kernel :)

Quote:
but before we go with that I'm happy to report the other one (using addwrite) worked


this also makes sense, because the "addwrite" based ebuild checks for any breed of 2.6.x, and if found, it uses the new kbuild method in the kernel source dir.

Quote:
I can try the other one again if you would like me to.

if you have time on your hands, it might be helpful if you tested the M="${S}" ebuild for a 2.6.6-rc flavour kernel.

thanks for testing
_________________
http://dev.gentoo.org/~dsd
Back to top
View user's profile Send private message
Isaiah
Guru
Guru


Joined: 25 Feb 2003
Posts: 359

PostPosted: Thu May 06, 2004 4:18 pm    Post subject: Reply with quote

dsd wrote:
if you have time on your hands, it might be helpful if you tested the M="${S}" ebuild for a 2.6.6-rc flavour kernel.


I need a good ebuild with good reiser4 support (blame Redeeman and company) :wink:

dsd wrote:
thanks for testing


Your welcome - ya gotta love ebuilds 8)
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Fri May 07, 2004 5:50 pm    Post subject: Reply with quote

dsd wrote:
Isaiah wrote:
I'm running lokean-sources-2.6.5-r2,


Ah. thats the issue then. i'm assuming this kernel is basically 2.6.5 plus some extra patches (e.g. the one that breaks nvidia).

Hi, I'm the maintainer of lokean-sources, and it seems that the patches I applied indeed break nVidia (move-__this_module-to-modpost.patch being the culprit I understand). Is there another patch I can apply that will solve the problem for nVidia users?

dsd wrote:
the issue here is that the new ebuild magic was not kicking in for your slightly-obscure kernel :)

Just slightly? 8)
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
dsd
Developer
Developer


Joined: 30 Mar 2003
Posts: 2162
Location: nr London

PostPosted: Fri May 07, 2004 7:44 pm    Post subject: Reply with quote

yngwin wrote:

Hi, I'm the maintainer of lokean-sources, and it seems that the patches I applied indeed break nVidia (move-__this_module-to-modpost.patch being the culprit I understand). Is there another patch I can apply that will solve the problem for nVidia users?


you can do any of the following:
1. revert the patch
(bad idea, because the patch has been merged into Linus's tree for 2.6.6, so the other solution could do with more testing)

2. ask people to use the addwrite ebuild i posted on the bugzilla when compiling nvidia-kernel

3. modify my M= ebuild to check for lokean-sources-2.6.5 and advise users to use that
_________________
http://dev.gentoo.org/~dsd
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Fri May 07, 2004 7:55 pm    Post subject: Reply with quote

Thank you. I'll opt for 2, seems the easiest :D
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
hollywoodb
Apprentice
Apprentice


Joined: 05 Nov 2003
Posts: 259
Location: MN, U.S.A.

PostPosted: Tue May 11, 2004 2:16 am    Post subject: Reply with quote

the -r3 build from b.g.o (2nd post) worked great for me...

2.6.6-mm1 kernel
copied ebuild to overlay
had to copy the basic sysfs patch from /usr/portage/... to /usr/local/portage/....

have run foobilliard, glxgears, xmame.xgl, and seems to be just as stable as it should be :)

EDIT
forgot to mention, I have apci, apic, and apm disabled in kernel on nforce2 mobo, if it matters


Last edited by hollywoodb on Tue May 11, 2004 8:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
stahlsau
Guru
Guru


Joined: 09 Jan 2004
Posts: 565
Location: WildWestwoods

PostPosted: Tue May 11, 2004 5:43 am    Post subject: Reply with quote

ya, same here--the ebuild is great :-)
_________________
Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
eNTi
Veteran
Veteran


Joined: 20 Oct 2002
Posts: 1011
Location: Salzburg, Austria

PostPosted: Tue May 11, 2004 8:58 am    Post subject: Reply with quote

tried them on 2.6.6-mm1. X will lock.
_________________
If you fall off a cliff, you might as well try to fly. After all, you got nothing to lose.

-- John Sheridan - Babylon 5, Season 4
Back to top
View user's profile Send private message
dob
Apprentice
Apprentice


Joined: 04 Oct 2002
Posts: 199
Location: S.L.P.

PostPosted: Tue May 11, 2004 1:35 pm    Post subject: Reply with quote

I made a 5341 version of the M="${S}" ebuild (since I had 'badness in pci.c' crashes with version 5336, and I don't get those anymore with 5341).

It seems to work fine so far with vanilla 2.6.6

Dowload here.
Back to top
View user's profile Send private message
hollywoodb
Apprentice
Apprentice


Joined: 05 Nov 2003
Posts: 259
Location: MN, U.S.A.

PostPosted: Thu May 20, 2004 10:08 pm    Post subject: Reply with quote

another mirror to ebuild for the version dob mentioned in last post:

http://www.public.iastate.edu/~jpcox/

(this is the love-sources mirror)

ALSO: change the xfree dependency line in nvidia-glx ebuild to virtual/x11 if you use xorg
Back to top
View user's profile Send private message
Naughtyus
Guru
Guru


Joined: 14 Jul 2002
Posts: 463
Location: Vancouver, BC

PostPosted: Fri May 21, 2004 6:22 pm    Post subject: Reply with quote

None of these fixes seem to work for me. I've installed the nvidia-kernel posted in the above ebuild (by dob), and am currently running lokean-sources (2.6.6-lokean1, based off of love-sources).

Upon bootup, the 'nvidia' module loads without error, and I can run 'NVmakedevices.sh' without error, but starting X tells me that the nvidia module doesn't exist (and then consequently that there were no screens found).

Any suggestions?
Back to top
View user's profile Send private message
njlg
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2003
Posts: 98
Location: Portland, OR, USA

PostPosted: Fri May 21, 2004 10:29 pm    Post subject: Reply with quote

Similar to Naughtyus, I too am having problems with all of the methods listed here and in this forum (as far as I can tell).

I am running kernel 2.6.6-rc1. The module loads upon boot and NVmakedevices.sh runs, aswell. However, when I start X I get a message saying the nvidia module has an unusable configuration and that there are no screens found (I will post the actual message here when I capture it later).

What I have found to work is running
Code:
% sh /usr/portage/distfiles/NVIDIA-Linux-x86-1.0-5336-pkg1.run

Then I can start X just fine with no complaints.

And I have to do this every time I restart my computer (which is not all that often, but is a hassle). I do not have nvidia-kernel or nvidia-glx emerge at all.
Back to top
View user's profile Send private message
dsd
Developer
Developer


Joined: 30 Mar 2003
Posts: 2162
Location: nr London

PostPosted: Sat May 22, 2004 7:20 am    Post subject: Reply with quote

sounds like your /usr/src/linux isnt pointing to your running kernel..?
_________________
http://dev.gentoo.org/~dsd
Back to top
View user's profile Send private message
njlg
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2003
Posts: 98
Location: Portland, OR, USA

PostPosted: Sat May 22, 2004 5:58 pm    Post subject: Reply with quote

Yeah, that is what it sounds like, but it is pointing to the correct directory.
Code:
% ls -ld linux
lrwxr-xr-x  1 root root 15 May 18 13:04 linux -> linux-2.6.6-rc1/
% uname -a
Linux cN*2 2.6.6-rc1 #2 SMP Tue May 18 10:45:37 PDT 2004 i686 AMD Athlon(tm) XP 2400+ AuthenticAMD GNU/Linux

I somehow messed something up, but cannot figure out what. I tried going back to 2.6.5, but I could not emerge any nvidia-kernel's that would work with X. (I tried all versions with both 2.6.5 & 2.6.6-r1). Which I found extremely odd, because I had it working before.

(Edit: when'd I become a lil Helper?!?)
Back to top
View user's profile Send private message
gungholady
Guru
Guru


Joined: 19 Oct 2003
Posts: 392

PostPosted: Sun May 23, 2004 2:37 am    Post subject: Reply with quote

hollywoodb wrote:
another mirror to ebuild for the version dob mentioned in last post:

http://www.public.iastate.edu/~jpcox/

(this is the love-sources mirror)

ALSO: change the xfree dependency line in nvidia-glx ebuild to virtual/x11 if you use xorg


I used these ebuilds with love-sources-2.6.6-r4. The nvidia-kernel worked just fine for me. I get the nvidia splash screen and gnome loads and runs just fine. My problem is with the nvidia-glx. I'm using xorg and pure udev. Here is part of the result of glxinfo:

0x29 24 tc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x2a 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".

Xlib: extension "GLX" missing on display ":0.0".
0x2b 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x2c 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x2d 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x2e 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x2f 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x30 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None

I've tried modules-update, env-update and even rebooting. I have done opengl-update nvidia several times. Nothing that I've been able to find seems to work. nvidia-glx seemed to build and install just fine. Does anyone have any other clues as to how to solve this. I spent several hours searching the forums yesterday and didn't find anything that fit this.

EDIT: By trial and error I found the problem. It is working now.
Back to top
View user's profile Send private message
gungholady
Guru
Guru


Joined: 19 Oct 2003
Posts: 392

PostPosted: Tue May 25, 2004 1:59 am    Post subject: Reply with quote

Just in case someone else has the same problem, here is what I had to do to solve my problem. I had to extract NVIDIA-Linux-x86-1.0-5341-pkg1.run from the linux_v_10_5341.zip file. The run "sh NVIDIA-Linux-x86-1.0-5341-pkg1.run" as root from the console. The I had to add the following to /etc/conf.d/local.start:

mknod -m 666 /dev/nvidia0 c 195 0
mknod -m 666 /dev/nvidia1 c 195 1
mknod -m 666 /dev/nvidia2 c 195 2
mknod -m 666 /dev/nvidia3 c 195 3
mknod -m 666 /dev/nvidia4 c 195 4
mknod -m 666 /dev/nvidia5 c 195 5
mknod -m 666 /dev/nvidia6 c 195 6
mknod -m 666 /dev/nvidia7 c 195 7
mknod -m 666 /dev/nvidiactl c 195 255

GLX is now back to working as it should.
Back to top
View user's profile Send private message
someguy
Guru
Guru


Joined: 10 Jul 2003
Posts: 433
Location: (-_-) .::OH_WELL::. (-_-)

PostPosted: Tue May 25, 2004 2:52 am    Post subject: Reply with quote

i got mine running but quake3 kept lagging every now and then (geforce4 mx 460 so it wasnt the card ) i moved back to 2.4
_________________
print pack"C*",split/\D+/,`echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<>
)]}\EsMsKsN0[lN*1lK[d2%Sa2/d0<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<J]dsJxp"|dc`
while [ 1 ] ; do echo "*" | telnet ip.of.print.er 9100 ; done
Back to top
View user's profile Send private message
activ
n00b
n00b


Joined: 17 Oct 2002
Posts: 49

PostPosted: Sat May 29, 2004 10:47 am    Post subject: Reply with quote

I've run the script and now the nvidia driver loads.
It does however have the side affect of crashing my pc when shutting down X.

Anyone one got a clue how to fix this ?
Back to top
View user's profile Send private message
djiin
n00b
n00b


Joined: 05 Jun 2004
Posts: 2
Location: Brazil

PostPosted: Sun Jun 06, 2004 12:49 am    Post subject: Reply with quote

thanks for the script .... now nvidia splash logo appears with 2.6.6-rc1 kernel
_________________
emerge -C monopoly
emerge freedom
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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