abuild: fix and enable USE_XARGS configuration
USE_XARGS mode builds n boards in parallel (with 1 CPU each) instead of building 1 board with n CPUs. This requires the main build system to work under such circumstances. Change-Id: Ib4571a78dfe78fd61ae5b26c18be9745bd8b3d52 Reviewed-on: http://review.coreboot.org/4485 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
d935f03938
commit
589555109c
|
@ -47,6 +47,9 @@ configureonly=0
|
||||||
# Did any board fail to build?
|
# Did any board fail to build?
|
||||||
failed=0
|
failed=0
|
||||||
|
|
||||||
|
# default: single CPU build
|
||||||
|
cpus=1
|
||||||
|
|
||||||
# One might want to adjust these in case of cross compiling
|
# One might want to adjust these in case of cross compiling
|
||||||
for i in make gmake gnumake nonexistant_make; do
|
for i in make gmake gnumake nonexistant_make; do
|
||||||
$i --version 2>/dev/null |grep "GNU Make" >/dev/null && break
|
$i --version 2>/dev/null |grep "GNU Make" >/dev/null && break
|
||||||
|
@ -587,6 +590,7 @@ while true ; do
|
||||||
-T|--test) shift; hwtest=true;;
|
-T|--test) shift; hwtest=true;;
|
||||||
-c|--cpus) shift
|
-c|--cpus) shift
|
||||||
export MAKEFLAGS="-j $1"
|
export MAKEFLAGS="-j $1"
|
||||||
|
cpus=$1
|
||||||
test "$MAKEFLAGS" == "-j max" && export MAKEFLAGS="-j" && cpuconfig="in parallel"
|
test "$MAKEFLAGS" == "-j max" && export MAKEFLAGS="-j" && cpuconfig="in parallel"
|
||||||
test "$1" == "1" && cpuconfig="on 1 cpu"
|
test "$1" == "1" && cpuconfig="on 1 cpu"
|
||||||
expr "$1" : '-\?[0-9]\+$' > /dev/null && test 0$1 -gt 1 && cpuconfig="on $1 cpus in parallel"
|
expr "$1" : '-\?[0-9]\+$' > /dev/null && test 0$1 -gt 1 && cpuconfig="on $1 cpus in parallel"
|
||||||
|
@ -633,10 +637,16 @@ fi
|
||||||
|
|
||||||
USE_XARGS=0
|
USE_XARGS=0
|
||||||
if [ "$cpus" != "1" ]; then
|
if [ "$cpus" != "1" ]; then
|
||||||
|
# Limit to 32 parallel builds for now.
|
||||||
|
# Thrashing all caches because we run
|
||||||
|
# 160 abuilds in parallel is no fun.
|
||||||
|
if [ "$cpus" = "max" ]; then
|
||||||
|
cpus=32
|
||||||
|
fi
|
||||||
if [ "$target" = "" ]; then
|
if [ "$target" = "" ]; then
|
||||||
# Test if xargs supports the non-standard -P flag
|
# Test if xargs supports the non-standard -P flag
|
||||||
# FIXME: disabled until we managed to eliminate all the make(1) quirks
|
# FIXME: disabled until we managed to eliminate all the make(1) quirks
|
||||||
echo | xargs -P 0$cpus -n 1 echo 2>/dev/null >/dev/null # && USE_XARGS=1
|
echo | xargs -P ${cpus:-0} -n 1 echo 2>/dev/null >/dev/null && USE_XARGS=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -653,12 +663,6 @@ build_all_targets()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# Limit to 32 parallel builds for now.
|
|
||||||
# Thrashing all caches because we run
|
|
||||||
# 160 abuilds in parallel is no fun.
|
|
||||||
if [ "$cpus" = "" ]; then
|
|
||||||
cpus=32
|
|
||||||
fi
|
|
||||||
build_all_targets()
|
build_all_targets()
|
||||||
{
|
{
|
||||||
# seed shared utils
|
# seed shared utils
|
||||||
|
@ -672,7 +676,7 @@ build_all_targets()
|
||||||
for MAINBOARD in $( mainboards $VENDOR ); do
|
for MAINBOARD in $( mainboards $VENDOR ); do
|
||||||
echo $VENDOR/$MAINBOARD
|
echo $VENDOR/$MAINBOARD
|
||||||
done
|
done
|
||||||
done | xargs -P 0$cpus -n 1 $0 $cmdline -t
|
done | xargs -P ${cpus:-0} -n 1 $0 $cmdline -t
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue