Ubuntu kernel build alternatives

From OMAPpedia

Revision as of 13:24, 18 November 2010 by Sebastien Jan (Talk | contribs)
Jump to: navigation, search

This page gathers several options for building an Ubuntu kernel, either as a binary package or directly using the standard kernel make command, both natively (on an ARM board) or cross-compiled.

Several ways for generating an Ubuntu kernel are described here. Prefered way is described here Ubuntu kernel for OMAP4:

Contents

A note on required tools / packages

If you need to generate kernel packages, you will have to install additional tools. Most of the tools can be installed by running:

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

Here is a non-exhaustive list of the packages that are usually required for packaging: git-core debhelper build-essential fakeroot kernel-wedge libelf-dev debhelper xmlto docbook-utils gs transfig sharutils pbuilder binutils-dev libdw-dev asciidoc

Native compilation

debuild

debuild is a wrapper on top of dpkg-buildpackage. It is installed with the devscript package: sudo apt-get install devscript

debuild -b -uc -us

dpkg-buildpackage

fakeroot debian/rules clean
dpkg-buildpackage -B

debian/rules

fakeroot debian/rules clean
export $(dpkg-architecture -aarmel)
do_tools=false fakeroot debian/rules binary-arch

kernel Makefile

cp debian.ti-omap4/config/config.common.ubuntu .config
make
make uImage 

Cross-compilation

Here, you will need a cross toolchain. The cross-toolchains usually used are:

Linaro toolchain is prefered as more up to date, and in line with the gcc shipping with Ubuntu.

The examples below assume you are using the CodeSourcery 2010q1 toolchain. If you want to use Linaro instead, just replace arm-none-linux-gnueabi- by arm-linux-gnueabi-.

Note: the do_tools=false option is required with CodeSourcery 2010q1. It will prevent the generation of the tools binary package (including perf) that would fail with CodeSourcery 2010q1 toolchain (to be checked with Linaro or more recent CodeSourcery).

debuild

debuild -eCROSS_COMPILE=arm-none-linux-gnueabi- --prepend-path=<path to your codegen .../bin/> -edo_tools=false -aarmel -uc -us -b

(replace <path to your codegen .../bin/> with the correct path)

dpkg-buildpackage

fakeroot debian/rules clean
CROSS_COMPILE=arm-none-linux-gnueabi- do_tools=false dpkg-buildpackage -B -aarmel -uc -us

debian/rules

fakeroot debian/rules clean
export $(dpkg-architecture -aarmel)
CROSS_COMPILE=arm-none-linux-gnueabi- do_tools=false fakeroot debian/rules binary-arch

kernel Makefile

cp debian.ti-omap4/config/config.common.ubuntu .config
CROSS_COMPILE=arm-none-linux-gnueabi- make
CROSS_COMPILE=arm-none-linux-gnueabi- make uImage 

ABI and modules change verification

The kernel packaging tools will fail package creation if the kernel ABI or modules-list changed since the last packaged version. This test can be skipped to complete the package creation in spite of ABI or modules list change. Add the following option depending on your build method:

kernel source package

The kernel source package contains the kernel sources. Here is an easy way to generate it:

git clean -fdx
fakeroot debian/rules clean
time debuild -S -sa -uc -us -I.git -I.gitignore -i'\.git.*' 


Links

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox