rc.pvr 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/sh
  2. #@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
  3. #@License MIT
  4. # The contents of this file are subject to the MIT license as set out below.
  5. #
  6. # Permission is hereby granted, free of charge, to any person obtaining a copy
  7. # of this software and associated documentation files (the "Software"), to deal
  8. # in the Software without restriction, including without limitation the rights
  9. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. # copies of the Software, and to permit persons to whom the Software is
  11. # furnished to do so, subject to the following conditions:
  12. #
  13. # The above copyright notice and this permission notice shall be included in
  14. # all copies or substantial portions of the Software.
  15. #
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. # THE SOFTWARE.
  23. # Auto-generated for omap_linux from build: sgxddk_MAIN@3699939
  24. #
  25. load_pvr()
  26. {
  27. # Load the PVR Services module.
  28. #
  29. if ! /sbin/modprobe -q pvrsrvkm; then
  30. echo "Module pvrsrvkm failed to load. Retrying."
  31. if [ -z $depmod_has_been_run ]; then
  32. if [ -e /sbin/depmod ]; then
  33. echo "Running /sbin/depmod"
  34. /sbin/depmod && depmod_has_been_run=1
  35. fi
  36. fi
  37. if ! /sbin/modprobe -q pvrsrvkm; then return; fi
  38. fi
  39. # Run the PVR initialisation server
  40. if ! /usr/bin/pvrsrvctl --start --no-module; then return; fi
  41. # Load remaining modules.
  42. #
  43. if ! /sbin/modprobe -q bc_example ; then
  44. echo "Module bc_example failed to load. Retrying."
  45. if [ -z $depmod_has_been_run ]; then
  46. if [ -e /sbin/depmod ]; then
  47. echo "Running /sbin/depmod"
  48. /sbin/depmod && depmod_has_been_run=1
  49. fi
  50. fi
  51. if ! /sbin/modprobe -q bc_example ; then echo "Continuing to load PowerVR services"; bc_example_failed=1; fi
  52. fi
  53. # Delete the device for bc_example and recreate with the
  54. # correct major number.
  55. #
  56. if [ -z $bc_example_failed ]; then
  57. bcd_maj=`grep "bc_example$" /proc/devices | cut -b1,2,3`
  58. /bin/rm -f /dev/bc_example
  59. /bin/mknod /dev/bc_example c $bcd_maj 0
  60. /bin/chmod 666 /dev/bc_example
  61. fi
  62. echo "Loaded PowerVR consumer services."
  63. return 0;
  64. }
  65. unload_pvr()
  66. {
  67. # Unload modules. This won't pick up cases where a further module
  68. # has been added which has a dependency on one of these modules.
  69. #
  70. if rmmod bc_example; then :; else echo "Warning: Could not unload bc_example"; fi
  71. # Unload the PVR Services module.
  72. #
  73. if rmmod pvrsrvkm; then :; else return 1; fi
  74. echo "Unloaded PowerVR consumer services."
  75. return 0;
  76. }
  77. # Deal with the type of invocation we get.
  78. #
  79. case "$1" in
  80. "start")
  81. load_pvr
  82. ;;
  83. stop)
  84. if ! unload_pvr; then
  85. echo "Couldn't unload modules" >&2;
  86. fi
  87. ;;
  88. reload|restart)
  89. if unload_pvr; then
  90. load_pvr
  91. else
  92. echo "Couldn't unload modules" >&2;
  93. fi
  94. ;;
  95. *)
  96. echo "$0: unknown argument $1." >&2;
  97. ;;
  98. esac