wiki:Linux/Ubuntu/Kernel/CustomBuildPPA

Custom Build Ubuntu Kernel for PPA Upload

When working with the kernel git tree the regular method of building a source package for upload to a PPA isn't suitable. Additionally, the usual debian/rules can't be used either. Instead, Ubuntu provides a script for preparing a kernel source package for uploading to PPA.

Git Workflow

This example is taken from my work on bug #191137 and, although not essential for the PPA issue, shows my workflow that leads to uploading the kernel source to the PPA.

$ pwd
/home/all/SourceCode/linux/ubuntu-hardy

# start topic for this bug
$ git-branch lp/191137
# work on bug
# ...

# commit changes of work-in-progress on this branch
$ git-commit -asm "LP #191137 - description of changes"

# more work ...

# identified upstream commit that solves the issue, prepare to cherry-pick
# if the upstream repository isn't already set up as a remote, do it now:
$ git-remote add linux-2.6  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

# fetch the latest upstream changes into a remote tracking branch
$ git-fetch linux-2.6

# cherry-pick the commit(s) needed, (-x references the original commit hash)
$ git-cherry-pick -x 3e71a87
$ git-cherry-pick -x b3b233c

# Create a 'no-change' commit recording the fix using the Ubuntu patch template
# Note: save the file and *close* gedit when finished editing
$ export GIT_EDITOR=gedit
$ git commit --allow-empty -st debian/commit-templates/patch

Locate the prepare-personal-ppa-source Script

$ ls debian/scripts/misc/prepare*
debian/scripts/misc/prepare-personal-ppa-source
debian/scripts/misc/prepare-ppa-source

If the script hasn't been included in the Ubuntu kernel git repository you are working with as yet, download prepare-personal-ppa-source from this article and put it in a directory outside the git working directory (otherwise it will be deleted by the git-checkout -f statement - unless you also git-commit it into your repository).

$ wget http://tjworld.net/raw-attachment/wiki/Linux/Ubuntu/Kernel/CustomBuildPPA/prepare-personal-ppa-source
# install the script somewhere and make it executable
$ chmod a+x prepare-personal-ppa-source
$ mv prepare-personal-ppa-source ~/scripts/

Build the Source Package

Setup any required environment variables:

$ export DEBFULLNAME="TJ"
$ export DEBEMAIL="ubuntu@tjworld.net"

Run the script (in this example I'm using the script included in my git repository):

$ debian/scripts/misc/prepare-personal-ppa-source

If everything goes okay you'll see the mass of messages as usual when dpkg-buildpackage is executed. At the end of it all the script will report:

Source package "linux_2.6.24-19.35~ppa1_source.changes" is available in the parent directory
Exit code: 0

You'll find the files in the parent directory:

ls -1 ../linux_2.6.24*
../linux_2.6.24-19.35~ppa1.dsc
../linux_2.6.24-19.35~ppa1_source.changes
../linux_2.6.24-19.35~ppa1_source.upload
../linux_2.6.24-19.35~ppa1.tar.gz

Upload Kernel Package to Personal PPA

Configure dput

Configure user-specific upload target in ~/.dput.cf:

$ cat ~/.dput.cf 
[intuitivenipple-ppa]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~intuitivenipple/ubuntu/
login = anonymous
allow_unsigned_uploads = 0

Note: All PPA uploads must be signed with the digital GPG key registered in the matching Launchpad account.

Upload

$ dput intuitivenipple-ppa ../linux_2.6.24-19.35~ppa1_source.changes 
Checking Signature on .changes
gpg: Signature made Sat 12 Jul 2008 19:43:40 BST using DSA key ID 29CD6080
gpg: Good signature from "TJ (Ubuntu contributions) <ubuntu@tjworld.net>"
gpg:                 aka "XXXX TJ (Ubuntu Launchpad) <ubuntu@tjworld.net>"
Good signature on ../linux_2.6.24-19.35~ppa1_source.changes.
Checking Signature on .dsc
gpg: Signature made Sat 12 Jul 2008 19:43:39 BST using DSA key ID 29CD6080
gpg: Good signature from "TJ (Ubuntu contributions) <ubuntu@tjworld.net>"
gpg:                 aka "XXXX TJ (Ubuntu Launchpad) <ubuntu@tjworld.net>"
Good signature on ../linux_2.6.24-19.35~ppa1.dsc.
Uploading to intuitivenipple-ppa (via ftp to ppa.launchpad.net):
  linux_2.6.24-19.35~ppa1.dsc: done.
  linux_2.6.24-19.35~ppa1.tar.gz: done.        
  linux_2.6.24-19.35~ppa1_source.changes: done.
Successfully uploaded packages.
Not running dinstall.

Wait For Results

Wait for the status emails from Launchpad. It can take several hours (4-6) to build so best to do it overnight.

Attachments