# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Parameters
+arch=${arch:-}
+cross_arch=${cross_arch:-}
+ktag=${ktag:-}
+
+
## FUNCTIONS ##
# Kernel version compare functions
if [ "$outdir" = "." ]; then
koutput=""
else
- koutput="O=\"${outdir}\""
+ koutput="O=${outdir}"
fi
# Generate kernel configuration
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
make arch/powerpc/lib/crtsavres.o CC="$CC" ${koutput}
fi
- # On arm64 this object is required to build with ftrace support
+ # On arm64 between 4.13 and 1.15 this object is required to build with ftrace support
if [ "${karch}" = "arm64" ]; then
- if vergte "$KVERSION" "4.13-rc1"; then
+ if [ -f "arch/arm64/kernel/ftrace-mod.S" ]; then
make arch/arm64/kernel/ftrace-mod.o CC="$CC" ${koutput}
fi
fi
# Setup cross compile env if available
-if [ "x${cross_arch:-}" != "x" ]; then
+if [ "x${cross_arch}" != "x" ]; then
case "$cross_arch" in
"armhf")
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")
cp -a --parents arch/powerpc/lib/crtsavres.[So] "${LNXHDRDIR}/"
fi
-# On arm64 this object is required to build with ftrace support
+# On arm64 between 4.13 and 1.15 this object is required to build with ftrace support
if [ "${karch}" = "arm64" ]; then
- if vergte "$KVERSION" "4.13-rc1"; 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}"