Build the latest kernel package for Debian

Leo Saavedra
1 min readSep 4, 2023

--

This tutorial is based in a fresh install of Debian 12.1 and kernel 6.5.0.

Update and install build tools

apt-get update
apt-get upgrade
apt-get install libncurses-dev fakeroot wget bzip2 build-essential \
build-essential bc python bison flex rsync libelf-dev libssl-dev \
libncurses-dev dwarves git debhelper kernel-package ncurses-dev \
fakeroot wget bzip2

Download and unpack the kernel source 6.5.0

curl -O https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.tar.xz
xz -v -d linux-6.5.tar.xz
tar xf linux-6.5.tar
cd linux-6.5/

Copy the current .config file

cp -v /boot/config-6.1.0–11-amd64 .config
make menuconfig (save the new .config)
make olddfeconfig

optional review the .config file

vim .config

Disable system keys and debugging

scripts/config --disable SYSTEM_TRUSTED_KEYS
scripts/config --disable SYSTEM_REVOCATION_KEYS
scripts/config --disable DEBUG_INFO
scripts/config --enable DEBUG_INFO_NONE

Compile, package and install

make bindeb-pkg -j `nproc` LOCALVERSION=-custom
cd ..
dpkg -i linux-image-6.5.0-custom_6.5.0–3_amd64.deb linux-headers-6.5.0-custom_6.5.0–3_amd64.deb
reboot

--

--

Leo Saavedra
Leo Saavedra

Written by Leo Saavedra

0 Followers

Sysadmin, for the archeologist from the future.

No responses yet