KernelBuild

Differences between revisions 6 and 7
Revision 6 as of 2012-11-06 16:48:23
Size: 1990
Editor: c-75-71-83-192
Comment:
Revision 7 as of 2012-11-06 16:49:23
Size: 1934
Editor: c-75-71-83-192
Comment:
Deletions are marked like this. Additions are marked like this.
Line 37: Line 37:
Calling fakeroot debian/rules (fdr) clean is necessary before each build. Calling fakeroot debian/rules (fdr) clean is necessary before each build. Note: Most people working with the kernel package add an alias of the fakeroot debian/rules command to fdr.
Line 41: Line 41:
}}}

Most people working with the kernel package add an alias of the fakeroot debian/rules command to fdr as follows:

{{{
alias fdr="fakeroot debian/rules"

Here's how to cross-build the kernel from the git repository.

Initial setup

Having ccache installed is optional but helpful if you are often rebuilding the package from scratch with minor modifications.

sudo apt-get install gcc-arm-linux-gnueabihf ccache git

Get the source

git clone git://kernel.ubuntu.com/jani/ubuntu-nexus7.git

Rebuild the package

Go to the source directory

cd ubuntu-nexus7

Remove leftover from previous builds or other cruft

git clean -xdf

You need to do the following in order to disable cross-building of the linux-tools binary package, as that requires multiarch setup and some armhf libs installed in the host system.

sed -i '/do_tools/ s/true/false/' debian.linaro/rules.d/armhf.mk

Calling fakeroot debian/rules (fdr) clean is necessary before each build. Note: Most people working with the kernel package add an alias of the fakeroot debian/rules command to fdr.

fakeroot debian/rules clean 

Next we create the package, and depending on your system speed, ccache and on the kernel configurations that are enabled it can take anywhere between 3 minutes and a couple of hours Smile :)

debuild  -eDEB_BUILD_OPTIONS="parallel=3" -eCROSS_COMPILE="ccache arm-linux-gnueabihf-"  -b -aarmhf -us -uc  -nc

Build zImage only

Sometimes you just want a zImage for a quick test such as inserting it in a boot.img and trying it out without a full deb installation.

This does an out of source tree build of a zImage (no modules) using the current Ubuntu configs. Faster than a full package build.

cd ubuntu-nexus7
mkdir ../build
cp debian.linaro/config/config.common.ubuntu ../build/.config
CROSS_COMPILE="ccache arm-linux-gnueabihf-"  ARCH=arm make  O=../build -j 8 zImage

In the above snippets -j and parallel= are obviously to be adjusted depending on need.

Nexus7/KernelBuild (last edited 2012-11-13 11:07:36 by dholbach)