KernelBuild

Differences between revisions 3 and 17 (spanning 14 versions)
Revision 3 as of 2012-11-06 16:42:46
Size: 2055
Editor: 79-119-116-74
Comment:
Revision 17 as of 2012-11-10 19:54:22
Size: 2557
Editor: p5494D845
Comment: needed to config the kernel
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<Include(Nexus7/Header)>>
Line 8: Line 10:
sudo apt-get install gcc-arm-linux-gnueabihf ccache sudo apt-get install gcc-arm-linux-gnueabihf ccache git kernel-wedge libncursesw5-dev
Line 13: Line 15:

---- /!\ '''Edit conflict - other version:''' ----
Line 16: Line 16:
git clone git://kernel.ubuntu.com/jani/ubuntu-nexus7.git git clone git://kernel.ubuntu.com/hwe/ubuntu-nexus7.git
Line 19: Line 19:
---- /!\ '''Edit conflict - your version:''' ----
$git clone git://kernel.ubuntu.com/jani/ubuntu-nexus7.git
Create an alias called fdr that points to fakeroot debian/rules. You can stick this in ~/.bash_aliases and then source the file to make it permanent.
Line 22: Line 21:
---- /!\ '''End of edit conflict''' ---- {{{
alias fdr="fakeroot debian/rules"
}}}
Line 28: Line 29:
$cd ubuntu-nexus7 {{{
cd ubuntu-nexus7
}}}
Line 32: Line 35:
$git clean -xdf {{{
git clean -xdf
}}}
Line 36: Line 41:
$sed -i '/do_tools/ s/true/false/' debian.linaro/rules.d/armhf.mk {{{
sed -i '/do_tools/ s/true/false/' debian.linaro/rules.d/armhf.mk
}}}
Line 38: Line 45:
Calling fdr clean is necessary before each build. (fdr is the shell alias for fakeroot debian/rules which is typed quite often while working with the kernel package) Calling fakeroot debian/rules (fdr) clean is necessary before each build.
Line 40: Line 47:
$fdr clean {{{
fdr clean
}}}
Line 42: Line 51:
This will 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 :)
Line 44: Line 52:
$debuild -eDEB_BUILD_OPTIONS="parallel=3" -eCROSS_COMPILE="ccache arm-linux-gnueabihf-" -b -aarmhf -us -uc -nc 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. The value for parallel works best when it equals the number of CPUs in your system + 1.

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

== Change the configuration ==

The configuration file is in debian.linaro/config/config.common.ubuntu

Bring up menuconfig

{{{
fdr editconfigs
}}}

See what you have changed

{{{
git diff
}}}

Or edit that file manually and then updateconfigs so it checks your changes and fixes up any possible side-effects

{{{
fdr updateconfigs
}}}

Then run debuild again as above
Line 50: Line 86:
This does an out of source tree build of a zImage (no modules) using the current Ubuntu configs. Faster than a full package build. This does an out of source tree build of a zImage (no modules) using the current Ubuntu configs. Faster than a full package build. Like the value for parallel mentioned above, the -j value works best when it is number of CPUs + 1.
Line 52: Line 88:
$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.
{{{
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 -j3 zImage
}}}

This project is no longer maintained. You might be interested in Ubuntu Touch though.

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 kernel-wedge libncursesw5-dev

Get the source

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

Create an alias called fdr that points to fakeroot debian/rules. You can stick this in ~/.bash_aliases and then source the file to make it permanent.

alias fdr="fakeroot debian/rules"

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.

fdr 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. The value for parallel works best when it equals the number of CPUs in your system + 1.

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

Change the configuration

The configuration file is in debian.linaro/config/config.common.ubuntu

Bring up menuconfig

fdr editconfigs

See what you have changed

git diff

Or edit that file manually and then updateconfigs so it checks your changes and fixes up any possible side-effects

fdr updateconfigs

Then run debuild again as above

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. Like the value for parallel mentioned above, the -j value works best when it is number of CPUs + 1.

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 -j3 zImage

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