pal_loader 800 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. PAL_LOADER=$(readlink -f ${BASH_SOURCE[0]})
  3. PAL_DIR=$(readlink -f $(dirname $PAL_LOADER)/../../../../Pal/src)
  4. PAL=$PAL_DIR/pal
  5. PAL_SEC=$PAL_DIR/pal_sec
  6. MANIFEST=
  7. GDB_CMD=
  8. PAL_CMD=$PAL
  9. if [ "$GDB" == "1" ]; then
  10. GDB="gdb"
  11. fi
  12. if [ "$GDB" != "" ] && [ "$GDB" != "0" ]; then
  13. GDB_CMD="$GDB --args"
  14. fi
  15. if [ "$SEC" == "1" ]; then
  16. echo "Use reference monitor"
  17. PAL_CMD=$PAL_SEC
  18. fi
  19. while [ "$1" != "" ];
  20. do
  21. if [ "$1" = "-gdb" ]; then
  22. GDB_CMD="gdb --args"
  23. shift
  24. continue
  25. fi
  26. if [ "$1" = "-sec" ]; then
  27. PAL_CMD=$PAL_SEC
  28. shift
  29. continue
  30. fi
  31. if [ "$MANIFEST" == "" ]; then
  32. MANIFEST=$1
  33. shift
  34. continue
  35. fi
  36. break
  37. done
  38. if [ ! -f "$PAL_CMD" ]; then
  39. echo "$PAL_CMD is not built, or security mode is not supported"
  40. exit 1
  41. fi
  42. set -x
  43. exec $GDB_CMD $PAL_CMD $MANIFEST "$@"