build.sh: add support to provide cpus number to use

https://onedigi.atlassian.net/browse/DEL-7629

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
Arturo Buzarra 2021-08-12 11:07:25 +02:00
parent 54cb00e120
commit 6462549f04
2 changed files with 8 additions and 2 deletions

View File

@ -151,7 +151,10 @@ YOCTO_IMGS_DIR="${WORKSPACE}/images"
YOCTO_INST_DIR="${WORKSPACE}/dey.$(echo ${DY_REVISION} | tr '/' '_')" YOCTO_INST_DIR="${WORKSPACE}/dey.$(echo ${DY_REVISION} | tr '/' '_')"
YOCTO_PROJ_DIR="${WORKSPACE}/projects" YOCTO_PROJ_DIR="${WORKSPACE}/projects"
CPUS="$(grep -c processor /proc/cpuinfo)" # If CPUS is unset, set it with the machine cpus
if [ -z "${CPUS}" ]; then
CPUS="$(grep -c processor /proc/cpuinfo)"
fi
[ ${CPUS} -gt 1 ] && MAKE_JOBS="-j${CPUS}" [ ${CPUS} -gt 1 ] && MAKE_JOBS="-j${CPUS}"
printf "\n[INFO] Build Yocto \"${DY_REVISION}\" for \"${DY_PLATFORMS}\" (cpus=${CPUS})\n\n" printf "\n[INFO] Build Yocto \"${DY_REVISION}\" for \"${DY_PLATFORMS}\" (cpus=${CPUS})\n\n"

View File

@ -188,7 +188,10 @@ YOCTO_INST_DIR="${WORKSPACE}/digi-yocto-sdk.$(echo ${DY_REVISION} | tr '/' '_')"
YOCTO_DOWNLOAD_DIR="${DY_DOWNLOADS:-${WORKSPACE}}/downloads" YOCTO_DOWNLOAD_DIR="${DY_DOWNLOADS:-${WORKSPACE}}/downloads"
YOCTO_PROJ_DIR="${WORKSPACE}/projects" YOCTO_PROJ_DIR="${WORKSPACE}/projects"
CPUS="$(grep -c processor /proc/cpuinfo)" # If CPUS is unset, set it with the machine cpus
if [ -z "${CPUS}" ]; then
CPUS="$(grep -c processor /proc/cpuinfo)"
fi
[ ${CPUS} -gt 1 ] && MAKE_JOBS="-j${CPUS}" [ ${CPUS} -gt 1 ] && MAKE_JOBS="-j${CPUS}"
printf "\n[INFO] Build Yocto \"${DY_REVISION}\" for \"${DY_PLATFORMS}\" (cpus=${CPUS})\n\n" printf "\n[INFO] Build Yocto \"${DY_REVISION}\" for \"${DY_PLATFORMS}\" (cpus=${CPUS})\n\n"