Funtoo - How to make kernel changes

From Linux - Help
Jump to navigation Jump to search

Gentoo-power.png Technology should be fun, powerful and free.

'Changing a kernel ask lot of time so prepare yourself a cup of coffee or cold beer.'

The goal of this document is to explain you how to make changes in an Gentoo / Funtoo kernel, read the complete how to before trying any command in your terminal.

This changes are needed for a lot of reason, one of these can be virtualizing your GPU and need to make some changes in the kernel or add modules to make it work.

First step

We need to check what kernel is actually used for modification and select the kernel we want to modify:

 su -c 'eselect kernel list' 

eselect kernel list

Like you can see on the above image, I have only one kernel , but we still select the Kernel because we need to create a symlink in /usr/src/linux with your kernel, in my case linux-debian-sources-4.8.15.

 su -c 'eselect kernet set 1'  # 1 replace by the number of desired kernel you want to modify.

Configure the kernel

First we need to mount the /boot:

 mount /dev/sda1 /boot  # change sda1 according where your /boot is installed.

Now we need to move to /usr/src/linux with:

 cd /usr/src/linux

and type in su -c 'make menuconfig' to create the kernel menu.

sudo make menuconfig

In this example, I need to modify:

  CONFIG_KVM_VFIO=y only in spannish
  • =m is for modularizes feauture, =y is for includes and =n is for excludes.

You can use the search of make menuconfigfile with the symbole / ans past in what you are searching for like in this example:CONFIG_VFIO_IOMMU_TYPE1.

past in what your searching for

Terminal - sarah@funtoo--usr-src-linux 020.png

You can now see on this screenshot, the kernel configuration VFIO_IOMMU_TYPE1 [=m] is already enable as module in my kernel (m), if not, then check:

Depends on: VFIO [=m] will say VFIO is enable, if not first enbale that option because it depends on it.

Defined at: /drivers/vfio/Kconfig1 it tell you were in the kernel menu you can find VFIO_IOMMU_TYPE1.

It ask to be patient and when you are modifying your kernel, do not be impatient or you will mess you configuration, you should too back-up your system before trying to modifying it.

When finished to modify, just press Save and accept the creation of .config file and you can Exit.

Finish the kernel configuration

Now we need to type su -c 'make', from here it take really long time, be patient.

When finished and if you changed kernel a option and a module you will need to type:

 su -c 'make modules_install && make install'

If you not changed any module then just type:

 su -c 'make install'

When this is finished you need to update your boot file, this is mandatory, if you forget this step your grub will not boot your kernel at next reboot.

For grub with Funtoo type:

 su -c 'boot-update -v'

For grub with Gentoo type:

 su -c 'grub-mkconfig -o /boot/grub/grub.cfg'

For other boot-loader, please check your documentation.

Then reboot and have fun with your modified kernel.

Online resources

Kernel - Funtoo how to's.

Gentoo - Gentoo how to's

Vfio - guide used like examples for the kernel changes.