pal_loader 988 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env bash
  2. while :
  3. do
  4. case "$1" in
  5. "SGX")
  6. SGX=1
  7. ;;
  8. "GDB")
  9. GDB=1
  10. ;;
  11. *)
  12. break
  13. ;;
  14. esac
  15. shift
  16. done
  17. RUNTIME_DIR=$(/usr/bin/dirname $(readlink -f ${BASH_SOURCE[0]}))
  18. PAL_HOST=$(/usr/bin/make --no-print-directory --quiet -f $RUNTIME_DIR/../Pal/src/Makefile.Host print_host 2>&1)
  19. MANIFEST=
  20. PREFIX=
  21. PAL_CMD=$RUNTIME_DIR/pal-$PAL_HOST
  22. if [ "$GDB" == "1" ]; then
  23. GDB=$RUNTIME_DIR/pal_gdb-$PAL_HOST
  24. if [ ! -f $GDB ]; then
  25. GDB="/usr/bin/gdb"
  26. fi
  27. fi
  28. if [ "$GDB" != "" ] && [ "$GDB" != "0" ]; then
  29. if [ -n "$INSIDE_EMACS" ]; then
  30. GDB="$GDB -i=mi"
  31. fi
  32. PREFIX="$GDB --args"
  33. fi
  34. if [ "$PERF" == "1" ]; then
  35. PREFIX="perf stat"
  36. fi
  37. if [ "$MEMUSG" == "1" ]; then
  38. PREFIX="$RUNTIME_DIR/../Scripts/memusg"
  39. fi
  40. while [ "$1" != "" ];
  41. do
  42. if [ "$MANIFEST" == "" ]; then
  43. MANIFEST=$1
  44. shift
  45. continue
  46. fi
  47. break
  48. done
  49. if [ ! -f "$PAL_CMD" ]; then
  50. echo "$PAL_CMD is not built, or security mode is not supported"
  51. exit 1
  52. fi
  53. exec $PREFIX $PAL_CMD $MANIFEST "$@"