scripts/build-fpga-{bitstream,rom}: refuse to run outside the chroot

These are no longer expected to work outside the chroot. Add an error
message to remind people in case they try running outside the chroot.
Otherwise they will get a potentially confusing error about some missing
command or Python package.

BUG=b:184111155
TEST=(chroot) scripts/build-fpga-bitstream  # it works
TEST=(glinux) scripts/build-fpga-bitstream  # it errors
TEST=(chroot) scripts/build-fpga-rom  # it works
TEST=(glinux) scripts/build-fpga-rom  # it errors

Change-Id: Ie80ce39951f410ed282412d49174344b5b1e73cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/hps-firmware/+/3739705
Tested-by: Dan Callaghan <dcallagh@chromium.org>
Reviewed-by: David Lattimore <dml@chromium.org>
Commit-Queue: Dan Callaghan <dcallagh@chromium.org>
diff --git a/scripts/build-fpga-bitstream b/scripts/build-fpga-bitstream
index 398e5da..6525355 100755
--- a/scripts/build-fpga-bitstream
+++ b/scripts/build-fpga-bitstream
@@ -6,6 +6,11 @@
 
 set -o errexit
 
+if [ ! -e /etc/cros_chroot_version ] ; then
+    echo "HPS helper scripts must be run inside the ChromeOS chroot." >&2
+    exit 1
+fi
+
 PROJECT_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/..)
 
 cd "${PROJECT_ROOT}"