Building
Vanilla kernel
Install dependencies:
sudo apt-get install kernel-package fakeroot libncurses5-dev gcc-4.9-plugin-devGet the name of the latest kernel from Kernel.org:
wget https://www.kernel.org/finger_banner -qO -Download vanilla kernel package and signature:
wget https://kernel.org/pub/linux/kernel/v4.x/linux-4.3.3.tar.xz wget https://kernel.org/pub/linux/kernel/v4.x/linux-4.3.3.tar.signUnpack kernel package:
unxz linux-4.3.3.tar.xzVerify package signature:
gpg --verify linux-4.3.3.tar.signUnpack kernel sources:
tar -xf linux-4.3.3.tarChange into sources directory:
cd linux-4.3.3/Copy current kernel’s config:
cp /boot/config-$(uname -r) .configApply patches if needed:
patch -p1 < ../debian-logo-2.6.patchLaunch configuration menu:
make menuconfigClean up before building:
make-kpkg cleanBuild debian packages for linux-headers and linux-image:
export CONCURRENCY_LEVEL="$(grep -c '^processor' /proc/cpuinfo)" time fakeroot make-kpkg --initrd kernel_headers kernel_imageInstall new debian packages:
sudo dpkg -i ../linux-*.deb
Patches
Grsecurity patch
Get the name of the latest patch from Grsecurity:
wget https://grsecurity.net/latest_test_patch -qO -Download patch and signature:
wget https://grsecurity.net/test/grsecurity-3.1-4.3.3-201601192226.patch wget https://grsecurity.net/test/grsecurity-3.1-4.3.3-201601192226.patch.sigVerify patch signature:
gpg --verify grsecurity-3.1-4.3.3-201601192226.patch.sigChange into sources directory:
cd linux-4.3.3/Apply patch:
patch -p1 < ../grsecurity-3.1-4.3.3-201601192226.patchLaunch configuration menu:
make menuconfigChange these parameters from the defaults in Security options:
[*] Grsecurity Configuration Method (Automatic) ---> Usage Type (Desktop) ---> Virtualization Type (Host) ---> Virtualization Software (KVM) ---> Required Priorities (Security) --->
Links
- 8.10. Compiling a Kernel - The Debian Administrator’s Handbook
- 4.6 Building a custom kernel from the “pristine” kernel source - Debian Kernel Handbook
- Hardening Debian for the Desktop Using Grsecurity - Micah Lee’s Blog
- Grsecurity/Appendix/Grsecurity and PaX Configuration Options > Virtualization Software - Wikibooks