From 2d4bfeeb29faf5a95e6357e595950f686c63ee97 Mon Sep 17 00:00:00 2001 From: Chia-Che Tsai Date: Thu, 2 Feb 2017 03:41:54 -0500 Subject: [PATCH] move pal_loader to Runtime. finding manifest.sgx from manifest --- Runtime/pal_loader | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 Runtime/pal_loader diff --git a/Runtime/pal_loader b/Runtime/pal_loader new file mode 100755 index 00000000..f5b6153b --- /dev/null +++ b/Runtime/pal_loader @@ -0,0 +1,41 @@ +#!/bin/bash + +RUNTIME_DIR=$(/usr/bin/dirname $(readlink -f ${BASH_SOURCE[0]})) +PAL_HOST=$(/usr/bin/make --quiet -f $RUNTIME_DIR/../Pal/src/Makefile.Host print_host 2>&1) + +MANIFEST= +GDB_CMD= +PAL_CMD=$RUNTIME_DIR/pal-$PAL_HOST + +if [ "$GDB" == "1" ]; then + GDB="/usr/bin/gdb" +fi + +if [ "$GDB" != "" ] && [ "$GDB" != "0" ]; then + GDB_CMD="$GDB --args" +fi + +if [ "$SEC" == "1" ]; then + echo "Use reference monitor" + PAL_CMD=$RUNTIME_DIR/pal_sec-$PAL_HOST +fi + +while [ "$1" != "" ]; +do + if [ "$MANIFEST" == "" ]; then + MANIFEST=$1 + shift + continue + fi + + break +done + +if [ ! -f "$PAL_CMD" ]; then + echo "$PAL_CMD is not built, or security mode is not supported" + exit 1 +fi + +set -x + +exec $GDB_CMD $PAL_CMD $MANIFEST "$@"