+ make "$update_conf_target" CC="$CC"
+ make -j"$NPROC" CC="$CC"
+
+ krelease=$(make -s kernelrelease CC="$CC")
+
+ # 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"
+ 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"
+}
+
+
+extract_distro_headers() {
+
+ # Enter linux source dir
+ cd "${LINUX_SRCOBJ_DIR}"
+
+
+ # For RT kernels, copy version file
+ if [ -s localversion-rt ]; then
+ cp -a localversion-rt "${LINUX_HDROBJ_DIR}"
+ fi
+
+ # Copy all Makefile related stuff
+ find . -path './include/*' -prune \
+ -o -path './scripts/*' -prune -o -type f \
+ \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
+ -name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
+ -print | cpio -pd --preserve-modification-time "${LINUX_HDROBJ_DIR}"
+
+ # Copy base scripts and include dirs
+ cp -a scripts include "${LINUX_HDROBJ_DIR}"
+
+ # Copy arch includes
+ (find arch -name include -type d -print0 | \
+ xargs -0 -n1 -i: find : -type f) | \
+ cpio -pd --preserve-modification-time "${LINUX_HDROBJ_DIR}"
+
+ # Copy arch scripts
+ (find arch -name scripts -type d -print0 | \
+ xargs -0 -n1 -i: find : -type f) | \
+ cpio -pd --preserve-modification-time "${LINUX_HDROBJ_DIR}"
+
+ # Cleanup scripts
+ rm -f "${LINUX_HDROBJ_DIR}/scripts/*.o"
+ rm -f "${LINUX_HDROBJ_DIR}/scripts/*/*.o"
+
+ # On powerpc 32bits this object is required to link modules
+ if [ "${karch}" = "powerpc" ]; 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
+
+ # 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] "${LINUX_HDROBJ_DIR}/"
+ 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 "${LINUX_HDROBJ_DIR}/"
+ fi
+
+ if [ -f "arch/x86/kernel/macros.s" ]; then
+ cp -a --parents arch/x86/kernel/macros.s "${LINUX_HDROBJ_DIR}/"
+ fi
+
+ # Copy modules related stuff, if available
+ if [ -s Module.symvers ]; then
+ cp Module.symvers "${LINUX_HDROBJ_DIR}"
+ fi
+
+ if [ -s System.map ]; then
+ cp System.map "${LINUX_HDROBJ_DIR}"
+ fi
+
+ if [ -s Module.markers ]; then
+ cp Module.markers "${LINUX_HDROBJ_DIR}"
+ fi
+
+ # Copy config file
+ cp .config "${LINUX_HDROBJ_DIR}"
+
+ # Make sure the Makefile and version.h have a matching timestamp so that
+ # external modules can be built
+ if [ -s "${LINUX_HDROBJ_DIR}/include/generated/uapi/linux/version.h" ]; then
+ touch -r "${LINUX_HDROBJ_DIR}/Makefile" "${LINUX_HDROBJ_DIR}/include/generated/uapi/linux/version.h"
+ elif [ -s "${LINUX_HDROBJ_DIR}/include/linux/version.h" ]; then
+ touch -r "${LINUX_HDROBJ_DIR}/Makefile" "${LINUX_HDROBJ_DIR}/include/linux/version.h"
+ else
+ echo "Missing version.h"
+ exit 1
+ fi
+ touch -r "${LINUX_HDROBJ_DIR}/.config" "${LINUX_HDROBJ_DIR}/include/generated/autoconf.h"
+
+ # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
+ cp "${LINUX_HDROBJ_DIR}/.config" "${LINUX_HDROBJ_DIR}/include/config/auto.conf"
+
+ # Finally clean the object files from the full source tree
+ make clean
+
+ # And regen the modules support files
+ make modules_prepare CC="$CC"
+
+ # On powerpc 32bits this object is required to link modules