brcm2708.sh 982 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. # Copyright (C) 2015-2016 OpenWrt.org
  3. # Copyright (C) 2017 LEDE project
  4. ifname=""
  5. brcm2708_detect() {
  6. local board_name model
  7. model=$(cat /proc/device-tree/model)
  8. case "$model" in
  9. "Raspberry Pi 2 Model B Rev"*)
  10. board_name="rpi-2-b"
  11. ;;
  12. "Raspberry Pi 3 Model B Rev"*)
  13. board_name="rpi-3-b"
  14. ;;
  15. "Raspberry Pi Compute Module Rev"*)
  16. board_name="rpi-cm"
  17. ;;
  18. "Raspberry Pi Model B Plus Rev"* |\
  19. "Raspberry Pi Model B+ Rev"*)
  20. board_name="rpi-b-plus"
  21. ;;
  22. "Raspberry Pi Model B Rev"*)
  23. board_name="rpi-b"
  24. ;;
  25. "Raspberry Pi Zero Rev"*)
  26. board_name="rpi-zero"
  27. ;;
  28. "Raspberry Pi Zero W Rev"*)
  29. board_name="rpi-zero-w"
  30. ;;
  31. *)
  32. board_name="unknown"
  33. ;;
  34. esac
  35. [ -e "/tmp/sysinfo" ] || mkdir -p "/tmp/sysinfo"
  36. echo "$board_name" > /tmp/sysinfo/board_name
  37. echo "$model" > /tmp/sysinfo/model
  38. }
  39. brcm2708_board_name() {
  40. local name
  41. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  42. [ -n "$name" ] || name="unknown"
  43. echo $name
  44. }