Ubuntu kernel for OMAP4

From OMAPpedia

Revision as of 08:56, 23 August 2012 by Xboudet (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes simple instructions for getting and generating OMAP4 Ubuntu kernel packages.

The standard compilation and packaging for Ubuntu kernel is made natively (on ARM device) on ti-ubuntu-L24.* and glp1.4 branches.

Since Kernel 3.0, Cross Compilation is supported and encouraged.

These instructions are for a Ubuntu target and/or host.

For any support, feel free to join us on irc at #ubuntu-arm, #pandaboard or #linux-omap on irc.freenode.net or to join pandaboard@googlegroups.com.

Contents

[edit] Introduction to kernel packages

Ubuntu kernels are delivered in the form of Debian packages. For OMAP4, you need at least the following kernel packages:

=> Using packages, Ubuntu kernel can be handled like almost any other Ubuntu package, using Aptitude, apt or dpkg. This allows very easy kernel upgrades, and installation of kernel headers when necessary. For this reason, it is favored to regenerate kernel packages and install these packages to upgrade your Ubuntu file-system with a new kernel. This is what this page deals about. However for some cases it may be more convenient to just re-build a kernel and not package it. This is also described in this page: Ubuntu kernel build alternatives.

[edit] Build Environment Setup

Kernel packages can be build natively on OMAP4 boards with Ubuntu Filesystem or Cross Compiled on Ubuntu Machine.

We encourage to use Cross Compilation environment.

[edit] Cross Compiler setup

Since Ubuntu precise (12.04), hardware floating-point support was introduced (armhf). So armhf cross-compiler are required for precise (12.04) environment and after whereas armel cross-compiler shall be used.

[edit] armhf cross-compiler setup

On precise machine and after, you just need to install the following meta-packages:

$ sudo apt-get install gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf

If your are on oneiric machine or lower distro, you can either upgrade to more recent distro or install armhf standalone linaro cross compiler, please refer to the following page: https://launchpad.net/linaro-toolchain-binaries and download the most recent linux armhf cross compiler. Please refer to the README.txt to complete the setup and to export Compiler directory to the PATH.

[edit] armel cross-compiler setup

Just execute the following commands:

$ sudo apt-get install gcc-arm-linux-gnueabi cpp-arm-linux-gnueabi

You can also use code-sourcery armel cross-compiler.

[edit] Additional Build Environment Prerequisites

sudo apt-get build-dep linux-image-$(uname -r)
sudo apt-get install dpkg-dev kernel-wedge

[edit] Ubuntu kernel sources

There are several git trees hosting the sources for Ubuntu kernel supporting OMAP4:

The instructions in this page apply to both the official Ubuntu tree and the TI tree from release L24.x and GLP1.x.

The preferred way of retrieving the kernel sources is to use git. For example:

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git
git checkout -b working origin/ti-omap4
git clone git://dev.omapzoom.org/pub/scm/integration/kernel-ubuntu.git
git checkout -b working origin/ti-ubuntu-3.4-1486

Note: an alternative to git to retrieve the kernel sources is to run: apt-get source linux-image-<kernel version>-<abi>-omap4. This is valid only for native build.

[edit] Building the kernel: generate a kernel package

All the following instructions shall be run from the kernel root folder. (this is the one with arch, debian debian.ti-omap4 etc. directories in it) => The kernel packages (*.deb) will be generated in the parent folder.

[edit] ARMHF Cross-Compilation

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
fakeroot debian/rules clean
do_tools=false skipabi=true skipmodule=true dpkg-buildpackage -B -aarmhf -uc -us

[edit] ARMEL Cross-Compilation

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
fakeroot debian/rules clean
do_tools=false skipabi=true skipmodule=true dpkg-buildpackage -B -aarmel -uc -us

[edit] Native Compilation

fakeroot debian/rules clean
skipabi=true skipmodule=true dpkg-buildpackage -B -uc -us

[edit] Customize the kernel

[edit] GLP kernel modification and rebuild guidelines

Developer might need to rebuild a kernel with his own modifications, generating packages is a good solution to ease module installation and do comply with dkms packages. The only recommendation is to update the package version before to generate new packages to distinguish your work with existing packages.

To do this, proceed as follow:

linux-ti-omap4 (3.4.0-1486.4+mytest1) precise; urgency=low. DO NOT USE "_" or "-" character.

[edit] Change the kernel config

The Ubuntu kernel config is located in debian.ti-omap4/config/config.common.ubuntu. To edit the config, run the 'editconfigs' command:

# You must have run the following 'clean' command at least once before:
fakeroot debian/rules clean
fakeroot debian/rules editconfigs

... and answer 'y' to the question(s) (Do you want to edit config: arm[el|hf]/config.flavour.omap4). The debian environment is designed to support armel and armhf environment, modifying config through menu might not have the expected behavior, you might for example enable an option only in armel...

This is the reason why it might be easier to modify directly debian.ti-omap4/config/config.common.ubuntu and to check/regenerate it through the above procedure. Then say "yes" to all questions and exit without modifying from kernel menu.

You might then archive the new generated config locally in your git tree.

[edit] Install a kernel package

[edit] Case 1: the kernel packages .deb files are available

Above build instructions shall have generated at least these 3 files (other udeb files can be ignored):

linux-headers-<kernel version>-<abi>
linux-headers-<kernel version>-<abi>-omap4
linux-image-<kernel version>-<abi>-omap4

Copy these 3 files on your Panda and install them in the same dpkg command, e.g.:

sudo dpkg -i linux-*_<version>_armhf.deb

On Precise: Sometimes, the pvr-omap dms module is not rebuilt whereas it should, if after the reboot, module "omapdrm_pvr" is not loaded, please execute following command to force the rebuild:

sudo apt-get install --reinstall pvr-omap4-dkms

[edit] Case 2: the kernel packages are on a PPA

If the package you want to install is on a PPA, make sure the PPA is listed in your /etc/apt/sources.list file, and run:

sudo apt-get update
sudo apt-get install linux-headers-<kernel release> linux-image-<kernel release>

where <kernel release> is the information returned by uname -r. for example for official Ubuntu 10.10: 2.6.35-903-omap4.

Note that several versions of a package may be available, This can be seen by running:

apt-cache show <package name> | grep Version

To install one specific version of a package:

sudo apt-get install <package-name>=<package version>

Ex: sudo apt-get install linux-image-2.6.34-900-omap4=2.6.34-900.1~ti+release0

[edit] Install the kernel uImage to the boot partition

With recent Ubuntu distro (precise at least) there is no need to execute this step, kernel is flashed automatically into the boot partition.

On older Ubuntu distro, you need to execute manually:

sudo flash-kernel

Note on flash-kernel: This script will take some input files into the /boot folder (vmlinuz, Initrd, boot.script), generate u-boot friendly version of these images (uImage, uInitrd and boot.scr), and install them on the boot partition. flash-kernel grabs the path to the target boot partition in /etc/flash-kernel.conf (UBOOT_PART variable).

[edit] Updating kernel bootargs

Kernel command line is passed through u-boot and by the mean of a boot.scr file hosted on the boot partition. To update the boot.scr script:

  1. modify /boot/boot.script
  2. re-generate boot.scr: sudo flash-kernel

Note: it you don't have a /boot/boot.script file, you can generate one from the boot.scr located on your boot partition by doing a strings boot.scr > boot.script

Alternate method to generate boot.scr from boot.script

mkimage -A arm -T script -C none -n "Boot Image" -d boot.script boot.scr

[edit] kernel and WLAN / SGX kernel drivers

On Ubuntu 10.10 and TI Ubuntu releases for OMAP4, two out of tree kernel modules need to be re-built each time the kernel image changes: WLAN and SGX (omap_gpu)

(Note: the need for modules re-build for each new kernel image is enforced by not defining the CONFIG_MODVERSIONS kernel flag. This is a requirement from current WLAN driver itself)

To make re-building of these modules transparent to the Ubuntu user, WLAN and SGX (omap_gpu) modules are handled through DKMS. So when installing new kernel header packages, DKMS will try to re-build WLAN and SGX modules for this new kernel. (note that if you build the kernel packages, they must be built natively: cross-compiled kernel headers packages will make DKMS modules build fail. See Bug 666267)

If you use a non-packaged kernel, you need to re-build the out of tree drivers yourself. Note that DKMS may still help you in this task, but would will have to provide the proper pointers to your kernel source tree and configuration to DKMS manually.

Some links about DKMS: DKMS manpage, DKMS homepage, DKMS tutorial, DKMS Ubuntu package tutorial

[edit] Links

Ubuntu kernel build alternatives

Launchpad OMAP4 Ubuntu kernel bugs tracking: https://bugs.edge.launchpad.net/ubuntu/+source/linux-ti-omap4/

Ubuntu kernel page: https://wiki.ubuntu.com/Kernel

Ubuntu kernel dev: https://wiki.ubuntu.com/Kernel/Dev

How to package your kernel from scratch: https://wiki.linaro.org/Resources/HowTo/PackageYourOwnKernel

Step by step blog guide to compiling the Ubuntu Kernel http://adventuresinsilicon.blogspot.com/2011/02/pandaboard-ubuntu-how-to-recompile.html

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox