diff --git a/make-flight b/make-flight
index 19f60f1..5136d09 100755
--- a/make-flight
+++ b/make-flight
@@ -39,167 +39,7 @@ if [ x$buildflight = x ]; then
      BUILD_RUNVARS+=" build_lvextend_max=$BUILD_LVEXTEND_MAX "
   fi
 
-  for arch in ${BUILD_ARCHES- i386 amd64 armhf }; do
-
-    if [ "x$arch" = xdisable ]; then continue; fi
-
-    case "$arch" in
-    armhf)
-      case "$branch" in
-      linux-arm-xen) ;;
-      linux-*) continue;;
-      qemu-*) continue;;
-      esac
-      case "$xenbranch" in
-      xen-3.*-testing) continue;;
-      xen-4.0-testing) continue;;
-      xen-4.1-testing) continue;;
-      xen-4.2-testing) continue;;
-      esac
-      pvops_kernel="
-        tree_linux=$TREE_LINUX_ARM
-        revision_linux=${REVISION_LINUX_ARM:-${DEFAULT_REVISION_LINUX_ARM}}
-      "
-      pvops_kconfig_overrides="
-        kconfig_override_y=CONFIG_EXT4_FS
-      "
-      ;;
-    *)
-      case "$branch" in
-      linux-arm-xen) continue;;
-      esac
-      pvops_kernel="
-        tree_linux=$TREE_LINUX
-        revision_linux=${REVISION_LINUX:-${DEFAULT_REVISION_LINUX}}
-      "
-      ;;
-    esac
-
-    case "$arch" in
-    armhf) suite="wheezy";;
-    *)     suite=$defsuite;;
-    esac
-
-    if [ $suite != $defsuite ] ; then
-        suite_runvars="host_suite=$suite"
-    else
-        suite_runvars=
-    fi
-
-    # In 4.4 onwards xend is off by default. If necessary we build a
-    # separate set of binaries with xend enabled in order to run those
-    # tests which use xend.
-    case "$arch" in
-    i386|amd64) want_xend=true;;
-    *) want_xend=false;;
-    esac
-
-    case "$xenbranch" in
-    xen-3.*-testing) build_defxend=$want_xend; build_extraxend=false;;
-    xen-4.0-testing) build_defxend=$want_xend; build_extraxend=false;;
-    xen-4.1-testing) build_defxend=$want_xend; build_extraxend=false;;
-    xen-4.2-testing) build_defxend=$want_xend; build_extraxend=false;;
-    xen-4.3-testing) build_defxend=$want_xend; build_extraxend=false;;
-    *) build_defxend=false;
-       build_extraxend=$want_xend
-    esac
-
-    case "$xenbranch" in
-    xen-3.*-testing) enable_ovmf=false;;
-    xen-4.0-testing) enable_ovmf=false;;
-    xen-4.1-testing) enable_ovmf=false;;
-    xen-4.2-testing) enable_ovmf=false;;
-    xen-4.3-testing) enable_ovmf=false;;
-    *) enable_ovmf=true;
-    esac
-
-    eval "
-        arch_runvars=\"\$ARCH_RUNVARS_$arch\"
-    "
-
-    build_hostflags=share-build-$suite-$arch,arch-$arch,suite-$suite,purpose-build
-
-    ./cs-job-create $flight build-$arch build                                \
-                arch=$arch enable_xend=$build_defxend enable_ovmf=$enable_ovmf       \
-        tree_qemu=$TREE_QEMU         \
-        tree_qemuu=$TREE_QEMU_UPSTREAM       \
-        tree_xen=$TREE_XEN                   \
-                $RUNVARS $BUILD_RUNVARS $BUILD_XEN_RUNVARS $arch_runvars     \
-                $suite_runvars                                               \
-                host_hostflags=$build_hostflags    \
-                revision_xen=$REVISION_XEN                                   \
-                revision_qemu=$REVISION_QEMU                                 \
-                revision_qemuu=$REVISION_QEMU_UPSTREAM
-
-    if [ $build_extraxend = "true" ] ; then
-    ./cs-job-create $flight build-$arch-xend build                           \
-                arch=$arch enable_xend=true enable_ovmf=$enable_ovmf         \
-        tree_qemu=$TREE_QEMU         \
-        tree_qemuu=$TREE_QEMU_UPSTREAM       \
-        tree_xen=$TREE_XEN                   \
-                $RUNVARS $BUILD_RUNVARS $BUILD_XEN_RUNVARS $arch_runvars     \
-                $suite_runvars                                               \
-                host_hostflags=$build_hostflags    \
-                revision_xen=$REVISION_XEN                                   \
-                revision_qemu=$REVISION_QEMU                                 \
-                revision_qemuu=$REVISION_QEMU_UPSTREAM
-    fi
-
-    ./cs-job-create $flight build-$arch-pvops build-kern                     \
-                arch=$arch kconfighow=xen-enable-xen-config                  \
-        tree_xen=$TREE_XEN                   \
-                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS $arch_runvars   \
-                $suite_runvars                                               \
-                host_hostflags=$build_hostflags    \
-                xen_kernels=linux-2.6-pvops                                  \
-                revision_xen=$REVISION_XEN                                   \
-                $pvops_kernel $pvops_kconfig_overrides                       \
-                ${TREEVCS_LINUX:+treevcs_linux=}${TREEVCS_LINUX}        \
-                tree_linuxfirmware=$TREE_LINUXFIRMWARE                       \
-                revision_linuxfirmware=$REVISION_LINUXFIRMWARE
-
-    case "$arch" in
-    armhf) continue;; # don't do any other kernel builds
-    esac
-
-    if [ "x$REVISION_LINUX_OLD" != xdisable ]; then
-
-      ./cs-job-create $flight build-$arch-oldkern build                 \
-                arch=$arch                                              \
-        tree_qemu=$TREE_QEMU    \
-        tree_qemuu=$TREE_QEMU_UPSTREAM       \
-        tree_xen=$TREE_XEN              \
-                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_OLD_RUNVARS        \
-                $arch_runvars $suite_runvars                            \
-                host_hostflags=$build_hostflags \
-                xen_kernels=linux-2.6-xen                               \
-                revision_xen=$REVISION_XEN                              \
-                revision_qemu=$REVISION_QEMU                            \
-                revision_qemuu=$REVISION_QEMU_UPSTREAM                  \
-        tree_linux=http://xenbits.xen.org/linux-2.6.18-xen.hg   \
-        revision_linux=$REVISION_LINUX_OLD
-
-    fi
-
-    if false && [ $arch = i386 -a "x$REVISION_LINUX_XCP" != xdisable ]; then
-      # XCP dom0 kernel is 32-bit only
-
-      ./cs-job-create $flight build-$arch-xcpkern build-kern                  \
-                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_XCP_RUNVARS              \
-                $arch_runvars $suite_runvars                                  \
-                arch=$arch                                              \
-        kconfighow=intree-buildconfigs kimagefile=arch/x86/boot/vmlinuz \
-                host_hostflags=$build_hostflags     \
-                tree_xen=$TREE_XEN            \
-                revision_xen=$REVISION_XEN                                    \
-        tree_linux=$TREEBASE_LINUX_XCP.hg    \
-     tree_pq_linux=$TREEBASE_LINUX_XCP.pq.hg \
-        revision_linux=$REVISION_LINUX_XCP                                    \
-        revision_pq_linux=$REVISION_PQ_LINUX_XCP
-
-    fi
-
-  done
+  create_build_jobs
 
 else
 
