Kernel Compile Guide for Debian 12

Pre-stuff
I suggest doing this in a virtual machine just for compiling kernels.
Base netinst system + source + compiling stuff and the output .deb files is around 8 GB of disk space with DEBUG_INFO disabled.
A WM with 4GB of RAM and 12-16GB of disk should be enough.

1.
Install build deps.

sudo apt-get install build-essential bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves bison rsync mc debhelper lynx

Download script for installing packages.

2.
Get the source from https://kernel.org/ .

lynx https://www.kernel.org/pub/linux/kernel/

3.
Configure the kernel with

make menuconfig

4.
Disable everything with DEBUG_INFO in the name in .config .
BEWARE: Doing stuff that touch the .config file seem to re-enable DEBUG_CONFIG in the .config file. Like make clean or make menuconfig

5.
Starting the compiler.

make -j8 bindeb-pkg

Add custom flags like -O3 to the compiler and custom name.

make -j8 KCFLAGS="-O3 -march=x86-64" EXTRAVERSION=-customname bindeb-pkg

6.
Now install the .deb files created in the parent directory and good luck.

Updated 07-01-2024