build_abi.sh: Ensure valid abigail installation

As of now, build_abi.sh (indirectly) relies on libabigail while creating
the abi dump. In case abigail is not installed or not in PATH, this
script will do all the (time consuming) kernel building before failing
at its most essential step. Avoid that by ensuring a valid abigail
before building the kernel.

Change-Id: I979b61de00473f4cfd6537f7151add454a02c1c9
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/build_abi.sh b/build_abi.sh
index 12d125e..011bfd2 100755
--- a/build_abi.sh
+++ b/build_abi.sh
@@ -39,6 +39,14 @@
      make O=${OUT_DIR} $archsubarch CROSS_COMPILE=${CROSS_COMPILE} olddefconfig)
 }
 
+# ensure we have a sufficient abigail installation in path before continuing
+if ! dpkg --compare-versions \
+       $(abidiff --version | awk '{print $2}') ge 1.6.0; then
+    echo "ERROR: no suitable libabigail (>= 1.6.0) in \$PATH."
+    echo "Did you run abi/bootstrap and followed the instructions?"
+    exit 1
+fi
+
 # delegate the actual build to build.sh
 ${ROOT_DIR}/build/build.sh $*