diff --git a/mfi-common b/mfi-common
index ec0beca..97bc506 100644
--- a/mfi-common
+++ b/mfi-common
@@ -31,6 +31,171 @@ stripy () {
   eval "$out_vn=\"\$out_$out_val\""
 }
 
+create_build_jobs () {
+
+  for arch in ${BUILD_ARCHES- i386 amd64 armhf }; do
+
+    if [ "x$arch" = xdisable ]; then continue; fi
+
+    case "$arch" in
+    armhf)
+      case "$branch" in
+      linux-arm-xen) ;;
+      linux-*) continue;;
+      qemu-*) continue;;
+      esac
+      case "$xenbranch" in
+      xen-3.*-testing) continue;;
+      xen-4.0-testing) continue;;
+      xen-4.1-testing) continue;;
+      xen-4.2-testing) continue;;
+      esac
+      pvops_kernel="
+        tree_linux=$TREE_LINUX_ARM
+        revision_linux=${REVISION_LINUX_ARM:-${DEFAULT_REVISION_LINUX_ARM}}
+      "
+      pvops_kconfig_overrides="
+        kconfig_override_y=CONFIG_EXT4_FS
+      "
+      ;;
+    *)
+      case "$branch" in
+      linux-arm-xen) continue;;
+      esac
+      pvops_kernel="
+        tree_linux=$TREE_LINUX
+        revision_linux=${REVISION_LINUX:-${DEFAULT_REVISION_LINUX}}
+      "
+      ;;
+    esac
+
+    case "$arch" in
+    armhf) suite="wheezy";;
+    *)     suite=$defsuite;;
+    esac
+
+    if [ $suite != $defsuite ] ; then
+        suite_runvars="host_suite=$suite"
+    else
+        suite_runvars=
+    fi
+
+    # In 4.4 onwards xend is off by default. If necessary we build a
+    # separate set of binaries with xend enabled in order to run those
+    # tests which use xend.
+    case "$arch" in
+    i386|amd64) want_xend=true;;
+    *) want_xend=false;;
+    esac
+
+    case "$xenbranch" in
+    xen-3.*-testing) build_defxend=$want_xend; build_extraxend=false;;
+    xen-4.0-testing) build_defxend=$want_xend; build_extraxend=false;;
+    xen-4.1-testing) build_defxend=$want_xend; build_extraxend=false;;
+    xen-4.2-testing) build_defxend=$want_xend; build_extraxend=false;;
+    xen-4.3-testing) build_defxend=$want_xend; build_extraxend=false;;
+    *) build_defxend=false;
+       build_extraxend=$want_xend
+    esac
+
+    case "$xenbranch" in
+    xen-3.*-testing) enable_ovmf=false;;
+    xen-4.0-testing) enable_ovmf=false;;
+    xen-4.1-testing) enable_ovmf=false;;
+    xen-4.2-testing) enable_ovmf=false;;
+    xen-4.3-testing) enable_ovmf=false;;
+    *) enable_ovmf=true;
+    esac
+
+    eval "
+        arch_runvars=\"\$ARCH_RUNVARS_$arch\"
+    "
+
+    build_hostflags=share-build-$suite-$arch,arch-$arch,suite-$suite,purpose-build
+
+    ./cs-job-create $flight build-$arch build                                \
+                arch=$arch enable_xend=$build_defxend enable_ovmf=$enable_ovmf\
+        tree_qemu=$TREE_QEMU                                                 \
+        tree_qemuu=$TREE_QEMU_UPSTREAM                                       \
+        tree_xen=$TREE_XEN                                                   \
+                $RUNVARS $BUILD_RUNVARS $BUILD_XEN_RUNVARS $arch_runvars     \
+                $suite_runvars                                               \
+                host_hostflags=$build_hostflags                              \
+                revision_xen=$REVISION_XEN                                   \
+                revision_qemu=$REVISION_QEMU                                 \
+                revision_qemuu=$REVISION_QEMU_UPSTREAM
+
+    if [ $build_extraxend = "true" ] ; then
+    ./cs-job-create $flight build-$arch-xend build                           \
+                arch=$arch enable_xend=true enable_ovmf=$enable_ovmf         \
+        tree_qemu=$TREE_QEMU                                                 \
+        tree_qemuu=$TREE_QEMU_UPSTREAM                                       \
+        tree_xen=$TREE_XEN                                                   \
+                $RUNVARS $BUILD_RUNVARS $BUILD_XEN_RUNVARS $arch_runvars     \
+                $suite_runvars                                               \
+                host_hostflags=$build_hostflags                              \
+                revision_xen=$REVISION_XEN                                   \
+                revision_qemu=$REVISION_QEMU                                 \
+                revision_qemuu=$REVISION_QEMU_UPSTREAM
+    fi
+
+    ./cs-job-create $flight build-$arch-pvops build-kern                     \
+                arch=$arch kconfighow=xen-enable-xen-config                  \
+        tree_xen=$TREE_XEN                                                   \
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS $arch_runvars   \
+                $suite_runvars                                               \
+                host_hostflags=$build_hostflags                              \
+                xen_kernels=linux-2.6-pvops                                  \
+                revision_xen=$REVISION_XEN                                   \
+                $pvops_kernel $pvops_kconfig_overrides                       \
+                ${TREEVCS_LINUX:+treevcs_linux=}${TREEVCS_LINUX}             \
+                tree_linuxfirmware=$TREE_LINUXFIRMWARE                       \
+                revision_linuxfirmware=$REVISION_LINUXFIRMWARE
+
+    case "$arch" in
+    armhf) continue;; # don't do any other kernel builds
+    esac
+
+    if [ "x$REVISION_LINUX_OLD" != xdisable ]; then
+
+      ./cs-job-create $flight build-$arch-oldkern build                 \
+                arch=$arch                                              \
+        tree_qemu=$TREE_QEMU                                            \
+        tree_qemuu=$TREE_QEMU_UPSTREAM                                  \
+        tree_xen=$TREE_XEN                                              \
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_OLD_RUNVARS        \
+                $arch_runvars $suite_runvars                            \
+                host_hostflags=$build_hostflags                         \
+                xen_kernels=linux-2.6-xen                               \
+                revision_xen=$REVISION_XEN                              \
+                revision_qemu=$REVISION_QEMU                            \
+                revision_qemuu=$REVISION_QEMU_UPSTREAM                  \
+        tree_linux=http://xenbits.xen.org/linux-2.6.18-xen.hg           \
+        revision_linux=$REVISION_LINUX_OLD
+
+    fi
+
+    if false && [ $arch = i386 -a "x$REVISION_LINUX_XCP" != xdisable ]; then
+      # XCP dom0 kernel is 32-bit only
+
+      ./cs-job-create $flight build-$arch-xcpkern build-kern            \
+                $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_XCP_RUNVARS        \
+                $arch_runvars $suite_runvars                            \
+                arch=$arch                                              \
+        kconfighow=intree-buildconfigs kimagefile=arch/x86/boot/vmlinuz \
+                host_hostflags=$build_hostflags                         \
+                tree_xen=$TREE_XEN                                      \
+                revision_xen=$REVISION_XEN                              \
+        tree_linux=$TREEBASE_LINUX_XCP.hg                               \
+     tree_pq_linux=$TREEBASE_LINUX_XCP.pq.hg                            \
+        revision_linux=$REVISION_LINUX_XCP                              \
+        revision_pq_linux=$REVISION_PQ_LINUX_XCP
+
+    fi
+
+  done
+}
+
 # Local variables:
 # mode: sh
 # sh-basic-offset: 2
