Update lttng-modules build scripts
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 5 Apr 2016 16:39:27 +0000 (12:39 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Tue, 5 Apr 2016 16:39:27 +0000 (12:39 -0400)
scripts/lttng-modules/master-rt.groovy
scripts/lttng-modules/master-ubuntu.groovy
scripts/lttng-modules/master-vanilla.groovy
scripts/lttng-modules/param-build.sh

index 796680ffd219e728bdec20bc5bed7280b3f11a3f..3b84c1ae7dd7aa9814e6ddd697a3e80a1f278f36 100644 (file)
@@ -235,11 +235,7 @@ println "---Build report---"
 for (b in allBuilds) {
   def kernelStr = b.buildVariableResolver.resolve("kversion")
   println "${b.fullDisplayName} (${kernelStr}) completed with status ${b.result}"
-}
-
-// Clean all builds
-// TODO: Delete only builds generated from this job run
-for (b in job.getBuilds()) {
+  // Cleanup builds
   b.delete()
 }
 
index 8dca9cdd3d9a6997573cf76e412b1d8b27b21ef2..7c8e06382d60e728e0dd88fd777b51bd00b98db3 100644 (file)
@@ -166,11 +166,7 @@ println "---Build report---"
 for (b in allBuilds) {
   def kernelStr = b.buildVariableResolver.resolve("kversion")
   println "${b.fullDisplayName} (${kernelStr}) completed with status ${b.result}"
-}
-
-// Clean all builds
-// TODO: Delete only builds generated from this job run
-for (b in job.getBuilds()) {
+  // Cleanup builds
   b.delete()
 }
 
index 74d885c299ada4dea08407f0edd5e1404789619a..b29795717a322cb0152906de364f5ab106da550f 100644 (file)
@@ -253,11 +253,7 @@ println "---Build report---"
 for (b in allBuilds) {
   def kernelStr = b.buildVariableResolver.resolve("kversion")
   println "${b.fullDisplayName} (${kernelStr}) completed with status ${b.result}"
-}
-
-// Clean all builds
-// TODO: Delete only builds generated from this job run
-for (b in job.getBuilds()) {
+  // Cleanup builds
   b.delete()
 }
 
index e22b88450d76c1512865f2fb473524b15a2477c4..cb9602543ef982df5fc885cf6ac5146cf805e602 100644 (file)
@@ -35,6 +35,62 @@ vergt() {
 }
 
 
+prepare_lnx_sources() {
+
+    outdir=$1
+
+    if [ "$outdir" = "." ]; then
+      koutput=""
+    else
+      koutput="O=\"${outdir}\""
+    fi
+
+    # Generate kernel configuration
+    case "$kversion" in
+      Ubuntu*)
+        fakeroot debian/rules clean
+        fakeroot debian/rules genconfigs
+        cp CONFIGS/${ubuntu_config} "${outdir}"/.config
+        ;;
+      *)
+        make ${koutput} defconfig
+        ;;
+    esac
+
+    # GCC 4.8
+    sed -i "s/CONFIG_CC_STACKPROTECTOR_STRONG=y/# CONFIG_CC_STACKPROTECTOR_STRONG is not set/g" "${outdir}"/.config
+
+    # Don't try to sign modules
+    sed -i "s/CONFIG_MODULE_SIG=y/# CONFIG_MODULE_SIG is not set/g" "${outdir}"/.config
+
+    # Enable CONFIG_KALLSYMS_ALL
+    echo "CONFIG_KPROBES=y" >> "${outdir}"/.config
+    echo "CONFIG_FTRACE=y" >> "${outdir}"/.config
+    echo "CONFIG_BLK_DEV_IO_TRACE=y" >> "${outdir}"/.config
+    echo "CONFIG_TRACEPOINTS=y" >> "${outdir}"/.config
+    echo "CONFIG_KALLSYMS_ALL=y" >> "${outdir}"/.config
+
+
+    make ${koutput} silentoldconfig
+    make ${koutput} modules_prepare
+
+    # Version specific tasks
+    case "$kversion" in
+      Ubuntu*)
+        # Add Ubuntu ABI number to kernel headers, this is normally done by the packaging code
+        ABINUM=$(echo $kversion | grep -P -o 'Ubuntu-(lts-)?.*-\K\d+(?=\..*)')
+        echo "#define UTS_UBUNTU_RELEASE_ABI $ABINUM" >> ${outdir}/include/generated/utsrelease.h
+        ;;
+    esac
+
+    # On powerpc this object is required to link modules
+    if [ "${karch}" = "powerpc" ]; then
+        make ${koutput} arch/powerpc/lib/crtsavres.o
+    fi
+}
+
+
+
 build_modules() {
 
     kdir="$1"
@@ -63,10 +119,12 @@ build_modules() {
         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." > "${bdir}/BROKEN.txt"
+        echo "This kernel is broken, there is a deadlock in the timekeeping subsystem." > "${bdir}/BROKEN.txt.ko"
 
         set -e
 
+        KERNELDIR="${kdir}" make clean
+
     else # Regular build
 
         # Build modules against full kernel sources
@@ -96,53 +154,94 @@ LTTBUILKSRCDDIR="${WORKSPACE}/build/lttng-modules-ksrc"
 LTTBUILDKHDRDIR="${WORKSPACE}/build/lttng-modules-khdr"
 
 
-# Set arch specific values
-case "$arch" in
-    "x86-32")
-        karch="x86"
-        cross_compile=""
-        ;;
-
-    "x86-64")
-        karch="x86"
-        cross_compile=""
-        ;;
-
-    "armhf")
-        karch="arm"
-        cross_compile="arm-linux-gnueabihf-"
-        ;;
+# Setup cross compile env if available
+if [ "x${cross_arch:-}" != "x" ]; then
+
+    case "$cross_arch" in
+        "armhf")
+            karch="arm"
+            cross_compile="arm-linux-gnueabihf-"
+            ubuntu_config="armhf-config.flavour.generic"
+            ;;
+
+        "arm64")
+            karch="arm64"
+            cross_compile="aarch64-linux-gnu-"
+            ubuntu_config="arm64-config.flavour.generic"
+            ;;
+
+        "powerpc")
+            karch="powerpc"
+            cross_compile="powerpc-linux-gnu-"
+            ubuntu_config="powerpc-config.flavour.powerpc-smp"
+            ;;
+
+        "ppc64el")
+            karch="powerpc"
+            cross_compile="powerpc64le-linux-gnu-"
+            ubuntu_config="ppc64el-config.flavour.generic"
+            ;;
+
+        *)
+            echo "Unsupported cross arch $arch"
+            exit 1
+            ;;
+    esac
 
