Kernel compilation

A note on how to compile a kernel with customized TCP congestion control.

Dependencies

Install kitchen sink of kernel build dependencies.

apt install build-essential libncurses-dev libssl-dev bc flex bison libelf-dev pkg-config zlib1g-dev gdb kmod git cpio rsync

Download

Pick your favorite LTS kernel and grab the source.

wget -qO- https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.1.43.tar.gz | tar xz && rm -f linux-6.1.43.tar.gz

Kconfig

Add your custom TCP congestion control module to net/ipv4/Kconfig,

Mine's called hex.

config TCP_CONG_HEX
    tristate "TCP Hex congestion control"
    default y
    help
      Hex is a variant of BBR with modified parameters.
      If unsure, say N.

Makefile

Make sure your custom module gets compiled into the kernel in net/ipv4/Makefile.

obj-$(CONFIG_TCP_CONG_HEX) += tcp_hex.o

Configuration

Use your build machine's config as baseline, make sure you haven't installed random stuff.

cp /boot/config-$(uname -r) ./.config

Run make olddefconfig to ensure new config options are added to .config.

yes "" | make olddefconfig

You can also run make menuconfig and navigate to Networking support - Networking options - TCP: advanced congestion control to verify your custom TCP CC module is selected.

Build

Make sure you have enough RAM and disk space.

make -j$(nproc) LOCALVERSION=-name-of-kernel bindeb-pkg

Shiny new kernel deb will appear in the parent directory.