ipq806x.sh 993 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2014 The Linux Foundation. All rights reserved.
  4. # Copyright (C) 2011 OpenWrt.org
  5. #
  6. IPQ806X_BOARD_NAME=
  7. IPQ806X_MODEL=
  8. ipq806x_board_detect() {
  9. local machine
  10. local name
  11. machine=$(cat /proc/device-tree/model)
  12. case "$machine" in
  13. *"AP148")
  14. name="ap148"
  15. ;;
  16. *"C2600")
  17. name="c2600"
  18. ;;
  19. *"D7800")
  20. name="d7800"
  21. ;;
  22. *"DB149")
  23. name="db149"
  24. ;;
  25. *"R7500")
  26. name="r7500"
  27. ;;
  28. *"R7500v2")
  29. name="r7500v2"
  30. ;;
  31. *"Linksys EA8500"*)
  32. name="ea8500"
  33. ;;
  34. *"R7800")
  35. name="r7800"
  36. ;;
  37. esac
  38. [ -z "$name" ] && name="unknown"
  39. [ -z "$IPQ806X_BOARD_NAME" ] && IPQ806X_BOARD_NAME="$name"
  40. [ -z "$IPQ806X_MODEL" ] && IPQ806X_MODEL="$machine"
  41. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  42. echo "$IPQ806X_BOARD_NAME" > /tmp/sysinfo/board_name
  43. echo "$IPQ806X_MODEL" > /tmp/sysinfo/model
  44. }
  45. ipq806x_board_name() {
  46. local name
  47. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  48. [ -z "$name" ] && name="unknown"
  49. echo "$name"
  50. }