This page describes how to package an upstream U-Boot git repo using only git.

NOTE: This is not the recommended way to do this. However, it may be easier for developers familiar with git and not so much with bzr. The prefered method is the one now used for linaro-u-boot is to use a git upstream and bzr packaging as described here.

You have been warned. You like git. You are unfamiliar with bzr so you want the git only solution. Here we go.

Adding a Debian Directory

Let's assume you are in the master branch of a git repo that has working U-Boot for a new soc called "newsoc" on a board called "newboard".

Packaging is just a matter of adding a debian directory with the appropriate contents. To keep U-Boot source proper and packaging separate we will put our packaging in a new branch called packaging.

$ git checkout -b packaging
Switched to a new branch 'packaging'

Now grab the debian directory from a U-Boot repo that already has one. We will use the defunct packaged branch of the linaro-stable tree on git.linaro.org. The easiest way to do this is to add a linaro-stable remote and then checkout the debian directory from the packaged branch.

$ git remote add linaro-stable git://git.linaro.org/boot/u-boot-linaro-stable.git
$ git remote update
$ git checkout linaro-stable/packaged -- debian

Ok, what did that do? Voila a debian directory ready to check in:

$ git status
# On branch mybspuboot
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   debian/README.source
#       new file:   debian/changelog
#       new file:   debian/compat
#       new file:   debian/control
#       new file:   debian/copyright
#       new file:   debian/platform-and-targets
#       new file:   debian/rules
#       new file:   debian/source/format

Ok, check that in for safe keeping.

$ git commit -m "LINARO: add debian packaging directory from linaro-stable" -s

[mybspuboot 7da7ad4] LINARO: add debian packaging directory from linaro-stable
 9 files changed, 322 insertions(+), 0 deletions(-)
 create mode 100644 debian/README.source
 create mode 100644 debian/changelog
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/platform-and-targets
 create mode 100755 debian/rules
 create mode 100644 debian/source/format

Modify Packaging Files to Reflect Our Target SOC

Now lets modify debian to add our new target and remove the existing ones since this package is for just one platform. We only need to modify three files in the debian directory.

Modify debian/platform-and-targets

The file debian/platform-and-targets has three columns file that contain:

  • 1st column: U-Boot target name minus the _config.
  • 2nd column: U-Boot binary target which is usually u-boot.bin but sometimes different hence the need for this column.
  • 3rd column: The debian package name. Underscores are not allowed in debian package names so this is usually the first column with underscores replaced by dashes.

Modify debian/control

The file debian/control is what controls what source and binary packages get generated. Looking at the file one sees first a description of the source starting with a line that looks like Source: u-boot-linaro. Next there are sections for each target. Each of these sections starts with Package:. All we need to do is remove all the Package: sections but one and modify that one to reflect our new target.

After doing this editing we can see what we have changed with git diff.

$ git diff

diff --git a/debian/control b/debian/control
index 08a5c24..af1cbf2 100644
--- a/debian/control
+++ b/debian/control
@@ -7,47 +7,11 @@ Build-Depends: debhelper (>= 7.0.50~)
 Standards-Version: 3.8.4
 Vcs-Git: git://git.linaro.org/boot/u-boot-linaro-stable.git
diff --git a/debian/control b/debian/control
index 08a5c24..af1cbf2 100644
--- a/debian/control
+++ b/debian/control
@@ -1,4 +1,4 @@
-Source: u-boot-linaro
+Source: u-boot-newboard
 Section: misc
 Priority: extra
 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
@@ -7,47 +7,11 @@ Build-Depends: debhelper (>= 7.0.50~)
 Standards-Version: 3.8.4
 Vcs-Git: git://git.linaro.org/boot/u-boot-linaro-stable.git

-Package: u-boot-linaro-omap3-beagle
+Package: u-boot-linaro-newsoc-newboard
 Architecture: armel
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: U-Boot bootloader binary for various TI OMAP3 Beagle boards
+Description: U-Boot bootloader binary for ARMSOCVENDOR newsoc newboard
 This package contains the U-Boot bootloader which is responsible for
 loading and executing the Linux kernel on those boards. This package
 contains the U-Boot binary blob, and is not usually needed on a normal
 system
-
-Package: u-boot-linaro-omap3-overo
-Architecture: armel
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: U-Boot bootloader binary for Gumstix Overo COMs
- This package contains the U-Boot bootloader which is responsible for
- loading and executing the Linux kernel on those boards. This package
- contains the u-boot binary blob, and is not usually needed on a normal
- system

...

diff --git a/debian/platform-and-targets b/debian/platform-and-targets
index de7710e..6da6f1b 100644
--- a/debian/platform-and-targets
+++ b/debian/platform-and-targets
@@ -1,5 +1 @@
-ca9x4_ct_vxp   u-boot.bin      ca9x4-ct-vxp
-mx51evk                u-boot.imx      mx51evk
-omap3_beagle   u-boot.bin      omap3-beagle
-omap3_overo    u-boot.bin      omap3-overo
-omap4_panda    u-boot.bin      omap4-panda
+newsoc_newboard        u-boot.bin      newsoc-newboard

