memalloc_load.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. #-------------------------------------------------------------------------------
  3. #- --
  4. #- This software is confidential and proprietary and may be used --
  5. #- only as expressly authorized by a licensing agreement from --
  6. #- --
  7. #- Hantro Products Oy. --
  8. #- --
  9. #- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  10. #- ALL RIGHTS RESERVED --
  11. #- --
  12. #- The entire notice above must be reproduced --
  13. #- on all copies and should not be removed. --
  14. #- --
  15. #-------------------------------------------------------------------------------
  16. #-
  17. #-- Abstract : Load memalloc --
  18. #-- --
  19. #-------------------------------------------------------------------------------
  20. module="memalloc"
  21. device="/tmp/dev/memalloc"
  22. mode="666"
  23. echo
  24. if [ ! -e /tmp/dev ]
  25. then
  26. mkdir /tmp/dev/
  27. fi
  28. #insert module
  29. insmod $module.ko $* || exit 1
  30. echo "module $module inserted"
  31. #remove old nod
  32. rm -f $device
  33. #read the major asigned at loading time
  34. major=`cat /proc/devices | grep $module | cut -c1-3`
  35. echo "$module major = $major"
  36. #create dev node
  37. mknod $device c $major 0
  38. echo "node $device created"
  39. #give all 'rw' access
  40. chmod $mode $device
  41. echo "set node access to $mode"
  42. #the end
  43. echo