brcm2708.sh 888 B

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