7

I'm running Ubuntu 15.10 on a new laptop but in order to get proper full support for this hardware I apparently need the 4.4 kernel + a custom patch. See here if you're interested in the details.

I know about the mainline kernel PPAs but my understanding is that they don't come with source. If this is the case, This would seem to eliminate the possibility of using a mainline kernel PPA because I can't patch it. So I've been trying to check out the git source and build it but can't find up to date, relevant instructions.

Can somebody help with instructions for building a 4.4 kernel on 15.10?

9

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?).

Prerequisites (Must):

Step 1 is to apt-get update and apt-get dist-upgrade (i.e. make sure everything is up to date)
Step 2

sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge

Step 3

sudo apt-get build-dep linux

Step 4

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

Prerequisites (Optional):

sudo apt-get install git-email git-doc

The git part:

mkdir temp-k-git
cd temp-k-git
git clone   git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux

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.

or

time make -j9 bindeb-pkg LOCALVERSION=-stock    <<< For a localized verion name append

or

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.

  • So in this approach I don't apply the Ubuntu kernel patches that create the debian directory right? – Marplesoft Jan 9 '16 at 0:20
  • No, it should be exactly as I wrote. Codewise, the mainline ppa should be the same as the kernel.org code. Myself, I have never had much success with debian rules methods. – Doug Smythies Jan 9 '16 at 0:43
1

If you go to the page http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.4-rc8-wily you will find a README indicating how to obtain the source files for 4.4rc8

Instructions for build are a little confusing. I've seen several recipes for building the kernels, all a little different. There are several prerequisites: There may be some others that are required for the 4.4 kernel

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

Then the commands I have issued for a sucsessful build are:

chmod a+x debian/scripts/*
chmod a+x debian/scripts/misc/*
nano debian.master/changelog
fakeroot debian/rules clean
fakeroot debian/rules editconfigs
fakeroot debian/rules binary-headers binary-generic skipabis=true

Modifying the changelog file to indicate that I am creating my own kernel, by adding something to the end of the first version number that is shown.

  • Thanks. But I had two issues with this: 1) debian/rules didn't have the execute flag, no big deal to add but just a minor variation and 2) The build errored out with debian/rules.d/2-binary-arch.mk:50: recipe for target '/home/ryan/dev/mainline/debian/stamps/stamp-build-generic' failed Any ideas? – Marplesoft Jan 8 '16 at 15:57
  • @Marplesoft My checkout had the correct flags but my fakeroot debian/rules clean has errors when running debian.master/reconstruct due to the missing ubuntu/ directory. I was able to work around this but don't understand why. See my question at askubuntu.com/questions/729469/… . – Lucas Feb 4 '16 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.