Ubuntu kernel build alternatives
From OMAPpedia
(Created page with 'This page gathers several options for building an Ubuntu kernel, either as a package or directly using the standard kernel make command, both natively (on an ARM board) or cross-…') |
|||
| Line 1: | Line 1: | ||
| - | This page gathers several options for building an Ubuntu kernel, either as a package or directly using the standard kernel make command, both natively (on an ARM board) or cross-compiled. | + | 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]]: |
| + | * kernel packaging using debuild | ||
| + | * kernel packaging using dpkg-build-package | ||
| + | * kernel packaging using debian/rules | ||
| + | * standard kernel building (kernel Makefile) | ||
| + | |||
| + | = 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 one: https://wiki.linaro.org/WorkingGroups/ToolChain/CrossCompilerOnLucid | ||
| + | * CodeSourcery one (2010q1 link): http://www.codesourcery.com/sgpp/lite/arm/portal/release1293 | ||
| + | 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-. | ||
| + | |||
| + | == 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 | ||
| + | |||
| + | (note: the do_tools=false is required with CodeSourcery 2010q1 - to be checked with Linaro or more recent CodeSourcery) | ||
| + | |||
| + | == 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 | ||
| + | |||
| + | |||
| + | = 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 = | ||
Revision as of 13:01, 18 November 2010
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:
- kernel packaging using debuild
- kernel packaging using dpkg-build-package
- kernel packaging using debian/rules
- standard kernel building (kernel Makefile)
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 one: https://wiki.linaro.org/WorkingGroups/ToolChain/CrossCompilerOnLucid
- CodeSourcery one (2010q1 link): http://www.codesourcery.com/sgpp/lite/arm/portal/release1293
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-.
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
(note: the do_tools=false is required with CodeSourcery 2010q1 - to be checked with Linaro or more recent CodeSourcery)
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
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.*'