about summary refs log tree commit diff
path: root/nyx_mode/build_nyx_support.sh
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-01-11 12:20:35 +0100
committerGitHub <noreply@github.com>2022-01-11 12:20:35 +0100
commit10dae419d6e3ebc38f53840c5abfe98e9c901217 (patch)
tree352576e19c8a504c40ea58dbb141056762901a69 /nyx_mode/build_nyx_support.sh
parent74a8f145e09d0361d8f576eb3f2e8881b6116f18 (diff)
parentd2715336a54635bb6e617a2e739c0ad5fe51d28d (diff)
downloadafl++-10dae419d6e3ebc38f53840c5abfe98e9c901217.tar.gz
Merge pull request #1236 from AFLplusplus/dev
push to stable
Diffstat (limited to 'nyx_mode/build_nyx_support.sh')
-rwxr-xr-xnyx_mode/build_nyx_support.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/nyx_mode/build_nyx_support.sh b/nyx_mode/build_nyx_support.sh
new file mode 100755
index 00000000..8626342d
--- /dev/null
+++ b/nyx_mode/build_nyx_support.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+set -e
+
+echo "================================================="
+echo "           Nyx build script"
+echo "================================================="
+echo
+
+echo "[*] Performing basic sanity checks..."
+
+if [ ! "`uname -s`" = "Linux" ]; then
+
+  echo "[-] Error: Nyx mode is only available on Linux."
+  exit 0
+
+fi
+
+echo "[*] Making sure all Nyx is checked out"
+
+git status 1>/dev/null 2>/dev/null
+if [ $? -eq 0 ]; then
+  git submodule init || exit 1
+  echo "[*] initializing QEMU-Nyx submodule"
+  git submodule update ./QEMU-Nyx 2>/dev/null # ignore errors
+  echo "[*] initializing packer submodule"
+  git submodule update ./packer 2>/dev/null # ignore errors
+  echo "[*] initializing libnyx submodule"
+  git submodule update ./libnyx 2>/dev/null # ignore errors
+
+else
+  echo "[ ] not a git repo..."
+  exit 1
+fi
+
+test -d QEMU-Nyx || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; }
+test -d packer || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; }
+test -d libnyx || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; }
+
+echo "[*] checking packer init.cpio.gz ..."
+if [ ! -f "packer/linux_initramfs/init.cpio.gz" ]; then
+    cd packer/linux_initramfs/
+    sh pack.sh || exit 1
+    cd ../../
+fi
+
+echo "[*] Checking libnyx ..."
+if [ ! -f "libnyx/libnyx/target/release/liblibnyx.a" ]; then
+    cd libnyx/libnyx
+    cargo build --release || exit 1
+    cd ../../
+fi
+
+echo "[*] Checking QEMU-Nyx ..."
+if [ ! -f "QEMU-Nyx/x86_64-softmmu/qemu-system-x86_64" ]; then
+    cd QEMU-Nyx/
+    ./compile_qemu_nyx.sh || exit 1
+    cd ..
+fi
+
+echo "[*] Checking libnyx.so ..."
+if [ -f "libnyx/libnyx/target/release/liblibnyx.so" ]; then
+  cp -v libnyx/libnyx/target/release/liblibnyx.so ../libnyx.so || exit 1
+else
+  echo "[ ] libnyx.so not found..."
+  exit 1
+fi
+echo "[+] All done for nyx_mode, enjoy!"
+
+exit 0