summaryrefslogtreecommitdiff
path: root/util/linux_ec_commands_h_check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'util/linux_ec_commands_h_check.sh')
-rwxr-xr-xutil/linux_ec_commands_h_check.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/util/linux_ec_commands_h_check.sh b/util/linux_ec_commands_h_check.sh
new file mode 100755
index 0000000000..4c55faca0a
--- /dev/null
+++ b/util/linux_ec_commands_h_check.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+
+ec_commands_file_in="include/ec_commands.h"
+ec_commands_file_out="build/kernel/include/linux/mfd/cros_ec_commands.h"
+
+# Check if ec_commands.h has changed.
+echo ${PRESUBMIT_FILES} | grep -q "${ec_commands_file_in}" || exit 0
+
+if [ ! -f "${ec_commands_file_out}" ]; then
+ echo "A new cros_ec_commands.h must be generated."
+ echo 'Please run "make buildall" or "make build_cros_ec_commands"'.
+ exit 1
+fi
+
+if [ "${ec_commands_file_out}" -ot "${ec_commands_file_in}" ]; then
+ echo "cros_ec_commands.h is out of date."
+ echo 'Please run "make buildall" or "make build_cros_ec_commands"'.
+ exit 1
+fi