X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=scripts%2Flttng-modules%2Fparam-build.sh;h=66a443664efa8b2fffd6eb4c43e2c38bc700c5ff;hb=999a2aa067d7690f3d7104da6c10b82d6fb3b964;hp=e016e135173081916b6c728f8daa22e7448970a7;hpb=04873cc390268e8430cd2d4bdc9ff810071fb2a7;p=lttng-ci.git diff --git a/scripts/lttng-modules/param-build.sh b/scripts/lttng-modules/param-build.sh index e016e13..66a4436 100644 --- a/scripts/lttng-modules/param-build.sh +++ b/scripts/lttng-modules/param-build.sh @@ -1,6 +1,6 @@ -#!/bin/bash -exu +#!/bin/bash # -# Copyright (C) 2016-2019 - Michael Jeanson +# Copyright (C) 2016-2019 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 @@ -15,8 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Parameters -arch=${arch:-} +arch=${arch:-amd64} cross_arch=${cross_arch:-} ktag=${ktag:-} kgitrepo=${kgitrepo:-} @@ -32,6 +34,7 @@ verlte() { } verlt() { + # shellcheck disable=SC2015 [ "$1" = "$2" ] && return 1 || verlte "$1" "$2" } @@ -40,13 +43,22 @@ vergte() { } vergt() { + # shellcheck disable=SC2015 [ "$1" = "$2" ] && return 1 || vergte "$1" "$2" } git_clone_modules_sources() { mkdir -p "$MODULES_GIT_DIR" - git clone --depth=1 -b "${mversion}" "${mgitrepo}" "$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 + git clone --no-tags --depth=1 "${mgitrepo}" "$MODULES_GIT_DIR" + (cd "$MODULES_GIT_DIR" && git fetch origin "${mversion}" && git checkout FETCH_HEAD) + else + git clone --no-tags --depth=1 -b "${mversion}" "${mgitrepo}" "$MODULES_GIT_DIR" + fi } # Checkout a shallow kernel tree of the specified tag @@ -92,7 +104,7 @@ select_compiler() { set +e - for cc in gcc-5 gcc-4.8; do + for cc in gcc-8 gcc-5 gcc-4.8; do if "${CROSS_COMPILE:-}${cc}" -I include/ -D__LINUX_COMPILER_H -D__LINUX_COMPILER_TYPES_H -E include/linux/compiler-gcc.h; then selected_cc="$cc" break @@ -140,6 +152,15 @@ build_linux_kernel() { exit 0 fi fi + + # Disable riscv64 config generation, we don't have a toolchain on bionic + sed -i 's/riscv64 //' debian.master/etc/kernelconfig + + # Hack for kernel Ubuntu-hwe-5.8 + if [ ! -f "debian/compat" ]; then + echo "10" > "debian/compat" + fi + fakeroot debian/rules clean KW_DEFCONFIG_DIR=. fakeroot debian/rules genconfigs KW_DEFCONFIG_DIR=. cp CONFIGS/"${ubuntu_config}" .config @@ -270,7 +291,7 @@ build_linux_kernel() { # Save the kernel and modules mkdir -p "$LINUX_INSTOBJ_DIR/boot" make INSTALL_MOD_PATH="$LINUX_INSTOBJ_DIR" INSTALL_MOD_STRIP=1 modules_install CC="$CC" - make INSTALL_PATH="$LINUX_INSTOBJ_DIR/boot" install CC="$CC" + make INSTALL_MOD_PATH="$LINUX_INSTOBJ_DIR" INSTALL_PATH="$LINUX_INSTOBJ_DIR/boot" install CC="$CC" rm -f "$LINUX_INSTOBJ_DIR/lib/modules/${krelease}/source" "$LINUX_INSTOBJ_DIR/lib/modules/${krelease}/build" ln -s ../../../../sources "$LINUX_INSTOBJ_DIR/lib/modules/${krelease}/source" ln -s ../../../../sources "$LINUX_INSTOBJ_DIR/lib/modules/${krelease}/source" @@ -314,7 +335,9 @@ extract_distro_headers() { # On powerpc 32bits this object is required to link modules if [ "${karch}" = "powerpc" ]; then - if [ "x$(scripts/config -s CONFIG_PPC64)" = "xn" ]; then + if [ "x$(scripts/config -s CONFIG_PPC64)" = "xy" ] && vergte "${kversion}" "5.4"; then + : + else cp -a --parents arch/powerpc/lib/crtsavres.[So] "${LINUX_HDROBJ_DIR}/" fi fi @@ -374,7 +397,9 @@ extract_distro_headers() { # On powerpc 32bits this object is required to link modules if [ "${karch}" = "powerpc" ]; then - if [ "x$(scripts/config -s CONFIG_PPC64)" = "xn" ]; then + if [ "x$(scripts/config -s CONFIG_PPC64)" = "xy" ] && vergte "${kversion}" "5.4"; then + : + else make arch/powerpc/lib/crtsavres.o CC="$CC" fi fi @@ -406,6 +431,10 @@ build_modules() { 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}" @@ -586,7 +615,13 @@ signature_v2 = False" > "$WORKSPACE/.s3cfg" url_hash="$(echo -n "$kgitrepo" | md5sum | awk '{ print $1 }')" obj_name="linux.tar.bz2" -obj_url_prefix="$OBJ_STORE_URL/linux-build/$url_hash/$ktag/$arch/${cross_arch:-native}" + +if [ "x${cross_arch}" = "x" ]; then + obj_url_prefix="$OBJ_STORE_URL/linux-build/$url_hash/$ktag/$arch/native" +else + obj_url_prefix="$OBJ_STORE_URL/linux-build/$url_hash/$ktag/${cross_arch}" +fi + obj_url="$obj_url_prefix/$obj_name" set +e