Building Suspend2-Enabled Kernels on Ubuntu Feisty

The ubuntu kernel build process has become somewhat baroque in recent months. The best way to build a current (feisty) kernel with suspend2 enabled is to use git and their debian/rules scripts. It ain't easy, though. The author of this page is actually having lots of trouble with this and could use some help!

Need Help

This guide is incomplete and written by someone who's still having trouble building these packages. Help would be greatly appreciated.

Download necessary packages

First install all the necessary packages:

  apt-get install linux-kernel-devel fakeroot kernel-wedge kernel-package build-essential git-core cogito 

Prepare Git environment

Nigel maintains source trees for Feisty, Gutsy and Hardy. You can get them from kernel.ubuntu.com:

cg-clone http://kernel.ubuntu.com/nigelc/ubuntu-hardy+tuxonice.git ubuntu-hardy+tuxonice.git

Old Instructions

If you haven't used git before check out the git and cogito man pages online. Then create an initial repository and add the suspend2 sources as follows:

mkdir src
cd src
cg-clone rsync://rsync.kernel.org/pub/scm/linux/kernel/git/bcollins/ubuntu-2.6.git ubuntu-2.6
cd ubuntu-2.6
cg-branch-add suspend2 git://git.kernel.org/pub/scm/linux/kernel/git/nigelc/suspend2-head.git
cat > .git/remotes/suspend2
URL: git://git.kernel.org/pub/scm/linux/kernel/git/nigelc/suspend2-head.git
Pull: refs/heads/suspend2:refs/heads/suspend2
^D
cg-switch -l -r origin ubuntu-suspend2
cg-update origin
cg-update suspend2

The above commands do the following:

Build the kernel

Now, there are two ways to build kernels in this structure and both ought to work. However I've had limited successwith either, probably because the debian/ directory in ubuntu kernels is heavily modified from the debian upstream and probably places additional, rather stringent limitations on how kernels are to be built. Anyway, here's what I think should be done.

Method 1: make-kpkg

This is the old-fashioned debian approach. Use the debian tool "make-kpkg" just to build a single kernel package:

 make menuconfig  Set up your kernel parameters. Make sure to check all the relevant suspend2 options in Power Management --> Suspend2, and to enable LZF in Cryptographic --> LZF. Build it directly into the kernel, not as a module. I found I had to disable Device Drivers --> USB --> USB DSL Modem Support and also Ubuntu Additional Drivers --> Ubuntu added Filesystem Drivers --> Dazuko File Access Control. Hopefully that's not absolutely necessary.

 make-kpkg --initrd --append-to-version=-suspend2 kernel-image kernel-headers  That last line should build your kernel. It's not doing it for me, failing consistently with "compatibility issues" errors, which probably indicate an issue with the debian/control file. But I'm too ignorant to know howto solve the issue.

Method 2: debian/rules

Ubuntu uses debian/rules to automatically build a whole bunch of kernels at the same time. the config files are not built with make menuconfig but with a perl script that splits config files into generic and "flavour-specific" options. suspend options arei n the "flavour-specific" files so I tried updating them directly. So e.g. to build generic flavour for i386 I edited debian/config/i386/config.generic thus:

deleted  CONFIG_SOFTWARE_SUSPEND=y  and added

# CONFIG_SOFTWARE_SUSPEND is not set
CONFIG_SUSPEND_SMP=y
CONFIG_SUSPEND2_CRYPTO=y
CONFIG_SUSPEND2=y
CONFIG_CRYPTO_LZF=y

Then I issued the build command:  AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=generic 

which ought to build the linux-image and linux-headers packages. Again, I'm having trouble doing this.

Build linux-restricted-modules

There seems to be no informaton available anywhere about how to do this. It would be convenient to be able to do so to say the least, since l-r-m contains not only modules but firmware, which you can't simply build using module-assistant.

None: BuildingUbuntuKernels (last edited 2008-02-16 09:11:46 by NigelCunningham)