-    "arm64")
-        karch="arm64"
-        cross_compile="aarch64-linux-gnu-"
-        ;;
+    # Export variables used by Kbuild for cross compilation
+    export ARCH="${karch}"
+    export CROSS_COMPILE="${cross_compile}"
 
-    "powerpc")
-        karch="powerpc"
-        cross_compile="powerpc-linux-gnu-"
-        ;;
 
-    "ppc64el")
-        karch="powerpc"
-        cross_compile="powerpc64le-linux-gnu-"
-        ;;
+# Set arch specific values if we are not cross compiling
+elif [ "x${arch:-}" != "x" ]; then
+    case "$arch" in
+        "x86-32")
+            karch="x86"
+            ubuntu_config="i386-config.flavour.generic"
+            ;;
+
+        "x86-64")
+            karch="x86"
+            ubuntu_config="amd64-config.flavour.generic"
+            ;;
+
+        "armhf")
+            karch="arm"
+            ubuntu_config="armhf-config.flavour.generic"
+            ;;
+
+        "arm64")
+            karch="arm64"
+            ubuntu_config="arm64-config.flavour.generic"
+            ;;
+
+        "powerpc")
+            karch="powerpc"
+            ubuntu_config="powerpc-config.flavour.powerpc-smp"
+            ;;
+
+        "ppc64el")
+            karch="powerpc"
+            ubuntu_config="ppc64el-config.flavour.generic"
+            ;;
+
+        *)
+            echo "Unsupported arch $arch"
+            exit 1
+            ;;
+    esac
+else
+    echo "Not arch or cross_arch specified"
+    exit 1
+fi
 
-    *)
-        echo "Unsupported arch $arch"
-        exit 1
-        ;;
-esac
 
-# Setup cross compile env if required
-if [ "${cross_build:-}" = "true" ]; then
-    export ARCH="${karch}"
-    export CROSS_COMPILE="${cross_compile}"
-fi
 
 
 # Create build directories
