This is an obsolete now guide on how to build the Linux Kernel into a .deb package. Don't use this, or take with a grain of salt. Instead, see https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official
Install the Required Packages
To download and compile the Linux Kernel source we will need the following packages:
- build-essential - Essential packages required for compiling.
- linux-source - The Linux Kernel Source
- libncurses5-dev - Development files for ncurses5. Optional for using curses based menu driven configuration.
To install these packages run the following command as root:
sudo apt-get install build-essential linux-source bc kmod cpio flex cpio libncurses5-dev
Extracting the Kernel Source
Under /usr/src you will find a file looking like linux-source-x.x.tar.xz. Please note that x.x will match the current Linux Kernel source for your release of Debian. In this example we will be using the 4.15 Kernel under Sid.
Extract the Kernel Source with the following command (NOTE: You will need to change 4.15 to match the .tar.xz file in /usr/src):
tar xavf /usr/src/linux-source-4.15.tar.xz
Configuring the Kernel
Change directories to the newly extracted linux source (again, match 4.15 to your version):
Create a defconfig with the following command, please change ARCH=i386 to match your target architecture:
make ARCH=i386 defconfig
Building the Debian Package
Use make bindeb-pkg target to build the kernel. the -j`nproc` argument sets the build to use as many cpu's as you have.
make -j`nproc` bindeb-pkg
The "Compiling a Kernel" section in the Debian Administrator's Guide (WARNING: outdated)