build scripts: sync internal and Github build scripts
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
5956782ac3
commit
94a865cc0e
|
|
@ -14,9 +14,11 @@
|
||||||
# !Description: Yocto autobuild script from Jenkins.
|
# !Description: Yocto autobuild script from Jenkins.
|
||||||
#
|
#
|
||||||
# Parameters set by Jenkins:
|
# Parameters set by Jenkins:
|
||||||
# DY_PLATFORMS: Platforms to build
|
# DY_BUILD_RELEASE: Build for release mode
|
||||||
# DY_REVISION: Revision of the manifest repository (for 'repo init')
|
# DY_BUILD_TCHAIN: Build toolchains for DEY images
|
||||||
# DY_TARGET: Target image (the default is platform dependent)
|
# DY_PLATFORMS: Platforms to build
|
||||||
|
# DY_REVISION: Revision of the manifest repository (for 'repo init')
|
||||||
|
# DY_TARGET: Target image (the default is platform dependent)
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
|
|
@ -56,10 +58,15 @@ copy_images() {
|
||||||
# Copy individual packages only for 'release' builds, not for 'daily'.
|
# Copy individual packages only for 'release' builds, not for 'daily'.
|
||||||
# For 'daily' builds just copy the firmware images (the buildserver
|
# For 'daily' builds just copy the firmware images (the buildserver
|
||||||
# cannot afford such amount of disk space)
|
# cannot afford such amount of disk space)
|
||||||
if echo "${JOB_NAME}" | grep -qs 'dey.*release'; then
|
if [ "${DY_BUILD_RELEASE}" = "true" ]; then
|
||||||
cp -r tmp/deploy/* "${1}"/
|
cp -r tmp/deploy/* "${1}"/
|
||||||
else
|
else
|
||||||
cp -r tmp/deploy/images "${1}"/
|
cp -r tmp/deploy/images "${1}"/
|
||||||
|
if [ "${DY_BUILD_TCHAIN}" = "true" ]; then
|
||||||
|
if [ -d tmp/deploy/sdk ]; then
|
||||||
|
cp -r tmp/deploy/sdk "${1}"/
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Images directory post-processing
|
# Images directory post-processing
|
||||||
|
|
@ -109,9 +116,15 @@ swu_recipe_name() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sanity checks (Jenkins environment)
|
# Sanity check (Jenkins environment)
|
||||||
[ -z "${DY_REVISION}" ] && error "DY_REVISION not specified"
|
[ -z "${DY_REVISION}" ] && error "DY_REVISION not specified"
|
||||||
[ -z "${WORKSPACE}" ] && error "WORKSPACE not specified"
|
[ -z "${WORKSPACE}" ] && error "WORKSPACE not specified"
|
||||||
|
|
||||||
|
# Set default settings if Jenkins does not do it
|
||||||
|
[ -z "${DY_BUILD_RELEASE}" ] && [[ "${JOB_NAME}" =~ dey-.*-release ]] && DY_BUILD_RELEASE="true"
|
||||||
|
|
||||||
|
# If DY_BUILD_TCHAIN is unset, set it for release jobs
|
||||||
|
[ -z "${DY_BUILD_TCHAIN}" ] && [ "${DY_BUILD_RELEASE}" = "true" ] && DY_BUILD_TCHAIN="true"
|
||||||
|
|
||||||
# Per-platform data
|
# Per-platform data
|
||||||
while read -r _pl _tgt; do
|
while read -r _pl _tgt; do
|
||||||
|
|
@ -139,7 +152,8 @@ _EOF_
|
||||||
DY_PLATFORMS="${DY_PLATFORMS:-${AVAILABLE_PLATFORMS}}"
|
DY_PLATFORMS="${DY_PLATFORMS:-${AVAILABLE_PLATFORMS}}"
|
||||||
|
|
||||||
YOCTO_IMGS_DIR="${WORKSPACE}/images"
|
YOCTO_IMGS_DIR="${WORKSPACE}/images"
|
||||||
YOCTO_INST_DIR="${WORKSPACE}/dey.$(echo "${DY_REVISION}" | tr '/' '_')"
|
YOCTO_INST_DIR="${WORKSPACE}/digi-yocto-sdk-github.$(echo "${DY_REVISION}" | tr '/' '_')"
|
||||||
|
YOCTO_DOWNLOAD_DIR="${DY_DOWNLOADS:-${WORKSPACE}}/downloads"
|
||||||
YOCTO_PROJ_DIR="${WORKSPACE}/projects"
|
YOCTO_PROJ_DIR="${WORKSPACE}/projects"
|
||||||
|
|
||||||
# If CPUS is unset, set it with the machine cpus
|
# If CPUS is unset, set it with the machine cpus
|
||||||
|
|
@ -150,8 +164,8 @@ fi
|
||||||
|
|
||||||
printf "\n[INFO] Build Yocto \"%s\" for \"%s\" (cpus=%s)\n\n" "${DY_REVISION}" "${DY_PLATFORMS}" "${CPUS}"
|
printf "\n[INFO] Build Yocto \"%s\" for \"%s\" (cpus=%s)\n\n" "${DY_REVISION}" "${DY_PLATFORMS}" "${CPUS}"
|
||||||
|
|
||||||
# Install DEY
|
# Install/Update Digi's Yocto SDK
|
||||||
rm -rf "${YOCTO_INST_DIR}" && mkdir -p "${YOCTO_INST_DIR}"
|
mkdir -p "${YOCTO_INST_DIR}"
|
||||||
if pushd "${YOCTO_INST_DIR}"; then
|
if pushd "${YOCTO_INST_DIR}"; then
|
||||||
# Use git ls-remote to check the revision type
|
# Use git ls-remote to check the revision type
|
||||||
if [ "${DY_REVISION}" != "master" ]; then
|
if [ "${DY_REVISION}" != "master" ]; then
|
||||||
|
|
@ -175,13 +189,20 @@ if pushd "${YOCTO_INST_DIR}"; then
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create projects and build
|
# Clean downloads directory
|
||||||
|
if [ "${DY_RM_DOWNLOADS}" = "true" ]; then
|
||||||
|
printf "\n[INFO] Removing the downloads folder.\n"
|
||||||
|
rm -rf "${YOCTO_DOWNLOAD_DIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean images and projects folders
|
||||||
rm -rf "${YOCTO_IMGS_DIR}" "${YOCTO_PROJ_DIR}"
|
rm -rf "${YOCTO_IMGS_DIR}" "${YOCTO_PROJ_DIR}"
|
||||||
|
|
||||||
|
# Create projects and build
|
||||||
for platform in ${DY_PLATFORMS}; do
|
for platform in ${DY_PLATFORMS}; do
|
||||||
# The variable <platform>_tgt got its dashes converted to
|
# The variable <platform>_tgt got its dashes converted to
|
||||||
# underscores, so we must convert also the ones in ${platform}.
|
# underscores, so we must convert also the ones in ${platform}.
|
||||||
eval "platform_targets=\"\${${platform//-/_}_tgt}\""
|
eval "platform_targets=\"\${${platform//-/_}_tgt}\""
|
||||||
|
|
||||||
_this_prj_dir="${YOCTO_PROJ_DIR}/${platform}"
|
_this_prj_dir="${YOCTO_PROJ_DIR}/${platform}"
|
||||||
_this_img_dir="${YOCTO_IMGS_DIR}/${platform}"
|
_this_img_dir="${YOCTO_IMGS_DIR}/${platform}"
|
||||||
mkdir -p "${_this_img_dir}" "${_this_prj_dir}"
|
mkdir -p "${_this_img_dir}" "${_this_prj_dir}"
|
||||||
|
|
@ -193,7 +214,7 @@ for platform in ${DY_PLATFORMS}; do
|
||||||
# shellcheck disable=SC1091,SC2086
|
# shellcheck disable=SC1091,SC2086
|
||||||
MKP_PAGER="" . ${YOCTO_INST_DIR}/mkproject.sh -p "${platform}" <<< "y"
|
MKP_PAGER="" . ${YOCTO_INST_DIR}/mkproject.sh -p "${platform}" <<< "y"
|
||||||
# Set a common DL_DIR and SSTATE_DIR for all platforms
|
# Set a common DL_DIR and SSTATE_DIR for all platforms
|
||||||
sed -i -e "/^#DL_DIR ?=/cDL_DIR ?= \"${YOCTO_PROJ_DIR}/downloads\"" \
|
sed -i -e "/^#DL_DIR ?=/cDL_DIR ?= \"${YOCTO_DOWNLOAD_DIR}\"" \
|
||||||
-e "/^#SSTATE_DIR ?=/cSSTATE_DIR ?= \"${YOCTO_PROJ_DIR}/sstate-cache\"" \
|
-e "/^#SSTATE_DIR ?=/cSSTATE_DIR ?= \"${YOCTO_PROJ_DIR}/sstate-cache\"" \
|
||||||
conf/local.conf
|
conf/local.conf
|
||||||
{
|
{
|
||||||
|
|
@ -205,6 +226,11 @@ for platform in ${DY_PLATFORMS}; do
|
||||||
printf "\n[INFO] Building the %s target.\n" "${target}"
|
printf "\n[INFO] Building the %s target.\n" "${target}"
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
time bitbake "${target}" $(swu_recipe_name "${target}")
|
time bitbake "${target}" $(swu_recipe_name "${target}")
|
||||||
|
# Build the toolchain for DEY images
|
||||||
|
if [ "${DY_BUILD_TCHAIN}" = "true" ] && echo "${target}" | grep -qs '^\(core\|dey\)-image-[^-]\+$'; then
|
||||||
|
printf "\n[INFO] Building the toolchain for %s.\n" "${target}"
|
||||||
|
time bitbake -c populate_sdk "${target}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
purge_sstate
|
purge_sstate
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,13 @@
|
||||||
# !Description: Yocto autobuild script from Jenkins.
|
# !Description: Yocto autobuild script from Jenkins.
|
||||||
#
|
#
|
||||||
# Parameters set by Jenkins:
|
# Parameters set by Jenkins:
|
||||||
|
# DY_BUILD_RELEASE: Build for release mode
|
||||||
# DY_BUILD_TCHAIN: Build toolchains for DEY images
|
# DY_BUILD_TCHAIN: Build toolchains for DEY images
|
||||||
# DY_DISTRO: Distribution name (the default is 'dey')
|
# DY_DISTRO: Distribution name (the default is 'dey')
|
||||||
# DY_PLATFORMS: Platforms to build
|
# DY_PLATFORMS: Platforms to build
|
||||||
# DY_REVISION: Revision of the manifest repository (for 'repo init')
|
# DY_REVISION: Revision of the manifest repository (for 'repo init')
|
||||||
# DY_RM_WORK: Remove the package working folders to save disk space.
|
# DY_RM_WORK: Remove the package working folders to save disk space.
|
||||||
# DY_TARGET: Target image (the default is 'dey-image-qt')
|
# DY_TARGET: Target image (the default is platform dependent)
|
||||||
# DY_USE_MIRROR: Use internal Digi mirror to download packages
|
# DY_USE_MIRROR: Use internal Digi mirror to download packages
|
||||||
# DY_CVE_REPORT: Generate Vigiles CVE report
|
# DY_CVE_REPORT: Generate Vigiles CVE report
|
||||||
# DY_VIGILES_DIR: Path to Vigiles configuration files on the build server
|
# DY_VIGILES_DIR: Path to Vigiles configuration files on the build server
|
||||||
|
|
@ -138,7 +139,6 @@ swu_recipe_name() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sanity check (Jenkins environment)
|
# Sanity check (Jenkins environment)
|
||||||
[ -z "${DY_PLATFORMS}" ] && error "DY_PLATFORMS not specified"
|
|
||||||
[ -z "${DY_REVISION}" ] && error "DY_REVISION not specified"
|
[ -z "${DY_REVISION}" ] && error "DY_REVISION not specified"
|
||||||
[ -z "${DY_RM_WORK}" ] && error "DY_RM_WORK not specified"
|
[ -z "${DY_RM_WORK}" ] && error "DY_RM_WORK not specified"
|
||||||
[ -z "${DY_USE_MIRROR}" ] && error "DY_USE_MIRROR not specified"
|
[ -z "${DY_USE_MIRROR}" ] && error "DY_USE_MIRROR not specified"
|
||||||
|
|
@ -164,6 +164,7 @@ fi
|
||||||
|
|
||||||
# Per-platform data
|
# Per-platform data
|
||||||
while read -r _pl _tgt; do
|
while read -r _pl _tgt; do
|
||||||
|
AVAILABLE_PLATFORMS="${AVAILABLE_PLATFORMS:+${AVAILABLE_PLATFORMS} }${_pl}"
|
||||||
# shellcheck disable=SC2015
|
# shellcheck disable=SC2015
|
||||||
[ -n "${DY_TARGET}" ] && _tgt="${DY_TARGET}" || true
|
[ -n "${DY_TARGET}" ] && _tgt="${DY_TARGET}" || true
|
||||||
# Dashes are not allowed in variables so let's substitute them on
|
# Dashes are not allowed in variables so let's substitute them on
|
||||||
|
|
@ -185,6 +186,9 @@ done<<-_EOF_
|
||||||
ccimx93-dvk dey-image-qt
|
ccimx93-dvk dey-image-qt
|
||||||
_EOF_
|
_EOF_
|
||||||
|
|
||||||
|
# Set default values if not provided by Jenkins
|
||||||
|
DY_PLATFORMS="${DY_PLATFORMS:-${AVAILABLE_PLATFORMS}}"
|
||||||
|
|
||||||
YOCTO_IMGS_DIR="${WORKSPACE}/images"
|
YOCTO_IMGS_DIR="${WORKSPACE}/images"
|
||||||
YOCTO_INST_DIR="${WORKSPACE}/digi-yocto-sdk.$(echo "${DY_REVISION}" | tr '/' '_')"
|
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"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue