mpc85xx.sh 741 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2013 OpenWrt.org
  4. #
  5. MPC85XX_BOARD_NAME=
  6. MPC85XX_MODEL=
  7. mpc85xx_board_detect() {
  8. local model
  9. local name
  10. model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)
  11. case "$model" in
  12. *"TL-WDR4900 v1")
  13. name="tl-wdr4900-v1"
  14. ;;
  15. esac
  16. [ -z "$name" ] && name="unknown"
  17. [ -z "$MPC85XX_BOARD_NAME" ] && MPC85XX_BOARD_NAME="$name"
  18. [ -z "$MPC85XX_MODEL" ] && MPC85XX_MODEL="$model"
  19. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  20. echo "$MPC85XX_BOARD_NAME" > /tmp/sysinfo/board_name
  21. echo "$MPC85XX_MODEL" > /tmp/sysinfo/model
  22. }
  23. mpc85xx_board_name() {
  24. local name
  25. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  26. [ -z "$name" ] && name="unknown"
  27. echo "$name"
  28. }