| View previous topic :: View next topic |
| Author |
Message |
codergeek42 Bodhisattva

Joined: 05 Apr 2004 Posts: 5142 Location: Anaheim, CA (USA)
|
Posted: Sun Oct 17, 2004 1:27 am Post subject: [TIP] Easily upgrade your kernel |
|
|
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.
*** 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 |
|
 |
jdgill0 Veteran


Joined: 25 Mar 2003 Posts: 1366 Location: Lexington, Ky -- USA
|
Posted: Sun Oct 17, 2004 1:58 am Post subject: |
|
|
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 |
|
 |
10drill Tux's lil' helper


Joined: 27 May 2004 Posts: 104 Location: 0{here}1
|
Posted: Mon Oct 18, 2004 5:49 am Post subject: |
|
|
| 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 |
|
 |
codergeek42 Bodhisattva

Joined: 05 Apr 2004 Posts: 5142 Location: Anaheim, CA (USA)
|
Posted: Mon Oct 18, 2004 6:36 am Post subject: |
|
|
| 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 |
|
 |
BlackEdder Advocate


Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
Posted: Mon Oct 18, 2004 10:12 am Post subject: |
|
|
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 |
|
 |
Boris27 Guru


Joined: 05 Nov 2003 Posts: 562 Location: Almelo, The Netherlands
|
Posted: Mon Oct 18, 2004 10:42 am Post subject: |
|
|
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 |
|
 |
arkane l33t


Joined: 30 Apr 2002 Posts: 918 Location: Phoenix, AZ
|
Posted: Tue Oct 19, 2004 5:05 pm Post subject: |
|
|
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 |
|
 |
Entropy42 n00b

Joined: 05 Mar 2004 Posts: 56
|
Posted: Thu Oct 21, 2004 5:56 pm Post subject: |
|
|
| 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 |
|
 |
tecknojunky Veteran


Joined: 19 Oct 2002 Posts: 1937 Location: Montréal
|
Posted: Fri Oct 22, 2004 9:15 am Post subject: |
|
|
| 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 |
|
 |
|
|
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
|
|