 --- /home/nick/Projects/junk/safe/afl-1.83b/qemu_mode/build_qemu_support.sh	2015-04-29 20:34:59.000000000 -0700
-+++ build_qemu_support.sh	2015-07-20 16:25:11.133153055 -0700
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/bin/bash
- #
- # american fuzzy lop - QEMU build script
- # --------------------------------------
++++ build_qemu_support.sh	2015-07-21 20:07:05.335408947 -0700
 @@ -139,7 +139,7 @@
  
  echo "[*] Attempting to build QEMU (fingers crossed!)..."

+git -C $QEMU_DIR checkout afl || exit 1
+git -C $QEMU_DIR pull || exit 1
+echo "[+] Checked out."
 
-make >/dev/null || exit 1
+echo "[*] Attempting to merge in driller's changes"
 
-gcc test-instr.c -o test-instr || exit 1
+# we have to do this for the merge to work, the changes in base driller should probably 
+# just be merged into AFL
+if [[ $(git config user.name) == "" ]]; then
+    git config --global user.name "driller"
+fi
 
-unset AFL_INST_RATIO
+if [[ $(git config user.email) == "" ]]; then
+    git config --global user.email "driller@example.com"
+fi
 
-echo 0 | ./afl-showmap -m none -Q -q -o .test-instr0 ./test-instr || exit 1
-echo 1 | ./afl-showmap -m none -Q -q -o .test-instr1 ./test-instr || exit 1
+git -C $QEMU_DIR merge origin/base_driller -m "Merge it!" || exit 1
 
-rm -f test-instr
+echo "[*] Configuring QEMU..."
 
-cmp -s .test-instr0 .test-instr1
-DR="$?"
+cd $QEMU_DIR || exit 1
 
-rm -f .test-instr0 .test-instr1
+./cgc_configure_opt
 
-if [ "$DR" = "0" ]; then
+echo "[+] Configuration complete."
 
-  echo "[-] Error: afl-qemu-trace instrumentation doesn't seem to work!"
-  exit 1
+echo "[*] Attempting to build QEMU (fingers crossed!)..."
 
-fi
+make -j || exit 1
+
+echo "[+] Build process successful!"
+
+echo "[*] Copying binary..."
+
+cp -f "i386-linux-user/qemu-i386" "../../afl-qemu-trace-cgc" || exit 1
+
+cd ..
+ls -l ../afl-qemu-trace-cgc || exit 1
 

 
 echo "[+] Build process successful!"
 
@@ -150,37 +150,73 @@
 cd ..
 ls -l ../afl-qemu-trace || exit 1
 
