Advertisement
Guest User

Untitled

a guest
May 21st, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  4.  
  5. if [ "$(id -u)" != «0» ]; then
  6. echo «This script must be executed as root. Exiting» >&2
  7. exit 1
  8. fi
  9.  
  10. Fex2Bin="$(which fex2bin)"
  11. if [ «X${Fex2Bin}» = «X» ]; then
  12. apt-get -f -q -y install sunxi-tools
  13. fi
  14.  
  15. Path2ScriptBin="$(df | awk -F" " '/^\/dev\/mmcblk0p1/ {print $6}')"
  16. if [! -f "${Path2ScriptBin}/script.bin" ]; then
  17. echo «Can not find script.bin. Ensure boot partition is mounted» >&2
  18. exit 1
  19. fi
  20.  
  21. MyTmpFile="$(mktemp /tmp/${0##*/}.XXXXXX)"
  22. trap «rm \»${MyTmpFile}\"; exit 0" 0 1 2 3 15
  23.  
  24. bin2fex <"${Path2ScriptBin}/script.bin" | grep -v "^LV" | grep -v "^max_freq" | grep -v "^min_freq" | grep -v "^extremity_freq" >"${MyTmpFile}"
  25. if [ $? -ne 0 ]; then
  26. echo «Could not convert script.bin to fex. Exiting» >&2
  27. exit 1
  28. fi
  29. cp -p "${Path2ScriptBin}/script.bin" "${Path2ScriptBin}/script.bin.bak"
  30.  
  31. sed -i '/\[dvfs_table\]/a \
  32. extremity_freq = 1296000000\
  33. max_freq = 1200000000\
  34. min_freq = 480000000\
  35. LV_count = 7\
  36. LV1_freq = 1296000000\
  37. LV1_volt = 1320\
  38. LV2_freq = 1200000000\
  39. LV2_volt = 1240\
  40. LV3_freq = 1104000000\
  41. LV3_volt = 1180\
  42. LV4_freq = 1008000000\
  43. LV4_volt = 1140\
  44. LV5_freq = 960000000\
  45. LV5_volt = 1080\
  46. LV6_freq = 816000000\
  47. LV6_volt = 1020\
  48. LV7_freq = 480000000\
  49. LV7_volt = 980' "${MyTmpFile}"
  50.  
  51. fex2bin "${MyTmpFile}" "${Path2ScriptBin}/script.bin" >/dev/null
  52. if [ $? -ne 0 ]; then
  53. mv "${Path2ScriptBin}/script.bin.bak" "${Path2ScriptBin}/script.bin"
  54. echo «Writing script.bin went wrong. Nothing changed» >&2
  55. exit 1
  56. fi
  57.  
  58. echo «Successfully repaired broken overvolting/overclocking settings. Reboot necessary for changes to take effect»
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement