rebuild.sh: sanity check for ranchu branch checkout.

This patch adds another sanity check to ensure that the qemu-android
checkout corresponds to the 'ranchu' branch, and provide useful
human readable instructions if this is not the case.
diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh
index 76cd47c..30629f6 100755
--- a/scripts/rebuild.sh
+++ b/scripts/rebuild.sh
@@ -93,6 +93,18 @@
     exit 1
 fi
 
+# Sanity check: We need the 'ranchu' branch checked out in qemu-android
+if [ ! -f "$QEMU_ANDROID/hw/misc/android_pipe.c" ]; then
+    >&2 cat <<EOF
+ERROR: Your qemu-android checkout is not from the 'ranchu' branch. Please
+       run the following command an re-run this script:
+
+  (cd $QEMU_ANDROID && git checkout origin/ranchu)
+
+EOF
+    exit 1
+fi
+
 AOSP_SOURCE_DIR=$PARAM_2
 if [ ! -d "$AOSP_SOURCE_DIR"/prebuilts/gcc ]; then
     panic "Not a valid AOSP checkout directory: $AOSP_SOURCE_DIR"