brcm2708.sh 613 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2015 OpenWrt.org
  4. #
  5. brcm2708_board_detect() {
  6. local machine
  7. local name
  8. machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /Hardware/ {print $2}' /proc/cpuinfo)
  9. case "$machine" in
  10. BCM2708)
  11. name="Raspberry Pi"
  12. ;;
  13. BCM2709)
  14. name="Raspberry Pi 2"
  15. ;;
  16. esac
  17. [ -z "$name" ] && name="unknown"
  18. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  19. echo "$machine" > /tmp/sysinfo/board_name
  20. echo "$name" > /tmp/sysinfo/model
  21. }
  22. brcm2708_board_name() {
  23. local name
  24. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  25. [ -z "$name" ] && name="unknown"
  26. echo "$name"
  27. }