Kernel Build

From Gumstix User Wiki
Revision as of 04:16, 19 November 2013 by Conor O'Rourke (Talk | contribs)

Jump to: navigation, search

This wiki entry adds a few details on building the Gumstix Linux kernel from source.

Start by installing the toolchain.

You will also need the U-boot 'mkimage' utility. Debian and Ubuntu users can install it from their respective repositories. It's also compiled when U-boot is built if you can't get it otherwise. On top of that you will need 'git' and 'make'.

$ sudo apt-get install uboot-mkimage git make

The official kernel build instructions are the best source to describe building a kernel and are up to date. The gumstix kernels are stored on github and are in different branches for differing platforms. There is a table of branches against platforms on the gumstix.org website.

The most usual way to pull the source code is using git:

$ git clone --branch omap-3.6 git://github.com/gumstix/linux.git Linux

will clone the entire source tree to your machine and checkout the omap-3.6 branch into the "linux" directory. There are plenty of guides online to using git but a few timesaving methods are worth mentioning:

Cloning a shallow tree

You can clone just the tip of the relevant branch using a shallow clone. This has some restrictions but saves time and bandwidth:

 $ git clone --depth 1 --branch omap-3.6 https://github.com/gumstix/linux.git omap-3.6

As of November 2013, this will pull 190MB from the server instead of over a gigabyte.

You can also pull a zip file of this branch, either using the website or by finding the appropriate link (use the website!) and using curl or wget.

 $ wget https://github.com/gumstix/linux/archive/omap-3.6.zip

(this will do a 301 redirect so be aware of this - you might get a very small file with html in it!)

For the 3.6 branch, this will pull approximately 123MB from the github server.

Subtleties

There is absolutely no difference in result aside from the presence of the ".git" directory, but this has a few subtle consequences. If you build with the zip file, you will get kernel and module versions stamped "3.6.0". If you build from the git repository, the make process:

  • detects the git repository presence
  • see that the checkout is not stamped with a tag (eg: "3.6.0").
  • adds a + to all versions to show that the repository is not officially 3.6.0.

Thus you will get kernel and module version stamped with "3.6.0+". If you try and load a 3.6.0+ module into a 3.6.0 kernel, it will fail with an "invalid module format" error. You can force it with "modprobe -f" but that isn't really a recommended action generally. The normal procedure is to install the kernel and modules together (see the website for details.

You can override the version modification by setting LOCALVERSION (to anything) before running make.