Date created: 08/22/12 18:27:34. Last modified: 11/08/17 18:51:42

Kernel Compile

CentOS7:

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
sudo yum --enablerepo=elrepo-kernel info kernel-ml.x86_64
sudo yum --enablerepo=elrepo-kernel install kernel-ml.x86_64

sudo vi /etc/default/grub
# Replace
GRUB_DEFAULT=saved
# With
GRUB_DEFAULT="CentOS Linux (4.13.11-1.el7.elrepo.x86_64) 7 (Core)"
# Where that is the menu item text in /etc/grub2-efi.cfg for the new Kernel version

sudo grub2-editenv list
sudo grub2-editenv /boot/grub2/grubenv unset saved_entry
sudo grub2-editenv list

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

 

Ubuntu 16:

sudo apt-get source linux-image-$(uname -r)

sudo apt-get build-dep linux-image-$(uname -r)

# This is required for the debug symbols if using debugging such as with SystemTap
sudo apt-get install pkg-config-dbgsym

# Optionally to compile a kernel module without any optimisation for use with SystemTap, edit the module Makefile.
# Example with Kernel 4.4.0.72, edit net/packet/Makefile to compile af_packet without optimisations.
# Add the following to the Makefile:
ccflags-af_packet.o += -O0

# Use this if built before to start a clean build
fakeroot debian/rules clean

# Build with skipdbg=false to use SystemTap (this took about 2 hours and 18G of  disk space!)
fakeroot debian/rules binary-headers binary-generic binary-perarch skipdbg=false

# Install all the .deb files generated and the single .ddeb file
cd ../
sudo dpkg -i linux*4.8.0-17.19*.deb
sudo dpkg -i *.ddeb

 

Ubuntu 14:

sudo apt-get update

sudo apt-get install dpkg-dev debhelper gawk git

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)

sudo apt-get source linux-image-$(uname -r)

cd linux-3.13.0/

sudo fakeroot debian/rules clean

# skipdgb=false is here to build a debug build (to support Systemtap) = it took about 2.5 hours and 11G of disk space!
sudo AUTOBUILD=1 fakeroot debian/rules binary-generic skipdbg=false

sudo dpkg -i ../linux-image-3.13.0-116-generic-dbgsym_3.13.0-116.163_i386.ddeb

 

Debian 5:


sudo apt-get update

sudo apt-get install dpkg-dev debhelper gawk git

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)

sudo apt-get source linux-image-$(uname -r)

cd linux-3.13.0/

sudo fakeroot debian/rules clean

# skipdgb=false is here to build a debug build (to support Systemtap) = it took about 2.5 hours and 11G of disk space!
sudo AUTOBUILD=1 fakeroot debian/rules binary-generic skipdbg=false

sudo dpkg -i ../linux-image-3.13.0-116-generic-dbgsym_3.13.0-116.163_i386.ddeb

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)