Solved

Recompiling kernel with Nvidia driver installed (openSUSE 11.3 64bit)

Posted on 2010-09-15
15
1,773 Views
Last Modified: 2012-05-10
I am trying to improve the use of resources on my computer and I learned that a custom kernel -or- recompiling my kernel would do this. So I checked out some online guides for recompiling my kernel and it ended up not booting anymore so I reinstalled.

Here is the guide I used:
http://www.linux.com/learn/tutorials/305766-recompile-your-kernel-for-a-perfect-fit((

I looked at this guide but it appears to be for SuSE 10.1 (I'm using openSUSE 11.3)
http://www.howtoforge.com/kernel_compilation_suse
__________________________________________________________________________
Here is what I would like to know:

1) How do I back up my current kernel so if something goes wrong, I can use the old one?

2) How do I recompile my kernel without breaking it?
__________________________________________________________________________
I am using the following 2 guides now to try this again:
http://linux.derkeiler.com/Mailing-Lists/SuSE/2009-02/msg01014.html
http://linuxtweaking.blogspot.com/2010/04/opensuse-112-how-to-compile-kernel-for.html

I have done all of the 'prep work' shown in the 1st link and after getting partially into the the instructions on the second link, I noticed this message:

"Important: It is assumed proprietary ATi or Nvidia drivers are not installed. If you have such drivers installed and boot into your new kernel, X will crash!"
So I stopped at that point and googled how to recompile my kernel with the Nvidia driver and cannot find anything.

Any help would be greatly appreciated.


__________________
openSUSE 64bit on Lenovo W510 w/Nvidia
http://www.thinkwiki.org/wiki/Category:W510
linux-9b2s:/usr/src/linux # cd /usr/src/linux
linux-9b2s:/usr/src/linux # make mrproper
  CLEAN   scripts/basic
  CLEAN   scripts/genksyms
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts/selinux/genheaders
  CLEAN   scripts/selinux/mdp
  CLEAN   scripts
  CLEAN   include/config include/generated
  CLEAN   .config .config.old include/linux/version.h
linux-9b2s:/usr/src/linux # make cloneconfig > /dev/null 2>&1
linux-9b2s:/usr/src/linux # make modules_prepare
scripts/kconfig/conf -s arch/x86/Kconfig
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/lex.c
  SHIPPED scripts/genksyms/parse.h
  SHIPPED scripts/genksyms/keywords.c
  HOSTCC  scripts/genksyms/lex.o
  SHIPPED scripts/genksyms/parse.c
  HOSTCC  scripts/genksyms/parse.o
  HOSTLD  scripts/genksyms/genksyms
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/bin2c
linux-9b2s:/usr/src/linux # make clean
  CLEAN   /usr/src/linux-2.6.34.4-0.1
  CLEAN   .tmp_versions

Open in new window

0
Comment
Question by:-Don
  • 9
  • 4
  • 2
15 Comments
 
LVL 76

Expert Comment

by:arnold
Comment Utility
Note however, if you use the opensuse update/upgrade tools, whenever they release a newer/updated version of the kernel package, you would have to go through this process again with the newer version.

As long as you do not delete it or overwrite it, it should remain in the boot list and on /boot.


presumably you are using grub as the boot loader.
make sure to give your compiled version kernel a unique name i.e. use the same kernel major/minor version but add your initials to the name

Your grub.conf will have several entries. one that boot the kernel you have and one boots the kernel you are working with.

You would initially select the newly compiled kernel to boot from during the boot splash screen.
make sure to configure grub.conf to give you time to select which kernel/os you want to boot to. If you have the timeout parameter set to 0, you will not have time/option to select an alternate boot kernel.

0
 
LVL 3

Expert Comment

by:T1750
Comment Utility
The SUSE repo on Nvidia and their package sucks horribly. You don't really need to recompile your whole kernel just don't use their repo, download the driver from nvidia.

http://www.nvidia.com/object/linux-display-ia32-256.53-driver.html

That one's for modern cards on x86. Click the driver search button if you aren't running that.

Delete the suse package cause it's broken in many ways, just download the NVIDIA program , do a telinit 3 to get out of X and and run it with the options -q -a to install it.

It will probably tell you to run Sax" which you can completely ignore, modprobe nvidia, disable putting KMS into the initrd with:

sudo sed -i 's/NO_KMS_IN_INITRD.*/NO_KMS_IN_INITRD="yes"/g' /etc/sysconfig/kernel

