summaryrefslogtreecommitdiffstats
path: root/resources/scripts/helpers/build/roms
diff options
context:
space:
mode:
authorFrancis 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)
commit25a828190b2a08105ad561b5b417bb61a383fc4f (patch)
tree459580bd75950b3c0fbcd6f8116f2bdc11c8db52 /resources/scripts/helpers/build/roms
parent2628a25901d35bd267fba945100864578f920770 (diff)
downloadlibreboot-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/roms')
-rwxr-xr-xresources/scripts/helpers/build/roms/withdepthcharge17
-rwxr-xr-xresources/scripts/helpers/build/roms/withgrub_helper13
2 files changed, 26 insertions, 4 deletions
diff --git a/resources/scripts/helpers/build/roms/withdepthcharge b/resources/scripts/helpers/build/roms/withdepthcharge
index eaab8f0..cf473e2 100755
--- a/resources/scripts/helpers/build/roms/withdepthcharge
+++ b/resources/scripts/helpers/build/roms/withdepthcharge
@@ -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
printf "Building ROM images with the depthcharge payload\n"
@@ -63,7 +74,7 @@ buildlibpayload() {
rm -Rf "install/"
make KBUILD_DEFCONFIG="configs/config.$family" defconfig
- make -j$(nproc)
+ make -j${cores}
make DESTDIR="install" install
cd "../../"
@@ -94,7 +105,7 @@ builddepthcharge() {
rm -f "../coreboot/${cbrevision:?}/${cbrevision:?}/depthcharge.elf"
make BOARD="${board}" defconfig
- make BOARD="${board}" LIBPAYLOAD_DIR="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/3rdparty/vboot" -j$(nproc) depthcharge_unified
+ make BOARD="${board}" LIBPAYLOAD_DIR="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/${cbrevision}/${cbrevision}/3rdparty/vboot" -j${cores} depthcharge_unified
cp "build/depthcharge.elf" "../coreboot/${cbrevision}/${cbrevision}/"
@@ -129,7 +140,7 @@ buildcoreboot() {
printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot
make KBUILD_DEFCONFIG="$(pwd)/../../../resources/libreboot/config/depthcharge/${board}/config" defconfig
- make -j$(nproc)
+ make -j${cores}
cbfs_size=$( grep CONFIG_CBFS_SIZE ".config" | sed "s/.*[[:space:]]*=[[:space:]]*//g" )
cbfs_size=$( printf "%d\n" "${cbfs_size}" )
diff --git a/resources/scripts/helpers/build/roms/withgrub_helper b/resources/scripts/helpers/build/roms/withgrub_helper
index bd1af19..16e861e 100755
--- a/resources/scripts/helpers/build/roms/withgrub_helper
+++ b/resources/scripts/helpers/build/roms/withgrub_helper
@@ -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
if (( $# != 1 )); then
printf "Usage: ./buildrom-withgrub boardname\n"
@@ -98,7 +109,7 @@ do
make clean
mv "config_${romtype}" ".config"
cp "../../grub_${romtype}.elf" "grub.elf"
- make -j$(nproc)
+ make -j${cores}
rm -f "grub.elf"
mv "build/coreboot.rom" "${boardtarget}_${romtype}.rom"
# .config no longer needed