pal_loader 715 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. THIS_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
  3. RUNTIME_DIR=$(readlink -f $THIS_DIR/../../../Runtime)
  4. OS=$(make --quiet -f $THIS_DIR/../../../Pal/src/Makefile.Host print_host)
  5. MANIFEST=
  6. GDB_CMD=
  7. PAL_CMD=$RUNTIME_DIR/pal-$OS
  8. if [ "$GDB" == "1" ]; then
  9. GDB="gdb"
  10. fi
  11. if [ "$GDB" != "" ] && [ "$GDB" != "0" ]; then
  12. GDB_CMD="$GDB --args"
  13. fi
  14. if [ "$SEC" == "1" ]; then
  15. echo "Use reference monitor"
  16. PAL_CMD=$RUNTIME_DIR/pal_sec-$OS
  17. fi
  18. while [ "$1" != "" ];
  19. do
  20. if [ "$MANIFEST" == "" ]; then
  21. MANIFEST=$1
  22. shift
  23. continue
  24. fi
  25. break
  26. done
  27. if [ ! -f "$PAL_CMD" ]; then
  28. echo "$PAL_CMD is not built, or security mode is not supported"
  29. exit 1
  30. fi
  31. set -x
  32. exec $GDB_CMD $PAL_CMD $MANIFEST "$@"