Then run mkinitrd. startx (as root), run the nvidia-settings program and save the X configuration file to something like /etc/X11/xorg.conf.d/01-nvidia.conf.

It looks like the installer added an auto-modprobe for the nvidia driver to this file:

/etc/modprobe.d/50-nvidia.conf

So you don't need to worry about modifying the boot scripts.

That's what I did and it made everything work perfectly.
0
 
LVL 3

Expert Comment

by:T1750
Comment Utility
Plus you don't need to worry about saving your "old" kernel because they come from SUSE rpms. If it all goes pete-tong just zypper in --force kernel-default.
0
 
LVL 3

Expert Comment

by:T1750
Comment Utility
You can also install dell DKMS to automatically recompile the nvidia driver every time a suse kernel update is pushed out but that's a bit beyond the scope of the question and DKMS is very simple google for dell dkms.

Dell have a package for it on the OBS, so you can install it that way too. Some users have also patched it so to "suziefy" it.
0
 
LVL 3

Expert Comment

by:T1750
Comment Utility
It's much better to keep the stock kernel unless you really need to tune it, since if you do all the security holes that get patched by SUSE won't get pushed out to you automatically you will have to manually control it all, it's a time sink. There are several kernel variants already tuned by SUSE for different purposes, since we're talking 64bit and nvidia I assume it's your desktop and you want to zypper in kernel-desktop and kernel-desktop-devel. You can use YaST to configure grub or do it by hand like arnold said. Personally I deleted YaST... heh.... and grub for that matter.
0
 

Author Comment

by:-Don
Comment Utility
Excellent, Thank you!

So...
1) Remove Nvidia repo and install driver from RPM
(do a telinit 3 to get out of X and and run it with the options -q -a to install it.)
2)as root
# sed -i 's/NO_KMS_IN_INITRD.*/NO_KMS_IN_INITRD="yes"/g' /etc/sysconfig/kernel
# mkinitrd. startx
( run the nvidia-settings program and save the X configuration file to something like /etc/X11/xorg.conf.d/01-nvidia.conf)

And if I follow the code below,

cd /usr/src/linux
 make mrproper
 make cloneconfig > /dev/null 2>&1
 make modules_prepare
 make clean

make cloneconfig
make menuconfig
# make changes
 General Setup ---> Local version - append to kernel release
# exit

make rpm
cd /usr/src/packages/RPMS/x86_64
zypper install <modified-kernel-name>.rpm

cd /boot
 mkinitrd

vmlinuz-2.6.31.12-0.2-modified
 initrd-2.6.31.12-0.2-modified

gedit /boot/grub/menu.lst
# add modified kernel entry to list

reboot
Does it look like this will work?
0
 
LVL 3

Accepted Solution

