make_args=()
DEBUG=${DEBUG:-}
+FAIL_ON_WARNINGS="${FAIL_ON_WARNINGS:-}"
+if [[ "${FAIL_ON_WARNINGS}" == "false" ]] ; then
+ FAIL_ON_WARNINGS=''
+fi
# Derive arch from label if it isn't set
if [ -z "${arch:-}" ] ; then
git_clone_modules_sources() {
mkdir -p "$MODULES_GIT_DIR"
- # If the version starts with "refs/", checkout the specific git ref, otherwise treat it
- # as a branch name.
- if [ "${mversion:0:5}" = "refs/" ]; then
+ # If the version starts with "refs/" or looks like a commit hash,
+ # checkout the specific git ref, otherwise treat it as a branch name.
+ pattern="^[0-9a-f]{40}$"
+ if [ "${mversion:0:5}" = "refs/" ] || [[ "${mversion}" =~ $pattern ]]; then
git clone --no-tags --depth=1 "${mgitrepo}" "$MODULES_GIT_DIR"
(cd "$MODULES_GIT_DIR" && git fetch origin "${mversion}" && git checkout FETCH_HEAD)
else
# Checkout a shallow kernel tree of the specified tag
git_clone_linux_sources() {
mkdir -p "$LINUX_GIT_DIR"
- git clone --depth=1 -b "${ktag}" --reference "$LINUX_GIT_REF_REPO_DIR" "${kgitrepo}" "$LINUX_GIT_DIR"
+ case "${distroversion:-}" in
+ el*)
+ git clone -b "${ktag}" "${kgitrepo}" src/linux-rpm
+
+ # Get the source files
+ pushd src/linux-rpm
+ "${WORKSPACE}/src/getsrc/getsrc/getsrc.sh"
+ tar -x -C "${LINUX_GIT_DIR}" --strip-components=1 -f SOURCES/linux-*.tar.xz
+ popd
+
+ # Pretend we're a repo like the default expects
+ pushd "${LINUX_GIT_DIR}"
+ git init .
+ git config user.name 'Jenkins'
+ git config user.email 'jenkins@efficios.com'
+ git add .
+ git commit -a -m 'Initial commit'
+ git tag "${ktag}"
+ echo "${LINUX_GIT_REF_REPO_DIR}" > .git/objects/info/alternates
+ popd
+ ;;
+
+ *)
+ git clone --depth=1 -b "${ktag}" --reference-if-able "$LINUX_GIT_REF_REPO_DIR" "${kgitrepo}" "$LINUX_GIT_DIR"
+ ;;
+ esac
}
# Generate kernel configuration
case "$ktag" in
+ *el*)
+ # Copy the EL kernel configuration
+ el_arch="${cross_arch:-$arch}"
+ case "${el_arch}" in
+ amd64)
+ el_arch=x86_64
+ ;;
+ arm64)
+ el_arch=aarch64
+ ;;
+ ppc64el)
+ el_arch=ppc64le
+ ;;
+ *)
+ ;;
+ esac
+ ls "${WORKSPACE}/src/linux-rpm/SOURCES/"
+ if [ -f "${WORKSPACE}/src/linux-rpm/SOURCES/kernel-${el_arch}.config" ] ; then
+ cp "${WORKSPACE}/src/linux-rpm/SOURCES/kernel-${el_arch}.config" .config
+ elif [ -f "${WORKSPACE}/src/linux-rpm/SOURCES/kernel-${el_arch}-rhel.config" ] ; then
+ cp "${WORKSPACE}/src/linux-rpm/SOURCES/kernel-${el_arch}-rhel.config" .config
+ fi
+
+ # Eg.
+ # mm/mempolicy.c: In function ‘mpol_parse_str’:
+ # mm/mempolicy.c:2980:26: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
+ export KCFLAGS="${KCFLAGS} -Wno-error -Wno-all -Wno-error=stringop-overflow -Wno-error=address-of-packed-member"
+ ;;
+
Ubuntu*)
if [ "${cross_arch}" = "powerpc" ] && vergte "${kversion}" "4.10"; then
echo "Ubuntu removed big endian powerpc configuration from kernel >= 4.10. Don't try to build it."
if [ "$(scripts/config --state CONFIG_DEBUG_INFO_BTF)" == "y" ] &&
{ vergte "${pahole_version}" "1.24"; } &&
- { vergte "${kversion}" "5.10"; } && { verlt "${kversion}" "6.0"; } ;then
+ (
+ ( { vergte "${kversion}" "5.10"; } && { verlt "${kversion}" "6.0"; } ) || [[ "${ktag}" =~ .el8 ]]
+ ) ; then
# Some kernels Eg. Ubuntu-hwe-5.13-5.13.0-52.59_20.04.1
# fail with the following error:
# BTFIDS vmlinux
else
# shellcheck disable=SC2016
sed -i 's/ -J ${extra_paholeopt} / -J ${extra_paholeopt} --skip_encoding_btf_enum64 /' scripts/link-vmlinux.sh
+ # Some older versions of RHEL don't have '${extra_paholeopt}'
+ sed -i 's/${PAHOLE} -J ${1}/${PAHOLE} -J --skip_encoding_btf_enum64 ${1}/' scripts/link-vmlinux.sh
fi
fi
scripts/config --disable CONFIG_MICREL_PHY
- # IGBVF won't build with recent gcc on 2.6.38.x
+ # IGBVF won't build with recent gcc on 2.6.38.2
if { vergte "$kversion" "2.6.37" && verlt "$kversion" "2.6.38"; }; then
scripts/config --disable CONFIG_IGBVF
fi
scripts/config --enable CONFIG_EVENT_TRACING
scripts/config --enable CONFIG_KRETPROBES
+ # Starting in linux 6.9-rc1, TRIM_UNUSED_SYMS seems to be true
+ # for out build configurations. In earlier versions the default
+ # was set depending on the value of `COMPILE_TEST`.
+ # See upstream commit d2d5cba5d92c4ed23caa86228a1bc31b07e90fe9.
+ scripts/config --disable CONFIG_TRIM_UNUSED_KSYMS
+
if [ -n "${DEBUG}" ] ; then
cat .config
fi
kversion=$(make -C "$LINUX_HDROBJ_DIR" -s kernelversion)
- # Try to catch some compatibility problems by turning some
- # warnings into errors.
- #export KCFLAGS="$KCFLAGS -Wall -Werror"
-
# Enter lttng-modules source dir
cd "${MODULES_GIT_DIR}"
+ # Try to catch some compatibility problems by turning some
+ # warnings into errors, but only on -rc kernels.
+ pattern="rc[0-9]+$"
+ if [[ "${kversion}" =~ ${pattern} ]] || [[ -n "${FAIL_ON_WARNINGS:-}" ]] ; then
+ export KCFLAGS="${KCFLAGS} -Wall -Werror"
+ # Without the verbose build, the warnings aren't visible.
+ export V=1
+ fi
+
# kernels 3.10 to 3.10.13 and 3.11 to 3.11.2 introduce a deadlock in the
# timekeeping subsystem. We want those build to fail.
if { vergte "$kversion" "3.10" && verlte "$kversion" "3.10.13"; } || \