Ok check that in.

$ git commit -a -m "LINARO: add newsoc newboard target" -s

Modify debian/changelog

Finally we need to edit debian/changelog. We want to change the debian changelog to reflect our new package name and version. If this u-boot were just a modification to u-boot-linaro we would leave the package name the same and just change the version. The convention when you are changing existing Ubuntu package is:

  • ${last_Ubuntu_version}+ppa{serial}

for local modifications, and

  • ${next_Ubuntu_version}~ppa${serial}

for ppa builds that are staged for upcoming uploads (~ is used because it sorts before any other printing character.)

You are likely packaging a BSP U-Boot so give it a name that reflects that like u-boot-newboard. For the version it is nice to include the upstream version. U-Boot versions are of the form vYYYY.MM so you will need to drop the 'v' because debian does not like version numbers that are not numeric. 'Is that true?' If your upstream base is not tagged upstream then you can use the output of git describe as the version string (dropping the v).

$ git describe master
v2011.03-rc1-94-gc65715d

Also even if you are using a unique package name it is still a good idea to put ppa in the version.

So make that change and commit it. The command dch -i will help here.

$ dch -i

The dch command will create a new changelog entry and then invoke your editor. Change u-boot-linaro to u-boot-newboard. Change the version to reflect the offical upstream version or the commit description obtained from git describe. Also you may need to changed the distribution name. The dch command will default to what you are running on which may not be what you are targeting. This example was developed on Maverick but was targeting natty so maverick needed to be changed to natty.

$ git diff

diff --git a/debian/changelog b/debian/changelog
index 8382360..6916667 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+u-boot-newboard (2011.03-rc1-94-gc65715d-0ubuntu1-ppa1) natty; urgency=low
+
+  * added newsoc based newboard board
+
+ -- John Rigby <john.rigby@linaro.org>  Tue, 15 Feb 2011 14:19:48 -0700
+
 u-boot-linaro (2010.12-0ubuntu1) natty; urgency=low
 
$ git commit debian/changelog \
                -m "LINARO: newsoc newboard u-boot-board 2011.03-rc1-94-gc65715d-0ubuntu1-ppa1"

With that all the editing of files in the debian directory is done. You are almost ready to build source and binary packages.

Setup Up an Original Tarball

You would be ready to create the source package for upload here but this package is setup to use an original upstream tarball. We will need that original tarball everytime we do a ppa upload so it would be nice if we could recreate it automatically. For that we use git-import-orig command from the git-buildpackage package.

First you need a orig tar in the parent directory. If your upstream is a offcial upstream release then you can find a tarball on ftp.denx.de like ftp://ftp.denx.de/pub/u-boot/u-boot-2010.12.tar.bz2. For a snapshot release you can create your own with git archive.

$ git archive --format=tar --prefix u-boot/ master . | bzip2 > \
        ../u-boot-2011.03-rc1-94-gc65715d.orig.tar.bz2

Now run git-import-orig --pristine-tar to store away a delta between a git commit and the orig tarball so the orig tarball can be recreated later.

git-import-orig --pristine-tar --upstream-branch=master \
                --debian-branch=packaging \
                -u 2011.03-rc1-94-gc65715d \
                ../u-boot-2011.03-rc1-94-gc65715d.orig.tar.bz2
Upstream version is 2011.03-rc1-94-gc65715d
Importing '../u-boot-2011.03-rc1-94-gc65715d.orig.tar.bz2' to branch 'master'...
Branch pristine-tar set up to track remote branch pristine-tar from linaro-stable.
pristine-tar: committed u-boot-newboard_2011.03-rc1-94-gc65715d.orig.tar.bz2.delta to branch pristine-tar
Merging to 'packaging'
Already uptodate!
Merge made by recursive.
Succesfully imported version 2011.03-rc1-94-gc65715d of ../u-boot-2011.03-rc1-94-gc65715d.orig.tar.bz2

Build the Source and Binary Packages

You can now remove the orig tarball because it will be recreated if needed. We can now build the source and binary packages with git-build-package.

$ git-buildpackage --git-upstream-branch=master --git-debian-branch=packaging -aarmel 
... LOTS OF OUTPUT ...
$ ls ..
u-boot
u-boot-linaro-omap3-newboard.03-rc1-94-gc65715d-0ubuntu1-ppa1_armel.deb
u-boot-newboard_2011.03-rc1-94-gc65715d-0ubuntu1.orig.tar.bz2
u-boot-newboard_2011.03-rc1-94-gc65715d-0ubuntu1-ppa1_armel.build
u-boot-newboard_2011.03-rc1-94-gc65715d-0ubuntu1-ppa1_armel.changes
u-boot-newboard_2011.03-rc1-94-gc65715d-0ubuntu1-ppa1.debian.tar.gz
u-boot-newboard_2011.03-rc1-94-gc65715d-0ubuntu1-ppa1.dsc

You can now upload the source package with dput.


CategoryHowTo

Resources/HowTo/BSPUBootPackagingWithGIT (last modified 2011-03-23 19:05:09)