build_abi: update the ABI whitelist whenever we refresh the representation

The script `extract_symbols` extracts the symbols that are actually
needed by modules that we build along with the vmlinux. As they change,
we also need to update the whitelist (additive) to add new symbols that
we want to keep stable from now on (as they are potentially used).

Do this whenever we use --update of build_abi.sh

Bug: 147406032
Change-Id: I0e4bf4a93e7533e3c534fa9327d4fe4e1ea3d5ea
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/build_abi.sh b/build_abi.sh
index 4e924df..3b04404 100755
--- a/build_abi.sh
+++ b/build_abi.sh
@@ -146,6 +146,15 @@
 # define a common KMI whitelist flag for the abi tools
 KMI_WHITELIST_FLAG=
 if [ -n "$KMI_WHITELIST" ]; then
+
+    if [ $UPDATE -eq 1 ]; then
+        echo "========================================================"
+        echo " Updating the ABI whitelist"
+        ${ROOT_DIR}/build/abi/extract_symbols       \
+            --whitelist $KERNEL_DIR/$KMI_WHITELIST  \
+            ${DIST_DIR}
+    fi
+
     KMI_WHITELIST_FLAG="--kmi-whitelist $KERNEL_DIR/$KMI_WHITELIST"
 fi