-mkdir -p "${LNXBUILDDIR}" "${LNXHDRDIR}"
+mkdir -p "${LNXBUILDDIR}" "${LNXHDRDIR}" "${LTTBUILKSRCDDIR}" "${LTTBUILDKHDRDIR}"
+
 
 
 ## PREPARE DISTRO STYLE KERNEL HEADERS / DEVEL
@@ -150,20 +249,7 @@ mkdir -p "${LNXBUILDDIR}" "${LNXHDRDIR}"
 # Enter linux source dir
 cd "${LNXSRCDIR}"
 
-# Prepare linux sources for headers install
-make allyesconfig
-sed -i "s/CONFIG_MODULE_SIG=y/# CONFIG_MODULE_SIG is not set/g" .config
-make silentoldconfig
-make modules_prepare
-
-# Version specific tasks
-case "$kversion" in
-  Ubuntu*)
-    # Add Ubuntu ABI number to kernel headers, this is normally done by the packaging code
-    ABINUM=$(echo $kversion | grep -P -o 'Ubuntu-(lts-)?.*-\K\d+(?=\..*)')
-    echo "#define UTS_UBUNTU_RELEASE_ABI $ABINUM" >> include/generated/utsrelease.h
-    ;;
-esac
+prepare_lnx_sources "."
 
 # For RT kernels, copy version file
 if [ -s localversion-rt ]; then
@@ -196,7 +282,6 @@ rm -f "${LNXHDRDIR}/scripts/*/*.o"
 
 # On powerpc this object is required to link modules
 if [ "${karch}" = "powerpc" ]; then
-    make arch/powerpc/lib/crtsavres.o
     cp -a --parents arch/powerpc/lib/crtsavres.[So] "${LNXHDRDIR}/"
 fi
 
@@ -240,31 +325,12 @@ cp "${LNXHDRDIR}/.config" "${LNXHDRDIR}/include/config/auto.conf"
 cd "${LNXSRCDIR}"
 
 # Make sure linux source dir is clean
-make mrproper
-
-# Prepare linux sources for modules OOT build
-make O="${LNXBUILDDIR}" allyesconfig
-sed -i "s/CONFIG_MODULE_SIG=y/# CONFIG_MODULE_SIG is not set/g" "${LNXBUILDDIR}"/.config
-make O="${LNXBUILDDIR}" silentoldconfig
-make O="${LNXBUILDDIR}" modules_prepare
+git clean -xdf
 
-# On powerpc this object is required to link modules
-if [ "${karch}" = "powerpc" ]; then
-    make O="${LNXBUILDDIR}" arch/powerpc/lib/crtsavres.o
-fi
+prepare_lnx_sources "${LNXBUILDDIR}"
 
-# Version specific tasks
-case "$kversion" in
-  Ubuntu*)
-    #fakeroot debian/rules clean
-    #fakeroot debian/rules genconfigs
-    #cp CONFIGS/amd64-config.flavour.generic .config
 
-    # Add Ubuntu ABI number to kernel headers, this is normally done by the packaging code
-    ABINUM=$(echo $kversion | grep -P -o 'Ubuntu-(lts-)?.*-\K\d+(?=\..*)')
-    echo "#define UTS_UBUNTU_RELEASE_ABI $ABINUM" >> ${LNXBUILDDIR}/include/generated/utsrelease.h
-    ;;
-esac
+## BUILD modules
 
 # Build modules against full kernel sources
 build_modules "${LNXBUILDDIR}" "${LTTBUILKSRCDDIR}"
@@ -273,7 +339,14 @@ build_modules "${LNXBUILDDIR}" "${LTTBUILKSRCDDIR}"
 build_modules "${LNXHDRDIR}" "${LTTBUILDKHDRDIR}"
 
 # Make sure modules were built
-find "${LNXBUILDDIR}" -name "*.ko"
-find "${LNXHDRDIR}" -name "*.ko"
+if [ "x$(find "${LTTBUILKSRCDDIR}" -name "*.ko" -printf yes -quit)" != "xyes" ]; then
+  echo "No modules built!"
+  exit 1
+fi
+
+if [ "x$(find "${LTTBUILDKHDRDIR}" -name "*.ko" -printf yes -quit)" != "xyes" ]; then
+  echo "No modules built!"
+  exit 1
+fi
 
 # EOF
This page took 0.028421 seconds and 4 git commands to generate.