Ubuntu kernel for OMAP4

From OMAPpedia

(Difference between revisions)
Jump to: navigation, search
m (Case 2: the kernel packages .deb files are available)
 
Line 1: Line 1:
This page describes simple instructions for getting and generating OMAP4 Ubuntu kernel packages.
This page describes simple instructions for getting and generating OMAP4 Ubuntu kernel packages.
-
More detailed or alternative approaches are available on other pages linked here
 
-
The standard compilation and packaging for Ubuntu kernel is made natively (on ARM device).
+
The standard compilation and packaging for Ubuntu kernel is made natively (on ARM device) on ti-ubuntu-L24.* and glp1.4 branches.
-
'''So these instructions are for native compilation / packaging. However when applicable, additional instructions are also provided for cross-compilation.'''
+
'''Since Kernel 3.0, Cross Compilation is supported and encouraged.'''
-
These instructions are for a Ubuntu target or host.
+
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.
+
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.
= Introduction to kernel packages =
= Introduction to kernel packages =
-
Ubuntu kernels are delivered in the form of Debian packages. For OMAP4, you needat least the following kernel packages:
+
Ubuntu kernels are delivered in the form of Debian packages. For OMAP4, you need at least the following kernel packages:
* 1 package for the kernel image and modules: linux-image-<kernel version>-<abi>-omap4
* 1 package for the kernel image and modules: linux-image-<kernel version>-<abi>-omap4
** installs kernel modules in /lib/modules
** installs kernel modules in /lib/modules
Line 21: Line 20:
** If your file-system hosts some DKMS-handled kernel modules (like WLAN and SGX for OMAP4), installing these header files will trigger the re-build and re-install of the DKMS kernel modules.
** If your file-system hosts some DKMS-handled kernel modules (like WLAN and SGX for OMAP4), installing these header files will trigger the re-build and re-install of the DKMS kernel modules.
-
=> 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 re-gerenerate 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]].
+
=> 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]].
 +
 
 +
= 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.
 +
 
 +
== 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.
 +
 
 +
=== 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.
 +
 
 +
=== 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.
 +
 
 +
== Additional Build Environment Prerequisites ==
 +
 
 +
* Install packages required for kernel packages build - this is valid on Cross Compilation and Native environment:
 +
sudo apt-get build-dep linux-image-$(uname -r)
 +
sudo apt-get install dpkg-dev kernel-wedge
= Ubuntu kernel sources =
= Ubuntu kernel sources =
 +
There are several git trees hosting the sources for Ubuntu kernel supporting OMAP4:
There are several git trees hosting the sources for Ubuntu kernel supporting OMAP4:
-
* Official Ubuntu git tree: http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-maverick.git;a=shortlog;h=refs/heads/ti-omap4 (ti-omap4 branch)
+
* Official Ubuntu git tree: http://kernel.ubuntu.com/git then you need to find the tree for your Ubuntu Release, e.g.: ubuntu/ubuntu-precise.git. Then consider ti-omap4 branch.
* TI Ubuntu git tree: http://dev.omapzoom.org/?p=integration/kernel-ubuntu.git
* TI Ubuntu git tree: http://dev.omapzoom.org/?p=integration/kernel-ubuntu.git
-
The instructions in this page apply to both the official Ubuntu tree and the TI tree from release L24.10.
+
The instructions in this page apply to both the official Ubuntu tree and the TI tree from release L24.x and GLP1.x.
-
 
+
-
TI tree contains additional features, but may be less stable than the official Ubuntu tree (which contains Ubuntu Maverick for OMAP4 code).
+
The preferred way of retrieving the kernel sources is to use git. For example:
The preferred way of retrieving the kernel sources is to use git. For example:
-
  git clone git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git
+
* Official Ubuntu git tree:
 +
  git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git
  git checkout -b working origin/ti-omap4
  git checkout -b working origin/ti-omap4
 +
* TI Ubuntu git tree:
 +
git clone git://dev.omapzoom.org/pub/scm/integration/kernel-ubuntu.git
 +
git checkout -b working origin/ti-ubuntu-3.4-1486
-
(Note that an alternative to git to retrieve the kernel sources is to run: apt-get source linux-image-<kernel version>-<abi>-omap4)
+
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.
 +
 
 +
