From 52e00acd6d37c1462578d062acd080811964cf86 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Fri, 26 Mar 2021 15:02:18 +0100 Subject: [PATCH] script: Detect number of CPUs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Automatically determine the number of parallel make(1) processes to run. Change-Id: I0ce778e5c15ceb8cf80bbfc2f4bb58c937630ba3 Signed-off-by: Łukasz Stelmach --- build-rpi4.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build-rpi4.sh b/build-rpi4.sh index 27eac56c8f89..094988cc381b 100755 --- a/build-rpi4.sh +++ b/build-rpi4.sh @@ -1,5 +1,8 @@ #!/bin/bash +NCPUS=`cat /proc/cpuinfo | grep processor | wc -l` +NCPUS=$(($NCPUS * 2)) + if [ $# != 1 ]; then echo "Usage : build-rpi3.sh " @@ -27,7 +30,7 @@ if [ $1 = "arm" ]; then if ! [ -e .config ] ; then make ARCH=arm CROSS_COMPILE="$CROSS_COMPILER" tizen_bcm2709_defconfig fi - make ARCH=arm CROSS_COMPILE="$CROSS_COMPILER" -j8 + make ARCH=arm CROSS_COMPILE="$CROSS_COMPILER" -j $NCPUS if [ ! -f "./arch/arm/boot/zImage" ]; then echo "Build fail" exit 1 @@ -42,7 +45,7 @@ elif [ $1 = "arm64" ]; then if ! [ -e .config ] ; then make ARCH=arm64 CROSS_COMPILE="$CROSS_COMPILER" tizen_bcmrpi3_defconfig fi - make ARCH=arm64 CROSS_COMPILE="$CROSS_COMPILER" -j8 + make ARCH=arm64 CROSS_COMPILE="$CROSS_COMPILER" -j $NCPUS if [ ! -f "./arch/arm64/boot/Image" ]; then echo "Build fail" exit 1 -- 2.34.1