allow users to specify number of build threads
cbmk otherwise uses nproc to set the number of build threads, in these places: * generic make commands in script/update/trees * crossgcc make command in script/update/trees the -T0 option is also used in script/update/release, when running tar. with this change, you can do: export CBMK_THREADS=x where x is the number of threads. when you then run cbmk, your chosen number of threads will override the default. this may be useful on a host that does not have a lot of memory. Signed-off-by: Leah Rowe <info@minifree.org>audit2-merge1
parent
226b2301db
commit
187a3ea484
|
@ -14,6 +14,14 @@ tmpgit="${PWD}/tmp/gitclone"
|
||||||
|
|
||||||
eval "$(setvars "" board boarddir)"
|
eval "$(setvars "" board boarddir)"
|
||||||
|
|
||||||
|
threads=
|
||||||
|
set | grep CBMK_THREADS 1>/dev/null 2>/dev/null || threads=$(nproc) || :
|
||||||
|
[ -z "$threads" ] && threads=$CBMK_THREADS
|
||||||
|
[ -z "$threads" ] && threads=1 # CBMK_THREADS not set, and nproc failed
|
||||||
|
|
||||||
|
expr "X$threads" : "X-\{0,1\}[0123456789][0123456789]*$" \
|
||||||
|
1>/dev/null 2>/dev/null || threads=1 # user specified a non-integer
|
||||||
|
|
||||||
items()
|
items()
|
||||||
{
|
{
|
||||||
rval=1
|
rval=1
|
||||||
|
|
|
@ -192,11 +192,12 @@ mktarball()
|
||||||
mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\""
|
mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\""
|
||||||
if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then
|
if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then
|
||||||
tar --sort=name --owner=root:0 --group=root:0 \
|
tar --sort=name --owner=root:0 --group=root:0 \
|
||||||
--mtime="UTC 2023-11-06" -c "$1" | xz -T0 -9e > "$2" || \
|
--mtime="UTC 2023-11-06" -c "$1" | xz -T$threads -9e \
|
||||||
$err "mktarball 1, ${1}"
|
> "$2" || $err "mktarball 1, ${1}"
|
||||||
else
|
else
|
||||||
# TODO: reproducible tarballs on non-GNU systems
|
# TODO: reproducible tarballs on non-GNU systems
|
||||||
tar -c "$1" | xz -T0 -9e > "$2" || $err "mktarball 2, $1"
|
tar -c "$1" | xz -T$threads -9e > "$2" || \
|
||||||
|
$err "mktarball 2, $1"
|
||||||
fi
|
fi
|
||||||
(
|
(
|
||||||
[ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}"
|
[ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}"
|
||||||
|
|
|
@ -169,7 +169,7 @@ check_cross_compiler()
|
||||||
[ -n "${xlang}" ] && export BUILD_LANGUAGES="$xlang"
|
[ -n "${xlang}" ] && export BUILD_LANGUAGES="$xlang"
|
||||||
|
|
||||||
[ -d "${cbdir}/util/crossgcc/xgcc/${_xarch}/" ] && continue
|
[ -d "${cbdir}/util/crossgcc/xgcc/${_xarch}/" ] && continue
|
||||||
x_ make -C "$cbdir" crossgcc-${_xarch%-*} CPUS=$(nproc)
|
x_ make -C "$cbdir" crossgcc-${_xarch%-*} CPUS=$threads
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ run_make_command()
|
||||||
[ "$project" = "coreboot" ] && [ -z "$mode" ] && x_ \
|
[ "$project" = "coreboot" ] && [ -z "$mode" ] && x_ \
|
||||||
printf "%s\n" "${version%%-*}" > "$codedir/.coreboot-version"
|
printf "%s\n" "${version%%-*}" > "$codedir/.coreboot-version"
|
||||||
|
|
||||||
make $mode -j$(nproc) $makeargs -C "$codedir" || \
|
make $mode -j$threads $makeargs -C "$codedir" || \
|
||||||
$err "run_make $codedir: !make $mode"
|
$err "run_make $codedir: !make $mode"
|
||||||
|
|
||||||
[ "$mode" != "clean" ] && return 0
|
[ "$mode" != "clean" ] && return 0
|
||||||
|
|
Loading…
Reference in New Issue