[Home]XenomaiKernelPackageFromUbuntuGit

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Showing revision 2

Building Ubuntu and Debian Xenomai Kernel Packages from the Ubuntu Kernel Git Tree

This page explains how to apply the Xenomai patches to the Ubuntu kernel git tree, set up a 'xenomai' kernel 'flavour' configuration, and build.

This is an appropriate method for maintaining a xenomai kernel package on a sustained basis. However, for those wanting a one-off kernel, see the more light-weight howto here: XenomaiKernelPackageFromTarball

The workflow here isn't fully developed yet. One tricky part is the Xenomai patch must be applied with each new release. Therefore, the kernel source itself should probably be left untouched in the master branch, but the extra configuration in the debian.master/ and debian/ directories should be committed and rebased onto a new branch for each new Xenomai release.

There are a few advantages of this approach over building one-off packages from tarballs. The main advantage is that the kernel is built as a 'flavour', with a more meaningful package name that can be Required by the LinuxCNC package, and the package will better co-exist with other packages. Other kernel flavours can be maintained in the same git repo. Kernel configuration becomes manageable, since the base configuration originates from Ubuntu, which runs on a huge variety of hardware; a minimal set of changes is applied to configure Xenomai. And of course there are advantages stemming from using git.

This recipe was developed on Ubuntu Precise, but may work for other versions of Debian-like distros. It is known to work for x86 architecture. Other architectures will require small changes to the flavour configuration to work properly; see the diffs in the debian* directories between the master and the xenomai branches.

The most difficult part of building kernel packages is finding a working kernel config. This recipe adds a minimal and well-documented set of changes to configure the Xenomai system. Because of the way the kernel build scripts work, the original config files are buried in older commits of the xenomai branch; either search for them there, or see here: https://github.com/zultron/kernel-tools

Disclaimer: This author (John Morris/'zultron') is not even a Debian user. This procedure most certainly has flaws.

Prerequisites

You should have already built and installed the xenomai tools package as described here: XenomaiUserlandPackage

Install development packages

The following may not be enough; please edit if something is missing.

 # Package build prereqs:
 sudo apt-get install devscripts debhelper dh-kpatches findutils build-essential

 # Kernel build prereqs:
 sudo apt-get install kernel-package libncurses-dev fakeroot zlib1g-dev
 sudo apt-get install crash kexec-tools makedumpfile kernel-wedge
 sudo apt-get install flex bison

 # Git build prereqs
 sudo apt-get install git-core git-buildpackage

Clone the Ubuntu kernel repository

The needed configuration is already in the author's git tree, so after cloning the ubuntu kernel repo, pull from that repo, hosted on github. It contains all the xenomai flavour configuration and the kernel source is currently patched for kernel v3.5.3 with Xenomai v2.6.2. It will be apparent from the history what changes have been made. The main changes of interest are in the debian* directories; changes outside those directories are from the xenomai patch.

 # Clone the ubuntu kernel repo
 # This will take a long time, with over 2 million objects
 git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git

 # Pull the flavour configuration from the zultron repo
 git remote add -f zultron git@github.com:zultron/kernel-xenomai-deb-pkg-precise.git
 git checkout -b 3.5.3-xeno zultron/3.5.3-xeno

Build the kernel the first time

 # Clean the build tree and update the debian/ directory
 fakeroot debian/rules clean

 # Build binary packages into the parent directory
 skipabi=true skipmodule=true fakeroot debian/rules binary-xenomai

Updating the kernel configuration files

The kernel configuration is in debian.master/config.

The package scripts cleverly split up the kernel configuration files into common and specific configurations. The Xenomai configuration is in debian.master/config/amd64/config.flavour.xenomai<tt> and <tt>debian.master/config/i386/config.flavour.xenomai<tt>. After modifying this file, update the files:

  debian/rules updateconfigs

Patching and building a new kernel version

This is new territory.

One thing to note is the naming scheme for kernel version tags. The upstream kernel version x.y.z will be tagged as x.y.0-z.m. (The resulting kernel package will be <tt>linux-image-x.y.0-z.m[-flavour]_arch.deb, where z.m is the "ABI", and m is a number starting from 0 and incrementing by one with each release.) To find the git tag for e.g. kernel version 3.5.3 that the latest Xenomai patch applies to, use:

  git tag -l | grep 3.5.0-3

Links


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions | View current revision
Edited January 9, 2013 11:02 am by Zultron (diff)
Search:
Published under a Creative Commons License