1 |
I am following vanilla-sources in all my machines, which is what |
2 |
people like Greg Kroah-Hartman actually recommends [1][2]. Since they |
3 |
are now never stabilized [3], this means that I need to update them |
4 |
pretty regularly to keep them safe. |
5 |
|
6 |
This implies that I have to change the /usr/src/linux symbolic link, |
7 |
configure the kernel using make oldconfig, compile it, install it, |
8 |
install its modules, reemerge any package that provides kernel modules |
9 |
(if any), regenerate its initramfs, regenerate the GRUB2 config file |
10 |
OR adding a new entry in GRUB. |
11 |
|
12 |
None of this steps are particularly difficult, but any mistake in one |
13 |
of them can result in an unbootable system. So I wrote a little script |
14 |
that takes care of each of this steps automagically: |
15 |
|
16 |
https://github.com/canek-pelaez/kerninst |
17 |
|
18 |
So now everytime I need to use a new kernel version, I only do: |
19 |
|
20 |
# eselect kernel set <new-kernel> |
21 |
# kerninst |
22 |
|
23 |
Everything is done by the script. |
24 |
|
25 |
The script is 167 lines of Bash, and I think is pretty easy to follow |
26 |
what it does. Any of the steps can be called individually, and I have |
27 |
been using it in all of my machines without any problem. It works with |
28 |
both GRUB and GRUB2, generating a very simple GRUB config file for |
29 |
every image available in /boot, with corresponding inird line if |
30 |
availabe. |
31 |
|
32 |
WARNINGS |
33 |
|
34 |
• If /usr/src/linux points to /usr/src/linux-3.10.10, then the script |
35 |
deletes /boot vmlinuz-3.10.10, /boot/initrd-3.10.10 *and* |
36 |
/lib/modules/3.10.10. |
37 |
• The script *WILL* overwrite your GRUB/GRUB2 configuration file, so |
38 |
make a copy before trying it. |
39 |
• The script requires a valid kernel .config file which will be copied |
40 |
into /usrc/src/linux, and then used to configure the kernel with: |
41 |
|
42 |
yes "" | make oldconfig |
43 |
|
44 |
Some people recommend not doing this, and it can stall if a new |
45 |
option for the kernel requires an answer with no default value. |
46 |
• The script only supports dracut, but adding genkernel (or any other |
47 |
initramfs maker) should be easy. Patches accepted. Dracut should be |
48 |
already configured. |
49 |
• I have only tested it with vanilla-sources, but probably will work |
50 |
with other *-sources packages. |
51 |
|
52 |
I have been using it in all of my machines for some days now, and it |
53 |
works for me; but I take no responsibility if it breaks your machine, |
54 |
or if it kills your dog. |
55 |
|
56 |
Regards. |
57 |
|
58 |
[1] http://article.gmane.org/gmane.linux.gentoo.devel/86496 |
59 |
[2] http://article.gmane.org/gmane.linux.gentoo.devel/86506 |
60 |
[3] http://article.gmane.org/gmane.linux.gentoo.devel/87015 |
61 |
-- |
62 |
Canek Peláez Valdés |
63 |
Posgrado en Ciencia e Ingeniería de la Computación |
64 |
Universidad Nacional Autónoma de México |