OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

9.5.2. Summary Tips for Recompiling the Linux Kernel‌


As an advanced user, you may wish to recompile the Kali kernel. You may want to slim down the standard Kali kernel, which is loaded with many features and drivers, add non-standard drivers or features, or apply kernel patches. Beware though: a misconfigured kernel may destabilize your system and you must be prepared to accept that Kali cannot ensure security updates for your custom kernel.

For most kernel modifications, you will need to install a few packages with apt install build- essential libncurses5-dev fakeroot.

The command apt-cache search ^linux-source should list the latest kernel version packaged by Kali, and apt install linux-source-version-number installs a compressed archive of the kernel source into /usr/src.


image

10https://gitlab.com/kalilinux/packages

The source files should be extracted with tar -xaf into a directory other than /usr/src (such as

~/kernel).

When the time comes to configure your kernel, keep these points in mind:


• Unless you are an advanced user, you should first populate a kernel configuration file. The preferred method is to borrow Kali’s standard configuration by copying /boot/ config-version-string to ~/kernel/linux-source-version-number/.config. Alterna- tively, you can use make architecture_defconfig to get a reasonable configuration for the given architecture.

• The text-based make menuconfig kernel configuration tool will read the .config file and present you all the configuration items in a huge menu that you can navigate. Selecting an item shows you its documentation, its possible values, and permits you to enter a new value.

When run from your kernel source directory, make clean will remove previously-compiled files and make deb-pkg will generate up to five Debian packages. The linux-image-version .deb file contains the kernel image and the associated modules.

To actually use the built kernel, install the required packages with dpkg -i file.deb. The “linux- image” package is required; you only have to install the “linux-headers” package if you have some external kernel modules to build, which is the case if you have some “*-dkms” packages installed (check with dpkg -l ”*-dkms” | grep ^ii). The other packages are generally not needed (un- less you know why you need them!).


Top OS Cloud Computing at OnWorks: