pal_loader 762 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. PAL_CMD=$PAL_SEC
  17. fi
  18. while [ "$1" != "" ];
  19. do
  20. if [ "$1" = "-gdb" ]; then
  21. GDB_CMD="gdb --args"
  22. shift
  23. continue
  24. fi
  25. if [ "$1" = "-sec" ]; then
  26. PAL_CMD=$PAL_SEC
  27. shift
  28. continue
  29. fi
  30. if [ "$MANIFEST" == "" ]; then
  31. MANIFEST=$1
  32. shift
  33. continue
  34. fi
  35. break
  36. done
  37. if [ ! -f "$PAL_CMD" ]; then
  38. echo "$PAL_CMD is not built, or security mode is not supported"
  39. exit 1
  40. fi
  41. exec $GDB_CMD $PAL_CMD $MANIFEST "$@"