Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TIP] Easily upgrade your kernel
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
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Sun Oct 17, 2004 1:27 am    Post subject: [TIP] Easily upgrade your kernel Reply with quote

I just thought this might be useful to others, so here goes.

*** Why are you writing this? ***
One of the many things that bothered me when I first started using Gentoo (and GNU/Linux in general) is that when I upgrade my kernel, I have to go through the menuconfig and do the necessary things each time. Each time I did it, I always made a mistake. Whether it be forgetting to compile in support for my NIC, or putting something as a module that I needed statically (like ext2/3 FS support). So browsing and reading around, I figured out a nice convenient way of doing it.

Firstly, if you do not have it installed (which you probably should :?), you need gzip installed:
Code:
# emerge app-arch/gzip


*** SKIP THIS STEP IF YOU ALREADY HAVE /proc/config.gz SUPPORT IN YOUR KERNEL ***
Now we need to enable /proc/config.gz support in our kernel. Change the following in your kernel .config :
Code:
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
Or if you are doing via menuconfig, it's under "General Setup":
Code:
General Setup -->
  [*] Kernel .config support
  [*]   Enable access to .config through /proc/config.gz
Now re-compile and install your kernel as per the Gentoo Handbook, then proceed with the following steps.

*** Re-using your .config ***
Now whenever you need to upgrade your kernel, instead of doing a `make menuconfig` and re-configuring everything, you can simply do:
Code:
# cd /usr/src/linux
(or whereever you have the kernel sources)
Code:
# gzcat /proc/config.gz > .config
# make oldconfig
This will make it so that it uses the exact same .config as the running kernel, and will prompt you about anything new. Then you can simply compile and install your kernel as necessary, and you're done. :) No more fussing about with the menuconfig. Just do it once and you're good to go. :wink:


*** Questions & Answers ***
Q: Will this work if I'm using app-arch/gzip-x86 rather than app-arch/gzip?
A: I honestly don't know. If it has /bin/gzcat as a symlink to /bin/gzip, then yes it should work.

Q: What if I'm using a 2.4 kernel?
A: EDIT: BlackEdder has corrected me. No this option is not available on 2.4 kernels.
Questions? Comments? Concerns?
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF


Last edited by codergeek42 on Mon Oct 18, 2004 2:48 pm; edited 1 time in total
Back to top
View user's profile Send private message
jdgill0
Veteran
Veteran


Joined: 25 Mar 2003
Posts: 1366
Location: Lexington, Ky -- USA

PostPosted: Sun Oct 17, 2004 1:58 am    Post subject: Reply with quote

Yea, I think this is a nice tip. Recently I have been playing with SuSE Linux a little bit (don't flame me, it's always good to know more than just one distro). I noticed that SuSE was using the /proc/config.gz capability in the kernel. I had seen this before a while back, but never gave it much thought until now. With /proc/config.gz you always have the .config file that you created the running kernel with.

Now you could use zcat instead of gzcat, which as you pointed out is just a symlink to gzip.
Code:
zcat /proc/config.gz > .config
Back to top
View user's profile Send private message
10drill
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2004
Posts: 104
Location: 0{here}1

PostPosted: Mon Oct 18, 2004 5:49 am    Post subject: Reply with quote

In the past I have just copied the .config from current kernel to the new kernel tree and run make oldconfig. I'm prompted for things that have changed, etc. and everything seems to work fine. I have not set CONFIG_IKCONFIG=y (and don't run the gzcat command). Is there a reason I should change the way I do this?
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Mon Oct 18, 2004 6:36 am    Post subject: Reply with quote

10drill wrote:
In the past I have just copied the .config from current kernel to the new kernel tree and run make oldconfig. I'm prompted for things that have changed, etc. and everything seems to work fine. I have not set CONFIG_IKCONFIG=y (and don't run the gzcat command). Is there a reason I should change the way I do this?
Not really, except a lot of times, I like to remove older kernel source trees, and usually (being the klutz that I am) I end up removing the .config file on accident. But when it's stored in the kernel itself, I don't have to worry about that. :)
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Mon Oct 18, 2004 10:12 am    Post subject: Reply with quote

It might be nice to add a tip about keeping your old kernel in /boot, so you can always boot back to the old kernel if the new kernel doesn't work. For this I personally use the make install command (after make && make modules_install). It will automatically put the new kernel in /boot and make two links, vmlinuz and vmlinuz.old (not perfectly sure about the names) pointing to the respectively new and old kernel. Then just setup grub to have an entry for vmlinuz and vmlinuz.old.

Furthermore I'm pretty sure 2.4 kernels do not support the config.gz option. I remember being quite glad about this feature being added
Back to top
View user's profile Send private message
Boris27
Guru
Guru


Joined: 05 Nov 2003
Posts: 562
Location: Almelo, The Netherlands

PostPosted: Mon Oct 18, 2004 10:42 am    Post subject: Reply with quote

You could just copy the .config over from the old kernel tree, that you should still have...
_________________
we are microsoft, lower your firewalls and surrender your pc's. we will add your biological and technological distinctiveness to our own. your culture will adapt and service us. resistance is futile.
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Tue Oct 19, 2004 5:05 pm    Post subject: Reply with quote

Also using genkernel will save off the .config to a totally different directory, and switching between the same series (e.g. 2.4.x) of kernel will use the same .config, doing an mrproper everytime on the sourcecode.

genkernel --menuconfig all
Back to top
View user's profile Send private message
Entropy42
n00b
n00b


Joined: 05 Mar 2004
Posts: 56

PostPosted: Thu Oct 21, 2004 5:56 pm    Post subject: Reply with quote

BlackEdder wrote:
It might be nice to add a tip about keeping your old kernel in /boot, so you can always boot back to the old kernel if the new kernel doesn't work. For this I personally use the make install command (after make && make modules_install). It will automatically put the new kernel in /boot and make two links, vmlinuz and vmlinuz.old (not perfectly sure about the names) pointing to the respectively new and old kernel. Then just setup grub to have an entry for vmlinuz and vmlinuz.old.

Furthermore I'm pretty sure 2.4 kernels do not support the config.gz option. I remember being quite glad about this feature being added

I just point grub to vmlinuz-<kernel version> nowadays, I don't even bother with symlinks to vmlinuz anymore.
Back to top
View user's profile Send private message
tecknojunky
Veteran
Veteran


Joined: 19 Oct 2002
Posts: 1937
Location: Montréal

PostPosted: Fri Oct 22, 2004 9:15 am    Post subject: Reply with quote

BlackEdder wrote:
It might be nice to add a tip about keeping your old kernel in /boot, so you can always boot back to the old kernel if the new kernel doesn't work. For this I personally use the make install command (after make && make modules_install). It will automatically put the new kernel in /boot and make two links, vmlinuz and vmlinuz.old (not perfectly sure about the names) pointing to the respectively new and old kernel. Then just setup grub to have an entry for vmlinuz and vmlinuz.old.

Furthermore I'm pretty sure 2.4 kernels do not support the config.gz option. I remember being quite glad about this feature being added
That's what I do.
_________________
(7 of 9) Installing star-trek/species-8.4.7.2::talax.
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