# Installing two kernels

## el muchacho

Hi,

I have postponed the move to the 4.0 (hardened)kernel until now that it is in the stable tree but I'd need to make the move soon.

Is there a bit of guidance on how to install it in parallel so I can boot on both and have a fallback to the 3.6 ?

I've compiled kernels from scratches on blank installs but never done upgrades - and many tutorials I can see, are about compiling a kernel but don't mention how to keep the old one available too.

Also, how to i reuse my .config in the new kernel make menuconfig ? I remember there's a special "make" option which intelligently reuses previous options and then asks for any new features of the new kernel.

Thanks

H

----------

## xaviermiller

Hi!

You can have as many kernel versions as you want ; just add as many entries in your boot loader (grub can do it for example).

To reuse a .config, copy it and do "make oldconfig". Then check manually that evertything is OK (make menuconfig). Sometimes, there are big breaks.

----------

## spikyatlinux

 *el muchacho wrote:*   

> Hi,
> 
> I have postponed the move to the 4.0 (hardened)kernel until now that it is in the stable tree but I'd need to make the move soon.
> 
> Is there a bit of guidance on how to install it in parallel so I can boot on both and have a fallback to the 3.6 ?
> ...

 

That´s easy,

if "emerge --depclean" shouldn´t remove kernels, you can do the following.

Create file /etc/portage/sets.conf

```
[kernels]

class = portage.sets.dbapi.OwnerSet

world-candidate = False

files = /usr/src
```

and file /var/lib/portage/world_sets

```
@kernels
```

If you want to remove kernel you have to add version to emerge command like so

```
emerge -aC sys-kernel/gentoo-sources-4.0.5
```

After building and installing your kernel run

```
grub-mkconfig -o /boot/grub/grub.cfg
```

Grub2 should autodetect your kernels in /boot so you can choose on boot which kernel you want to boot  :Wink: 

RegardsLast edited by spikyatlinux on Mon Jul 27, 2015 11:36 am; edited 1 time in total

----------

## mi_unixbird

 *Quote:*   

> Is there a bit of guidance on how to install it in parallel so I can boot on both and have a fallback to the 3.6 ?

 

It's really simple, put both kernels in /boot, you can do ls /boot right now and you see the kernel images you have there, you may already have multiple. Linux kernels must start with the name "kernel-" or "vmlinuz-" apart from that it's fair game.

After you put the second kernel in boot under whatever name you like, if they are different versions this is done automatically by the kernel make install, if they have the same version the make install script will put your other kernel on "<kernel_name>.old".

Finally if you use grub2, you just edit the /boot/grub/grub.cnf file, search for the "menuentry" fields. There should be an entry that clearly looks like your old install, simply copy it and place it under the old one and change the filenames of the kernel to something appropriate.

It might happen that it doesn't go completely smoothly and the new kernel needs some extra parameteres to be ran, the make install script often informs you of when it does.

----------

## el muchacho

Cool, thanks everyone for the tips.   :Cool: 

----------

