[PATCH 6/6] Do not build firmware on buildds

Jonathan Nieder jrnieder at gmail.com
Sun Apr 4 23:45:12 EDT 2010


There is no mipsel cross-compiler packaged for Debian, so building
the firmware on arbitrary build machines is not possible.

So let packagers build firmware when generating the source package.
The built firmware is kept in the debian/ directory and then
copied verbatim to <staging directory>/usr/share/xburst-tools
at the appropriate time.

The commands to prepare the firmware are in a script named
debian/autogen.sh, which could be taught to do other things (such as
generate a changelog) later.

Signed-off-by: Jonathan Nieder <jrnieder at gmail.com>
---
That’s the end of the series.  Thanks for reading.

Thoughts?
Jonathan

 usbboot/debian/.gitignore    |    3 +++
 usbboot/debian/README.source |   21 +++++++++++++++++++++
 usbboot/debian/autogen.sh    |   10 ++++++++++
 usbboot/debian/changelog     |    6 +++++-
 usbboot/debian/clean.sh      |    9 ++++-----
 usbboot/debian/rules         |   24 +++++++++++++++++++++---
 6 files changed, 64 insertions(+), 9 deletions(-)
 create mode 100644 usbboot/debian/README.source
 create mode 100755 usbboot/debian/autogen.sh

diff --git a/usbboot/debian/.gitignore b/usbboot/debian/.gitignore
index 66a4544..5495e03 100644
--- a/usbboot/debian/.gitignore
+++ b/usbboot/debian/.gitignore
@@ -1,3 +1,6 @@
+/xburst_stage1.bin
+/xburst_stage2.bin
+
 /files
 
 /*.debhelper.log
diff --git a/usbboot/debian/README.source b/usbboot/debian/README.source
new file mode 100644
index 0000000..26fb252
--- /dev/null
+++ b/usbboot/debian/README.source
@@ -0,0 +1,21 @@
+This Debian package is developed in a Git repository (see the Vcs-Git field
+of debian/control).  To build from a git checkout:
+
+	debian/autogen.sh
+	debuild
+
+This requires a mipsel-openwrt-linux- cross-toolchain in your $PATH.  You
+can get one by building the development environment from Qi Hardware, for
+example.
+
+  git://projects.qi-hardware.com/openwrt-xburst.git xburst
+
+See the Qi Hardware wiki for details.
+
+  http://en.qi-hardware.com/wiki/Building_Software_Image
+
+To build a released version of this package, no special instructions apply.
+“dpkg-buildpackage” or “apt-get -b source xburst-tools” should work as
+usual.
+
+ -- Jonathan Nieder <jrnieder at gmail.com>  Sun, 04 Apr 2010 22:08:28 -0500
diff --git a/usbboot/debian/autogen.sh b/usbboot/debian/autogen.sh
new file mode 100755
index 0000000..7a0016a
--- /dev/null
+++ b/usbboot/debian/autogen.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Generate debian/xburst_stage1.bin and debian/xburst_stage2.bin
+#
+# Requires a mipsel-openwrt-linux- toolchain on the $PATH.
+
+set -e
+
+debian/rules firmware
+cp -f xburst_stage1/xburst_stage1.bin debian/
+cp -f xburst_stage2/xburst_stage2.bin debian/
diff --git a/usbboot/debian/changelog b/usbboot/debian/changelog
index 5761823..c8afe76 100644
--- a/usbboot/debian/changelog
+++ b/usbboot/debian/changelog
@@ -6,8 +6,12 @@ xburst-tools (0.0+201002-1.1) local; urgency=low
   * Build-Conflicts: automake1.4
   * add a Vcs-Git field to debian/control and remove the outdated watch
     file
+  * debian/README.source: add instructions for re-building the firmware
+  * debian/autogen.sh: new script
+  * debian/rules: install firmware built at packaging time, to avoid
+    requiring a mipsel cross-compiler on buildds
 
- -- Jonathan Nieder <jrnieder at gmail.com>  Sun, 04 Apr 2010 21:45:57 -0500
+ -- Jonathan Nieder <jrnieder at gmail.com>  Sun, 04 Apr 2010 22:08:47 -0500
 
 xburst-tools (0.0+201002-1) unstable; urgency=low
 
diff --git a/usbboot/debian/clean.sh b/usbboot/debian/clean.sh
index 8834847..1b17a8b 100644
--- a/usbboot/debian/clean.sh
+++ b/usbboot/debian/clean.sh
@@ -36,8 +36,7 @@ splitgitignore='#!/usr/bin/awk
 }
 '
 
-gitdir="-type d -name '.*' -prune"
-debiandir="-type d -name debian -prune"
+offlimits="-type d -name '.*' -prune -o -type d -name debian -prune"
 
 remove_file_globs() {
 	while read glob
@@ -56,7 +55,7 @@ remove_directory_globs() {
 remove_file_findpatterns() {
 	while read pat
 	do
-		find . $gitdir -o \
+		find . $offlimits -o \
 			'(' -name "$pat" -execdir rm -f '{}' + ')'
 	done
 }
@@ -64,12 +63,12 @@ remove_file_findpatterns() {
 remove_directory_findpatterns() {
 	while read pat
 	do
-		find . $gitdir -o \
+		find . $offlimits -o \
 			'(' -type d -name "$pat" -execdir rm -fr '{}' + ')'
 	done
 }
 
-find . $gitdir -o $debiandir -o '(' -name .gitignore -print ')' |
+find . $offlimits -o '(' -name .gitignore -print ')' |
 while read file
 do
 	(
diff --git a/usbboot/debian/rules b/usbboot/debian/rules
index ccaff2d..8190b0b 100755
--- a/usbboot/debian/rules
+++ b/usbboot/debian/rules
@@ -6,12 +6,22 @@ build clean install binary-arch binary-indep binary:
 	+dh --parallel $(opt_no_act) $@
 
 override_dh_auto_clean:
+	test -e debian/xburst_stage1.bin || { \
+		echo >&2 see debian/README.source; \
+		exit 1; \
+	}
 	dh_auto_clean
 	sh debian/clean.sh
 
-override_dh_auto_configure:
-	AUTOMAKE="automake --foreign" autoreconf -is
-	dh_auto_configure -- $(opt_optimize) $(opt_quiet) LDFLAGS=-Wl,-z,defs
+override_dh_auto_configure: configure
+	dh_auto_configure -- $(opt_optimize) $(opt_quiet) \
+		--disable-firmware  LDFLAGS=-Wl,-z,defs
+
+override_dh_auto_install:
+	dh_auto_install
+	: install firmware from source package
+	dh_install debian/xburst_stage1.bin usr/share/xburst-tools/
+	dh_install debian/xburst_stage2.bin usr/share/xburst-tools/
 
 opt_optimize = CFLAGS="-g -O2"
 opt_no_act =
@@ -29,3 +39,11 @@ ifneq (,$(filter quiet,$(DEB_BUILD_OPTIONS)))
     opt_quiet = --quiet
     MAKEFLAGS += --quiet
 endif
+
+configure: configure.ac
+	AUTOMAKE="automake --foreign" autoreconf -is
+
+firmware: configure
+	./configure --enable-firmware
+	$(MAKE) -C src ../xburst_stage1/xburst_stage1.bin \
+		../xburst_stage2/xburst_stage2.bin
-- 
debian.1.7.0.3.1.469.g398f8





More information about the discussion mailing list


interactive