Add PRE_DEFCONFIG + POST_KERNEL_BUILD hooks

Kernel LTS merge builds need to watch the entire kernel directory
with inotifywait in order to determine which files were used during
compilation. This file list is then used to build an annotated commit
message for the merge by marking those commits that actually affected
the build.

Add PRE_DEFCONFIG hook for starting inotifywait.

Add POST_KERNEL_BUILD hook for terminating inotifywait and creating
the annotated commit message.

build.config.lts will be created to utilize these hooks.

Change-Id: If65f59817cf8c3455b7d2fc6c3931da950ef3d9f
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/build.sh b/build.sh
index cc2aa82..fb69e13 100755
--- a/build.sh
+++ b/build.sh
@@ -142,6 +142,14 @@
   set +x
 fi
 
+if [ "${PRE_DEFCONFIG_CMDS}" != "" ]; then
+  echo "========================================================"
+  echo " Running pre-defconfig command(s):"
+  set -x
+  eval ${PRE_DEFCONFIG_CMDS}
+  set +x
+fi
+
 if [ -z "${SKIP_DEFCONFIG}" ] ; then
 set -x
 (cd ${KERNEL_DIR} && make O=${OUT_DIR} ${DEFCONFIG})
@@ -172,6 +180,14 @@
  make O=${OUT_DIR} ${CC_ARG} ${LD_ARG} -j$(nproc) $@)
 set +x
 
+if [ "${POST_KERNEL_BUILD_CMDS}" != "" ]; then
+  echo "========================================================"
+  echo " Running post-kernel-build command(s):"
+  set -x
+  eval ${POST_KERNEL_BUILD_CMDS}
+  set +x
+fi
+
 rm -rf ${MODULES_STAGING_DIR}
 mkdir -p ${MODULES_STAGING_DIR}