pal_loader 1002 B

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