[Home]XenomaiKernelPackageFromUbuntuGit

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Difference (from prior major revision) (no other diffs)

Changed: 1,90c1

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. 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
# This branch is where to make changes, esp. config changes
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




This is the main piece of the workflow. Check out a new branch for the build. Apply the Xenomai patch and run updateconfigs. These are checked into git. Then build the packages.

If the packages fail, check out the 3.5.3-xeno branch and wipe out the build branch. Make fixes and commit. Then check out a new build branch and repeat.

For released packages, name the build branch according to the package release and don't remove it for posterity.

# Check out a new branch for the compile
# This will mess up the configuration files and kernel source
git checkout -b 3.5.3-xeno-amd64

# Patch the kernel with the Xenomai patch and commit changes
gzip -cd /usr/src/kernel-patches/diffs/xenomai/ipipe-core-3.5.3-x86-2.patch.gz | \
patch -p1
git add -A && git commit -m 'Commit diffs from Xenomai patch'

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

# Update configurations and commit changes
# This must be done AFTER the patch step, or the Xenomai options will be lost
debian/rules updateconfigs
git commit -am 'Commit results of updateconfigs'

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

# Build platform-independent packages, if desired
fakeroot debian/rules binary-indep

Install kernel packages




The kernel packages are built into the parent directory.

cd ..
dpkg -i *.deb

Links




* Ubuntu documentation for rebuilding the upstream kernel packages
** https://wiki.ubuntu.com/KernelTeam/GitKernelBuild#Using_Ubuntu_Kernel_Configuration



LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited January 18, 2013 11:03 pm by Zultron (diff)
Search:
Published under a Creative Commons License