What is the Linux Kernel?
The kernel is the essential center of a computer operating system, the core that provides basic services for all other parts of the operating system. A kernel can be contrasted with a shell, the outermost part of an operating system that interacts with user commands.
The Linux kernel consists of various modules and it interacts directly with the underlying hardware. Kernel provides the required abstraction to hide low level hardware details to system or application programs.
System
The system used during the kernel compilation and configuration.
Preparation
Make sure before proceeding that only default repositories are used. Meaning only used the recommended repositories from Debian, not SID.
Also, it's important to remove old out dated packages or mixed package versions.
Update the system package database and upgrade the system to current release candidates.
Requirements
The main requirement is the kernel itself, download the kernel from kernel.org or another resource.
- Download, Install Debian if you haven't already
- Download the kernel
- Enable/Add required repository lines
- Update APT package database
- Upgrade the system if required
- Run an APT clean using : apt clean
- Copy old .config or from previous running kernel or create a default .config
- Install required packages
- Make menu config to modify your kernel preferences
The below packages are required, although some aren't needed but suggested
- build-essential - Informational list of build-essential packages like gcc
- linux-source - Linux kernel source (meta-package)
- bc - GNU bc arbitrary precision calculator language
- kmod - tools for managing Linux kernel modules
- cpio - GNU cpio -- a program to manage archives of files
- flex - fast lexical analyzer generator
- libncurses5-dev - transitional package for libncurses-dev
- bison - YACC-compatible parser generator
- libssl-dev - Secure Sockets Layer toolkit - development files
- libelf-dev - libelf1 development libraries and header files
- make - utility for directing compilation - comes with previous package
Download Kernel
Download kernel from kernel.org
Repositories
Add the highlighted text to the end of the below repository lines.
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/debian-security buster/updates main contrib
deb-src http://security.debian.org/debian-security buster/updates main contrib
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib
deb-src http://deb.debian.org/debian/ buster-updates main contrib
Create Directory
Create a directory for the kernel. Download the kernel into this directory and extract.
After extracting kernel run the below before proceeding.
Merge Configuration/Create
Copy the current .config to the /usr/src/kernels/linux-#.# directory.
Alternative option: Create a default .config by running the below command.
Install Requirements
flex libncurses5-dev bison libssl-dev libelf-dev
Modify Kernel - Optional
Optional - If using xconfig to modify the kernel, install requirements below
- pkg-config - manage compile and link flags for libraries
- qt5-default - Qt 5 development defaults package
Compile Kernel
The -j with -j88 means we are utilizing our 88 cores on the system.