Consistently use nproc for counting the CPUs
Coreutils command nproc can be used on Linux and BSD to count the number of available CPU cores. Use this instead of relying on the parsing of the Linux specific proc file system. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
0f97e923d4
commit
84f0415201
@ -1,6 +1,6 @@
|
|||||||
CROSS_COMPILE := aarch64-linux-gnu-
|
CROSS_COMPILE := aarch64-linux-gnu-
|
||||||
output_dir := $(PWD)/../bin
|
output_dir := $(PWD)/../bin
|
||||||
makejobs := $(shell grep '^processor' /proc/cpuinfo | sort -u | wc -l)
|
makejobs := $(nproc)
|
||||||
makethreads := $(shell dc -e "$(makejobs) 1 + p")
|
makethreads := $(shell dc -e "$(makejobs) 1 + p")
|
||||||
make_options := GCC49_AARCH64_PREFIX=$CROSS_COMPILE \
|
make_options := GCC49_AARCH64_PREFIX=$CROSS_COMPILE \
|
||||||
-j$(makethreads) -l$(makejobs)
|
-j$(makethreads) -l$(makejobs)
|
||||||
|
@ -13,7 +13,7 @@ fail() {
|
|||||||
build_uboot() {
|
build_uboot() {
|
||||||
echo "Build sandbox"
|
echo "Build sandbox"
|
||||||
OPTS="O=${OUTPUT_DIR} $1"
|
OPTS="O=${OUTPUT_DIR} $1"
|
||||||
NUM_CPUS=$(grep -c processor /proc/cpuinfo)
|
NUM_CPUS=$(nproc)
|
||||||
echo ${OPTS}
|
echo ${OPTS}
|
||||||
make ${OPTS} sandbox_config
|
make ${OPTS} sandbox_config
|
||||||
make ${OPTS} -s -j${NUM_CPUS}
|
make ${OPTS} -s -j${NUM_CPUS}
|
||||||
|
@ -87,7 +87,7 @@ function check_clean() {
|
|||||||
# Generate sandbox U-Boot - gleaned from /test/dm/test-dm.sh
|
# Generate sandbox U-Boot - gleaned from /test/dm/test-dm.sh
|
||||||
function compile_sandbox() {
|
function compile_sandbox() {
|
||||||
unset CROSS_COMPILE
|
unset CROSS_COMPILE
|
||||||
NUM_CPUS=$(cat /proc/cpuinfo |grep -c processor)
|
NUM_CPUS=$(nproc)
|
||||||
make O=sandbox sandbox_config
|
make O=sandbox sandbox_config
|
||||||
make O=sandbox -s -j${NUM_CPUS}
|
make O=sandbox -s -j${NUM_CPUS}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user