about summary refs log tree commit diff
path: root/qemu_mode/build_qemu_support.sh
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-03-23 18:19:20 +0100
committerGitHub <noreply@github.com>2020-03-23 18:19:20 +0100
commit82432195a8e46f67394b528fbfe8749903c7f064 (patch)
tree1289a776f96b7af6fed7b1c61509368de14aeb46 /qemu_mode/build_qemu_support.sh
parent0e1d82dd9f5cfe48b294e876924acea2f5094f01 (diff)
parent77b81e7361f7286cc3e0174b87ae5facb9f1290d (diff)
downloadafl++-82432195a8e46f67394b528fbfe8749903c7f064.tar.gz
Merge pull request #266 from AFLplusplus/dev
Diffstat (limited to 'qemu_mode/build_qemu_support.sh')
-rwxr-xr-xqemu_mode/build_qemu_support.sh28
1 files changed, 20 insertions, 8 deletions
diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh
index 09c04e7f..bd42c58e 100755
--- a/qemu_mode/build_qemu_support.sh
+++ b/qemu_mode/build_qemu_support.sh
@@ -62,15 +62,15 @@ if [ ! -f "../afl-showmap" ]; then
 
 fi
 
+PREREQ_NOTFOUND=
+for i in libtool wget python automake autoconf sha384sum bison flex iconv patch pkg-config; do
 
-for i in libtool wget python automake autoconf sha384sum bison iconv; do
-
-  T=`which "$i" 2>/dev/null`
+  T=`command -v "$i" 2>/dev/null`
 
   if [ "$T" = "" ]; then
 
     echo "[-] Error: '$i' not found, please install first."
-    exit 1
+    PREREQ_NOTFOUND=1
 
   fi
 
@@ -79,17 +79,21 @@ done
 if [ ! -d "/usr/include/glib-2.0/" -a ! -d "/usr/local/include/glib-2.0/" ]; then
 
   echo "[-] Error: devel version of 'glib2' not found, please install first."
-  exit 1
+  PREREQ_NOTFOUND=1
 
 fi
 
 if echo "$CC" | grep -qF /afl-; then
 
   echo "[-] Error: do not use afl-gcc or afl-clang to compile this tool."
-  exit 1
+  PREREQ_NOTFOUND=1
 
 fi
 
+if [ "$PREREQ_NOTFOUND" = "1" ]; then
+  exit 1
+fi
+
 echo "[+] All checks passed!"
 
 ARCHIVE="`basename -- "$QEMU_URL"`"
@@ -139,8 +143,16 @@ echo "[*] Configuring QEMU for $CPU_TARGET..."
 
 ORIG_CPU_TARGET="$CPU_TARGET"
 
-test "$CPU_TARGET" = "" && CPU_TARGET="`uname -m`"
-test "$CPU_TARGET" = "i686" && CPU_TARGET="i386"
+if [ "$ORIG_CPU_TARGET" = "" ]; then
+  CPU_TARGET="`uname -m`"
+  test "$CPU_TARGET" = "i686" && CPU_TARGET="i386"
+  test "$CPU_TARGET" = "arm64v8" && CPU_TARGET="aarch64"
+  case "$CPU_TARGET" in 
+    *arm*)
+      CPU_TARGET="arm"
+      ;;
+  esac
+fi
 
 cd qemu-$VERSION || exit 1