From 02d0e744711d1324d0f1e3e5af040f74776e62eb Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 29 Aug 2016 16:49:07 -0400 Subject: [PATCH] jjb: Add missing build script for latency-tracker Signed-off-by: Michael Jeanson --- scripts/latency-tracker/build.sh | 89 ++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 scripts/latency-tracker/build.sh diff --git a/scripts/latency-tracker/build.sh b/scripts/latency-tracker/build.sh new file mode 100755 index 0000000..8e16edd --- /dev/null +++ b/scripts/latency-tracker/build.sh @@ -0,0 +1,89 @@ +#!/bin/sh -exu +# +# Copyright (C) 2015 - Jonathan Rajotte-Julien +# Michael Jeanson +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Kernel version compare functions +verlte() { + [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | head -n1`" ] +} + +verlt() { + [ "$1" = "$2" ] && return 1 || verlte $1 $2 +} + +vergte() { + [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | tail -n1`" ] +} + +vergt() { + [ "$1" = "$2" ] && return 1 || vergte $1 $2 +} + + +# Use all CPU cores +NPROC=$(nproc) + +SRCDIR="${WORKSPACE}/src/latency-tracker" +BUILDDIR="${WORKSPACE}/build" +LNXSRCDIR="${WORKSPACE}/src/linux" +LNXBINDIR="${WORKSPACE}/deps/linux/build" + +# Create build directory +rm -rf "${BUILDDIR}" +mkdir -p "${BUILDDIR}" + +# Enter source dir +cd "${SRCDIR}" + +# Fix path to linux src in builddir Makefile +sed -i "s#MAKEARGS := -C .*#MAKEARGS := -C ${LNXSRCDIR}#" "${LNXBINDIR}"/Makefile + +# Get kernel version from source tree +cd "${LNXBINDIR}" +KVERSION=$(make kernelversion) +cd - + +# 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"; } || \ + { vergte "$KVERSION" "3.11" && verlte "$KVERSION" "3.11.2"; }; then + + set +e + + # Build modules + KERNELDIR="${LNXBINDIR}" make -j"${NPROC}" V=1 + + # We expect this build to fail, if it doesn't, fail the job. + if [ "$?" -eq 0 ]; then + exit 1 + fi + + # We have to publish at least one file or the build will fail + echo "This kernel is broken, there is a deadlock in the timekeeping subsystem." > "${BUILDDIR}/BROKEN.txt" + + set -e + +else # Regular build + + # Build modules + KERNELDIR="${LNXBINDIR}" make -j"${NPROC}" V=1 + + # Install modules to build dir + KERNELDIR="${LNXBINDIR}" make INSTALL_MOD_PATH="${BUILDDIR}" modules_install +fi + +# EOF -- 2.34.1