Get and compile the mainline kernel, git method:
see also: https://wiki.ubuntu.com/KernelTeam/GitKernelBuild
I do things a little different (what else is new?).
Step 1 is to
apt-get update and
apt-get dist-upgrade (i.e. make sure everything is up to date)
sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge
sudo apt-get build-dep linux
sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev
Prerequisites as of kernel 4.3:
sudo apt-get install libssl-dev
Step 5 - based on not being able to compile on a new 20.04 server installation 2019.12.02
sudo apt install flex bison
sudo apt-get install git-email git-doc
The git part:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Never do stuff in the default master branch. Always make some work area.
git checkout -b k44rc8_stock v4.4-rc8
Steal the Ubuntu kernel configuration file (already installed):
ls -l /boot
cp /boot/config-4.4.0-040400rc8-generic .config
Ubuntu config file has full debugging. Makes an enormous kernel and takes twice as long to compile
scripts/config --disable DEBUG_INFO
Special note as of Kernel 4.4 and if compiling using Ubuntu 14.04 (I don't know about 15.10), with an older version of the c compiler: It can not compile with CONFIG_CC_STACKPROTECTOR_STRONG.
scripts/config --disable CC_STACKPROTECTOR_STRONG
Compile the kernel:
time make -j9 bindeb-pkg <<< Suggest use number of CPUs + 1. Use less for some responsiveness to be left for other uses
<<< I always time the kernel build.
time make -j9 bindeb-pkg LOCALVERSION=-stock <<< For a localized verion name append
time make -j9 olddefconfig bindeb-pkg LOCALVERSION=-stock <<< To automatically use defaults for any new config stuff (particuarly useful when bisecting the kernel).
When the build has completed, install it:
sudo dpkg -i ../linux-headers-4.4.0-rc8-stock_4.4.0-rc8-stock-144_amd64.deb
sudo dpkg -i ../linux-image-4.4.0-rc8-stock_4.4.0-rc8-stock-144_amd64.deb
So, at this point we know the mainline kernel compiles O.K., so move onto the custom kernel. Create a new branch, apply the patches and compile:
$ git checkout -b k44rc8_custom v4.4-rc8
Switched to a new branch 'k44rc8_custom'
$ git am plv6_1_3.patch
Applying: cpufreq: intel_pstate: configurable algorithm to get target pstate
$ git am plv6_2_3.patch
Applying: cpufreq: intel_pstate: account for non C0 time
$ git am plv6_3_3.patch
Applying: cpufreq: intel_pstate: Account for IO wait time
$ time make -j9 olddefconfig bindeb-pkg LOCALVERSION=-custom
Note that it is on purpose that I do not do a
make clean, as it is desirable to save a lot of time by doing an incremental build. The first compile took 21 minutes and 26 seconds, but the next custom compile took only 4 minutes and 43 seconds.