jjb: Correct param builds for linux 6.9-rc1
[lttng-ci.git] / scripts / lttng-modules / build.sh
CommitLineData
51c9c62d 1#!/bin/sh
598af463
MJ
2#
3# Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4# Michael Jeanson <mjeanson@efficios.com>
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
51c9c62d
MJ
19set -exu
20
9351982a
MJ
21# Kernel version compare functions
22verlte() {
23 [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | head -n1`" ]
24}
25
26verlt() {
27 [ "$1" = "$2" ] && return 1 || verlte $1 $2
28}
29
30vergte() {
31 [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | tail -n1`" ]
32}
33
34vergt() {
35 [ "$1" = "$2" ] && return 1 || vergte $1 $2
36}
37
38
598af463
MJ
39# Use all CPU cores
40NPROC=$(nproc)
41
7e942863 42SRCDIR="${WORKSPACE}/src/lttng-modules"
598af463 43BUILDDIR="${WORKSPACE}/build"
7e942863 44LNXSRCDIR="${WORKSPACE}/src/linux"
598af463
MJ
45LNXBINDIR="${WORKSPACE}/deps/linux/build"
46
47# Create build directory
48rm -rf "${BUILDDIR}"
49mkdir -p "${BUILDDIR}"
50
51# Enter source dir
52cd "${SRCDIR}"
53
9351982a 54# Fix path to linux src in builddir Makefile
598af463
MJ
55sed -i "s#MAKEARGS := -C .*#MAKEARGS := -C ${LNXSRCDIR}#" "${LNXBINDIR}"/Makefile
56
9351982a
MJ
57# Get kernel version from source tree
58cd "${LNXBINDIR}"
59KVERSION=$(make kernelversion)
60cd -
61
62# kernels 3.10 to 3.10.13 and 3.11 to 3.11.2 introduce a deadlock in the
63# timekeeping subsystem. We want those build to fail.
64if { vergte "$KVERSION" "3.10" && verlte "$KVERSION" "3.10.13"; } || \
65 { vergte "$KVERSION" "3.11" && verlte "$KVERSION" "3.11.2"; }; then
66
67 set +e
68
69 # Build modules
2c1d386a 70 KERNELDIR="${LNXBINDIR}" make -j${NPROC} V=1 CONFIG_LTTNG=m
9351982a
MJ
71
72 # We expect this build to fail, if it doesn't, fail the job.
73 if [ "$?" -eq 0 ]; then
74 exit 1
75 fi
76
77 # We have to publish at least one file or the build will fail
78 echo "This kernel is broken, there is a deadlock in the timekeeping subsystem." > "${BUILDDIR}/BROKEN.txt"
79
80 set -e
81
82else # Regular build
83
84 # Build modules
2c1d386a 85 KERNELDIR="${LNXBINDIR}" make -j${NPROC} V=1 CONFIG_LTTNG=m
598af463 86
9351982a 87 # Install modules to build dir
2c1d386a 88 KERNELDIR="${LNXBINDIR}" make INSTALL_MOD_PATH="${BUILDDIR}" modules_install
9351982a 89fi
598af463
MJ
90
91# EOF
This page took 0.036138 seconds and 4 git commands to generate.