by:
T1750 earned 400 total points
Comment Utility
If you really *have* to have your own kernel then open an account with OBS and linkpac to the kernel in updates and add you changes to the RPM package. That way you can benefit from their fixes because your package will pick them up automatically if you do it the right way (by replacing their .config file with your one, if you watch the build log you will see it just copies in the correct .config during the build stage, make a patch file that replaces it with yours.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 3

Expert Comment

by:T1750
Comment Utility
I strongly advise you not to bother compiling your own kernel you don't need to, just choose one of the suse stock kernels already tuned to the desktop.

But yes that will work, with a caveat.

You don't install driver from an RPM you install it from the NVIDIA "shellball". You run it with (as root) sh NVIDIA<rest of name> -q -a.

Since I read you're on ia64 you probably want this:

http://www.nvidia.com/object/linux-display-amd64-256.53-driver.html

Delete the RPM. Delete the NVIDIA repository. I filed 2 bug reports on it already and I noticed a third bug it's just a hatchet job. Although I generally advise against putting anything on your system which isn't an RPM package, this is a case where practicality makes it the right thing to do.
0
 

Author Comment

by:-Don
Comment Utility

RE: T1750"It's much better to keep the stock kernel unless you really need to tune  it, since if you do all the security holes that get patched by SUSE  won't get pushed out to you automatically you will have to manually  control it all, it's a time sink. There are several kernel variants  already tuned by SUSE for different purposes, since we're talking 64bit  and nvidia I assume it's your desktop and you want to zypper in  kernel-desktop and kernel-desktop-devel. You can use YaST to configure  grub or do it by hand like arnold said. Personally I deleted YaST...  heh.... and grub for that matter."


 "If you really *have* to have your own kernel then open an account with  OBS and linkpac to the kernel in updates and add you changes to the RPM  package. That way you can benefit from their fixes because your package  will pick them up automatically if you do it the right way (by replacing  their .config file with your one, if you watch the build log you will  see it just copies in the correct .config during the build stage, make a  patch file that replaces it with yours."

The security holes don't sound very good and the performance isn't terrible but sometimes it seems slower than my other machine with half the power and I use VMware Workstation on it so I was trying to optimize it.

I do have a SUSE Studio account, would that be a better option?
0
 

Author Comment

by:-Don
Comment Utility
Okay,
The OBS and linkpac option sounds good.


Thank you all for your help, I truly appreciate it!
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 100 total points
Comment Utility
As pointed out earlier there is a tradeoff between using the vendor provided kernel which is setup to boot as many diverse systems as possible by including everything including the kitchen sink in the kernel making it 2-4 MB in size while a customized that can only boot a specific system can be reduced to <1MB
The problem is that should a component on your system fail, i.e. the graphics card, etc. the customized kernel might not be able to boot the system unless during the setup you left some of the failsafe in. i.e. include the default vga/svga components etc.

The issue with the security risks deal with you having to monitor the update information from the vendor for the kernel package dealing with whether they are fixing a security hole.  At times the security fix will have nothing to do with your customized kernel because the security issue deals with an included kernel module/driver/code that you've disabled, etc.

So that is the tradeoff.  rely on the vendor to issue the updates to the kernel and have a large kernel, or take on the responsibility of updating/patching/rebuilding/recompiling your kernel. i.e. with the vendor update, one resides in a relative "ignorance filled bliss", on the other one you monitor/spend time making sure your system is up to snuff.

IMHO, you should try building/optimize the kernel at least once this way you will have first hand experience and the information to decide which approach you wish to follow.
One more thing, stock kernel at times, are easier to recover from following hardware failure (fried motherboard). But not impossible from a custom kernel provided you keep a stock kernel as a failsafe.
0
 
LVL 3

Expert Comment

by:T1750
Comment Utility
I still suggest installing the NVIDIA shellball driver because it made my system much prettier/faster depending on where I slide the bars to :)

Definately geld the NVIDIA repo and suse NVIDIA driver package until they can get it right.

SUSE isn't known for being the fastest distro available. It's a powerful distro with a ton of tools, good LSB compliance, very easy to use, generally great package QA (which makes me even more disappointed they did such a poor job with the NVIDIA package) and money behind it. If you want speed something like Arch would be superior.

SUSE is my favorite distro so don't install Arch.

SUSE Studio is great, if you can do what you want on there then it's a viable option.

Or stick a couple more ram chips in so you can give more resources to your VM. What are they these days? $5 each? :)

For one final time, in this day and age, everything in the kernel is split out into models, the stuff that you don't have isn't going to get loaded (for long, it will be tested for, hence SUSE's slow boot time). SUSE do have a couple of options enabled in there to aid in debugging that will slow things down but you "ricing" your kernel isn't going to be like putting nitrous in your car, I think you will end up disappointed with the results.
0
 
LVL 3

Expert Comment

by:T1750
Comment Utility
If you've never compiled a kernel you could do it for the experience like arnold said. You'll learn a thing or two. I did compile my own kernel for SUSE but didn't bother maintaining it the performance gains were minimal.

And while your optimized kernel may be nice and tiny most of the bloat in the SUSE kernel is modules so they aren't loaded and aren't slowing you down except during booting.
0
 
LVL 3

Expert Comment

by:T1750
Comment Utility
They do have a bunch of debugging aids compiled in you could disable though if you wish to walk that road. There's where your performance gains will come from mostly, that and not probing modules for toasters, calculators, xboxes and other things your machine isn't - but that only happen at the boot stage anyway.
0
 

Author Closing Comment

by:-Don
Comment Utility
Thank you!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It Is not possible to enable LLDP in vSwitch(at least is not supported by VMware), so in this article we will enable this, and also go trough how to enabled CDP and how to get this information in vSwitches and also in vDS.
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
Teach the user how to configure vSphere Replication and how to protect and recover VMs Open vSphere Web Client: Verify vsphere Replication is enabled: Enable vSphere Replication for a virtual machine: Verify replicated VM is created: Recover replica…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now