Browse Source

Adds option to specify the amount of parallel make jobs for build.sh.

If the value is not specified by the user explicitly, the value is chosen to be
equal to the number of CPUs/cores in the users machine.
Stefan Laudemann 9 years ago
parent
commit
67906b5f8a
2 changed files with 6 additions and 3 deletions
  1. 1 0
      ReadMe.md
  2. 5 3
      build.sh

+ 1 - 0
ReadMe.md

@@ -18,6 +18,7 @@ Rufe `build.sh` auf und übergebe folgende Umgebungsvariablen:
 * **BRANCH** ist der Name des Firmware-Branches (also /stable/, /testing/ oder /experimental/)
 * **BRANCH** ist der Name des Firmware-Branches (also /stable/, /testing/ oder /experimental/)
 * **VERSION** wird die Versions-Nr. der neuen Firmware (kann bei BRANCH=experimental) weggelassen werden
 * **VERSION** wird die Versions-Nr. der neuen Firmware (kann bei BRANCH=experimental) weggelassen werden
 * **BROKEN** falls "1", erzeuge ebenfalls Firmware-Images für ungetestete Plattformen (default: "0")
 * **BROKEN** falls "1", erzeuge ebenfalls Firmware-Images für ungetestete Plattformen (default: "0")
+* **MAKEJOBS** spezifiziert die Anzahl der parallel laufenden Compiler-Prozesse (falls nicht angegeben, wird ein Prozess pro CPU/Kern gestartet)
 
 
 ```bash
 ```bash
 # Baut eine testing-Firmware auf Basis von Gluon 2014.4
 # Baut eine testing-Firmware auf Basis von Gluon 2014.4

+ 5 - 3
build.sh

@@ -10,6 +10,7 @@
 # VERSION   = the version tag (can only be empty if BRANCH=experimental)
 # VERSION   = the version tag (can only be empty if BRANCH=experimental)
 # BUILD_TS  = build timestamp (format: %Y-%m-%d %H:%M:%S)
 # BUILD_TS  = build timestamp (format: %Y-%m-%d %H:%M:%S)
 # BROKEN    = 0 (default) or 1, build the untested hardware model firmwares, too
 # BROKEN    = 0 (default) or 1, build the untested hardware model firmwares, too
+# MAKEJOBS  = number of compiler processes running in parallel (default: number of CPUs/Cores)
 #
 #
 
 
 if [ "_$BRANCH" == "_" ]; then
 if [ "_$BRANCH" == "_" ]; then
@@ -81,21 +82,22 @@ if [ "$BRANCH" != "experimental" ]; then
 fi
 fi
 
 
 ### PREPARE
 ### PREPARE
+[ -n "${MAKEJOBS}" ] || MAKEJOBS=$(grep -c "^processor" /proc/cpuinfo)
 progress "Preparing the build environment (make update) ..."
 progress "Preparing the build environment (make update) ..."
 make update
 make update
 [ "$?" -eq "0" ] || abort "Failed to update the build environment, mimimi."
 [ "$?" -eq "0" ] || abort "Failed to update the build environment, mimimi."
 
 
 ### BUILD TOOLCHAIN
 ### BUILD TOOLCHAIN
 progress "Building toolchain if necessary (this is not possible on a fresh build) ..."
 progress "Building toolchain if necessary (this is not possible on a fresh build) ..."
-faketime "$BUILD_TS" make toolchain -j 1
+faketime "$BUILD_TS" make toolchain -j ${MAKEJOBS}
 
 
 ### BUILD FIRMWARE
 ### BUILD FIRMWARE
 progress "Building the firmware - please stand by!"
 progress "Building the firmware - please stand by!"
 [ "_$BROKEN" == "_" ] && export BROKEN=0
 [ "_$BROKEN" == "_" ] && export BROKEN=0
 if [ "$BRANCH" != "experimental" ]; then
 if [ "$BRANCH" != "experimental" ]; then
-	GLUON_BRANCH=$BRANCH GLUON_RELEASE=$VERSION BROKEN=$BROKEN faketime "$BUILD_TS" make -j 4
+	GLUON_BRANCH=$BRANCH GLUON_RELEASE=$VERSION BROKEN=$BROKEN faketime "$BUILD_TS" make -j ${MAKEJOBS}
 else
 else
-	GLUON_BRANCH=experimental BROKEN=$BROKEN faketime "$BUILD_TS" make -j 4
+	GLUON_BRANCH=experimental faketime "$BUILD_TS" make -j ${MAKEJOBS}
 fi
 fi
 
 
 [ "$?" -eq "0" ] || abort "Failed to build the firmware, mimimi."
 [ "$?" -eq "0" ] || abort "Failed to build the firmware, mimimi."