diff options
author | Francis Rowe <info@gluglug.org.uk> | 2016-03-10 15:18:49 (EST) |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2016-03-10 15:18:49 (EST) |
commit | 25a828190b2a08105ad561b5b417bb61a383fc4f (patch) | |
tree | 459580bd75950b3c0fbcd6f8116f2bdc11c8db52 /resources/scripts/helpers/build/module | |
parent | 2628a25901d35bd267fba945100864578f920770 (diff) | |
download | libreboot-25a828190b2a08105ad561b5b417bb61a383fc4f.zip libreboot-25a828190b2a08105ad561b5b417bb61a383fc4f.tar.gz libreboot-25a828190b2a08105ad561b5b417bb61a383fc4f.tar.bz2 |
build system: allow arbitrary specification of number of cores used
Use NPROC=foo
Replace "foo" with a number. By default, the build system uses $(nproc).
This patch allows the user to specify any number of cores. This is useful
on some systems, or certain chroot environments.
Diffstat (limited to 'resources/scripts/helpers/build/module')
-rwxr-xr-x | resources/scripts/helpers/build/module/bucts | 13 | ||||
-rwxr-xr-x | resources/scripts/helpers/build/module/flashrom | 23 | ||||
-rwxr-xr-x | resources/scripts/helpers/build/module/grub | 13 |
3 files changed, 41 insertions, 8 deletions
diff --git a/resources/scripts/helpers/build/module/bucts b/resources/scripts/helpers/build/module/bucts index 6e54fc1..8e2b371 100755 --- a/resources/scripts/helpers/build/module/bucts +++ b/resources/scripts/helpers/build/module/bucts @@ -24,6 +24,17 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi # Build BUC.TS utility (needed for flashing ROM images on X60/T60 while Lenovo BIOS is running) # -------------------------------------------------------------------- @@ -44,7 +55,7 @@ if [ "${buildtype}" = "static" ]; then fi make clean -make -j$(nproc) +make -j${cores} if [ "${buildtype}" = "static" ]; then patch "Makefile" -R < "../resources/bucts/patch/staticlink.diff" diff --git a/resources/scripts/helpers/build/module/flashrom b/resources/scripts/helpers/build/module/flashrom index 3664f56..54c12ed 100755 --- a/resources/scripts/helpers/build/module/flashrom +++ b/resources/scripts/helpers/build/module/flashrom @@ -24,6 +24,17 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi # Build "flashrom" (utility for flashing/dumping ROMs) # -------------------------------------------------------------------- @@ -34,12 +45,12 @@ cd "flashrom/" make clean if (( $# != 1 )); then - make -j$(nproc) + make -j${cores} else if [ "${1}" = "static" ]; then - make SHARED=0 CC='gcc -static' -j$(nproc) + make SHARED=0 CC='gcc -static' -j${cores} else - make -j$(nproc) + make -j${cores} fi fi @@ -60,12 +71,12 @@ do make clean if (( $# != 1 )); then - make -j$(nproc) + make -j${cores} else if [ "${1}" = "static" ]; then - make SHARED=0 CC='gcc -static' -j$(nproc) + make SHARED=0 CC='gcc -static' -j${cores} else - make -j$(nproc) + make -j${cores} fi fi diff --git a/resources/scripts/helpers/build/module/grub b/resources/scripts/helpers/build/module/grub index f899bc2..5b2c7a6 100755 --- a/resources/scripts/helpers/build/module/grub +++ b/resources/scripts/helpers/build/module/grub @@ -24,6 +24,17 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +if [ -z ${NPROC+x} ]; then + cores="$(nproc)" +else + case ${NPROC} in + ''|*[!0-9]*) + printf "value '%s' for NPROC is invalid. non-numeric. Exiting.\n" "${NPROC}" + exit 1 + ;; + esac + cores="${NPROC}" +fi # Build GRUB2 as coreboot payload @@ -39,5 +50,5 @@ cd grub/ # build ./autogen.sh ./configure --with-platform=coreboot -make -j$(nproc) +make -j${cores} ) |