X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=scripts%2Flttng-modules%2Fparam-build.sh;h=405c61f0ee87dc4a87d67142977e35935facd558;hb=57bdee9e35d8852b90f3d0fd6fc124c34d8d7c0c;hp=5c086e296e666e807148dc94958e59724f88f71e;hpb=51fa2ab3e8eaf66df77d29460a208ae2f2d82ea5;p=lttng-ci.git diff --git a/scripts/lttng-modules/param-build.sh b/scripts/lttng-modules/param-build.sh index 5c086e2..405c61f 100644 --- a/scripts/lttng-modules/param-build.sh +++ b/scripts/lttng-modules/param-build.sh @@ -15,6 +15,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Parameters +arch=${arch:-} +cross_arch=${cross_arch:-} +ktag=${ktag:-} + + ## FUNCTIONS ## # Kernel version compare functions @@ -42,17 +48,28 @@ prepare_lnx_sources() { if [ "$outdir" = "." ]; then koutput="" else - koutput="O=\"${outdir}\"" + koutput="O=${outdir}" fi # Generate kernel configuration - case "$kversion" in + case "$ktag" in Ubuntu*) + if [ "${cross_arch}" = "powerpc" ]; then + if vergte "$KVERSION" "4.10"; then + echo "Ubuntu removed big endian powerpc configuration from kernel >= 4.10. Don't try to build it." + exit 0 + fi + fi fakeroot debian/rules clean fakeroot debian/rules genconfigs cp CONFIGS/"${ubuntu_config}" "${outdir}"/.config ;; *) + # Force 32bit build on x86-32, default is 64bit + if [ "$arch" = "x86-32" ]; then + export ARCH="i386" + fi + # Que sera sera make "${vanilla_config}" CC="$CC" ${koutput} ;; @@ -76,26 +93,32 @@ prepare_lnx_sources() { echo "CONFIG_KALLSYMS_ALL=y"; } >> "${outdir}"/.config + # Debug + #cat "${outdir}"/.config make "$oldconf_target" CC="$CC" ${koutput} make modules_prepare CC="$CC" ${koutput} - # Debug - #cat "${outdir}"/.config + # On powerpc this object is required to link modules + if [ "${karch}" = "powerpc" ]; then + make arch/powerpc/lib/crtsavres.o CC="$CC" ${koutput} + fi + + # On arm64 between 4.13 and 4.15 this object is required to build with ftrace support + if [ "${karch}" = "arm64" ]; then + if [ -f "arch/arm64/kernel/ftrace-mod.S" ]; then + make arch/arm64/kernel/ftrace-mod.o CC="$CC" ${koutput} + fi + fi # Version specific tasks - case "$kversion" in + case "$ktag" 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+(?=\..*)')" + ABINUM="$(echo "$ktag" | 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 arch/powerpc/lib/crtsavres.o CC="$CC" ${koutput} - fi } @@ -105,17 +128,13 @@ build_modules() { kdir="$1" bdir="$2" - # Get kernel version from source tree - cd "${kdir}" - kversion=$(make kernelversion) - # Enter lttng-modules source dir cd "${LTTSRCDIR}" # 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 + if { vergte "$KVERSION" "3.10" && verlte "$KVERSION" "3.10.13"; } || \ + { vergte "$KVERSION" "3.11" && verlte "$KVERSION" "3.11.2"; }; then set +e @@ -165,7 +184,7 @@ LTTBUILDKHDRDIR="${WORKSPACE}/build/lttng-modules-khdr" # Setup cross compile env if available -if [ "x${cross_arch:-}" != "x" ]; then +if [ "x${cross_arch}" != "x" ]; then case "$cross_arch" in "armhf") @@ -202,8 +221,8 @@ if [ "x${cross_arch:-}" != "x" ]; then ;; esac - # Use default gcc when cross-compiling - CC="${cross_compile}gcc" + # Use gcc 4.9, older kernel don't build with gcc 5 + CC="${cross_compile}gcc-4.9" # Export variables used by Kbuild for cross compilation export ARCH="${karch}" @@ -212,7 +231,7 @@ if [ "x${cross_arch:-}" != "x" ]; then oldconf_target="olddefconfig" # Set arch specific values if we are not cross compiling -elif [ "x${arch:-}" != "x" ]; then +elif [ "x${arch}" != "x" ]; then case "$arch" in "x86-32") @@ -280,6 +299,9 @@ mkdir -p "${LNXBUILDDIR}" "${LNXHDRDIR}" "${LTTBUILDKSRCDIR}" "${LTTBUILDKHDRDIR # Enter linux source dir cd "${LNXSRCDIR}" +# Get kernel version from source tree +KVERSION=$(make kernelversion) + prepare_lnx_sources "." # For RT kernels, copy version file @@ -316,6 +338,18 @@ if [ "${karch}" = "powerpc" ]; then cp -a --parents arch/powerpc/lib/crtsavres.[So] "${LNXHDRDIR}/" fi +# On arm64 between 4.13 and 1.15 this object is required to build with ftrace support +if [ "${karch}" = "arm64" ]; then + if [ -f "arch/arm64/kernel/ftrace-mod.S" ]; then + cp -a --parents arch/arm64/kernel/ftrace-mod.[So] "${LNXHDRDIR}/" + fi +fi + +# Newer kernels need objtool to build modules when CONFIG_STACK_VALIDATION=y +if [ -f tools/objtool/objtool ]; then + cp -a --parents tools/objtool/objtool "${LNXHDRDIR}/" +fi + # Copy modules related stuff, if available if [ -s Module.symvers ]; then cp Module.symvers "${LNXHDRDIR}"