From 0dfa1140ffd59aac94fa02d8774f1c2424ed0852 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 1 Mar 2021 00:12:56 +0100 Subject: [PATCH] buildscript: provide option to set number of threads during build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to specify the number of threads used in './buildscript build' manually by adding them as third option, e.g. ./buildscript build fast 20 ./buildscript build debug 4 ./buildscript build default 10 Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- buildscript | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/buildscript b/buildscript index 9b194e7e..af929d71 100755 --- a/buildscript +++ b/buildscript @@ -208,13 +208,19 @@ build() { case "$1" in "debug") - make V=99 + if [ -n "$2" ]; then + make V=99 -j $2 + else + make V=99 + fi ;; "fast") - ionice -c 2 -- nice -n 1 -- make -j $((cpus*2)) + [ -n "$2" ] && threads=$2 || threads=$((cpus*2)) + ionice -c 2 -- nice -n 1 -- make -j $threads ;; *) - ionice -c 3 -- nice -n 10 -- make -j $((cpus+1)) + [ -n "$2" ] && threads=$2 || threads=$((cpus+1)) + ionice -c 3 -- nice -n 10 -- make -j $threads ;; esac @@ -444,13 +450,13 @@ case "$1" in "build") if [ "$2" = "help" ] || [ "$2" = "x" ]; then echo "This option compiles the firmware" - echo "Normaly the build uses lower IO and System priorities, " + echo "Normally the build uses lower IO and System priorities, " echo "you can append \"fast\" option, to use normal user priorities" echo - echo "Usage: $0 $1 [fast|debug]" + echo "Usage: $0 $1 [fast|debug] [numthreads]" echo else - build "$2" + build "$2" "$3" fi ;; "config")