= Building the kernel: generate a kernel package =
'''All the following instructions shall be run from the kernel root folder.'''
'''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)
(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.
-
= Building the kernel: generate a kernel package =
+
== '''ARMHF''' Cross-Compilation ==
-
* Install packages required for building:
+
* Export Variables:
-
(Considering that you already run a quite recent Ubuntu kernel - means: supported by these instruction)
+
export ARCH=arm
-
  sudo apt-get build-dep linux-image-$(uname -r)
+
  export CROSS_COMPILE=arm-linux-gnueabi'''hf'''-
* Generate the kernel package
* Generate the kernel package
  fakeroot debian/rules clean
  fakeroot debian/rules clean
-
  dpkg-buildpackage -B -uc -us
+
  do_tools=false skipabi=true skipmodule=true dpkg-buildpackage -B -a'''armhf''' -uc -us
-
=> The kernel packages (*.deb) are generated in the parent folder.
+
== '''ARMEL''' Cross-Compilation ==
-
'''Alternative commands for cross-compilation''' (using code-sourcery for example):
+
* Export Variables:
 +
export ARCH=arm
 +
export CROSS_COMPILE=arm-linux-gnueabi-
 +
 
 +
* Generate the kernel package
  fakeroot debian/rules clean
  fakeroot debian/rules clean
-
  CROSS_COMPILE=<path to cross-toolchain/bin>/arm-none-linux-gnueabi- do_tools=false dpkg-buildpackage -B -aarmel -uc -us
+
  do_tools=false skipabi=true skipmodule=true dpkg-buildpackage -B -a'''armel''' -uc -us
-
(note that the do_tools=false option will prevent the tools package from beeing generated. Building this package fails with some cross-toolchains like CodeSourcery 2010q1)
+
== Native Compilation ==
 +
 
 +
* Just Generate the kernel package
 +
fakeroot debian/rules clean
 +
skipabi=true skipmodule=true dpkg-buildpackage -B -uc -us
= Customize the kernel =
= Customize the kernel =
 +
 +
== 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:
 +
* Checkout the reference commit id / tag of the kernel you want to modify
 +
* Apply your patch(es)
 +
* Edit file debian.ti-omap4/changelog and modify the current version (first line of the file) with "+<comment><id>", for example:
 +
linux-ti-omap4 (3.4.0-1486.4'''+mytest1''') precise; urgency=low. '''DO NOT USE "_" or "-" character.'''
 +
* Commit this small modification into a dedicated commit.
 +
* Rebuild
 +
== Change the kernel config ==
== 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:
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:
  # You must have run the following 'clean' command at least once before:
  fakeroot debian/rules clean
  fakeroot debian/rules clean
-
 
  fakeroot debian/rules editconfigs
  fakeroot debian/rules editconfigs
-
... and answer 'y' to the question (Do you want to edit config: armel/config.flavour.omap4).
+
... 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...
-
== ABI or modules list change ==
+
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.
-
The kernel ABI (Application Binary Interface) are the exported functions that modules (AKA drivers) can use to do things in kernel space (see [https://wiki.ubuntu.com/KernelTeam/BuildSystem/ABI here] for more information)
+
-
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 to your dpkg-buildpackage command-line:
+
You might then archive the new generated config locally in your git tree.
-
skipabi=true skipmodule=true
+
-
 
+
-
== Change the package version ==
+
-
To generate a package with a different version number: edit debian.ti-omap4/changelog and modify the 1st line version number. For example:
+
-
- linux-ti-omap4 (2.6.35-980.1release3) maverick; urgency=low
+
-
+ linux-ti-omap4 (2.6.35-980.1release3+test1) maverick; urgency=low
+
-
=> then generate the package. Its name will include this new version information.
+
= Install a kernel package =
= Install a kernel package =
-
== Case 1: the kernel packages are on a PPA ==
+
== 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
 +
 
 +
== 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:
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 update
Line 97: Line 159:
Ex: sudo apt-get install linux-image-2.6.34-900-omap4=2.6.34-900.1~ti+release0
Ex: sudo apt-get install linux-image-2.6.34-900-omap4=2.6.34-900.1~ti+release0
-
== Case 2: the kernel packages .deb files are available ==
+
= Install the kernel uImage to the boot partition =
-
Installing is as simple as:
+
-
sudo dpkg -i <kernel packages>.deb
+
-
Important point: install all 3 following packages in this order (the order is important between the headers packages):
+
With recent Ubuntu distro (precise at least) there is no need to execute this step, kernel is flashed automatically into the boot partition.
-
linux-headers-<kernel version>-<abi>
+
-
linux-headers-<kernel version>-<abi>-omap4
+
-
linux-image-<kernel version>-<abi>-omap4
+
-
(This order will ensure that any DKMS modules relying on the kernel headers will be able to build upon install of these new headers)
+
-
 
+
-
For example:
+
-
sudo dpkg -i linux-headers-2.6.35-980-omap4_2.6.35-980.1release3_armel.deb linux-headers-2.6.35-980_2.6.35-980.1release3_armel.deb linux-image-2.6.35-980-omap4_2.6.35-980.1release3_armel.deb
+
-
(Does not this example exchange the installation order of the linux-headers from the order shown above? i.e. -omap4 first)
+
-
 
+
-
= Install the kernel uImage to the boot partition =
+
-
Once the kernel packages are installed, installing the new kernel image to the boot partition is as easy as:
+
On older Ubuntu distro, you need to execute manually:
  sudo flash-kernel
  sudo flash-kernel

Latest revision as of 08:56, 23 August 2012

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