netlogic.sh 886 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2014 OpenWrt.org
  4. #
  5. NETLOGIC_BOARD_NAME=
  6. NETLOGIC_MODEL=
  7. netlogic_board_detect() {
  8. local machine
  9. local name
  10. machine=$(awk 'BEGIN{FS="[ \t:/]+"} /machine/ {print $2}' /proc/cpuinfo)
  11. case "$machine" in
  12. *"netlogic,XLP-EVP")
  13. name="xlp-evp"
  14. ;;
  15. *"netlogic,XLP-FVP")
  16. name="xlp-fvp"
  17. ;;
  18. *"netlogic,XLP-GVP")
  19. name="xlp-gvp"
  20. ;;
  21. *"netlogic,XLP-SVP")
  22. name="xlp-svp"
  23. ;;
  24. esac
  25. [ -z "$name" ] && name="unknown"
  26. [ -z "$NETLOGIC_BOARD_NAME" ] && NETLOGIC_BOARD_NAME="$name"
  27. [ -z "$NETLOGIC_MODEL" ] && NETLOGIC_MODEL="$machine"
  28. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  29. echo "$NETLOGIC_BOARD_NAME" > /tmp/sysinfo/board_name
  30. echo "$NETLOGIC_MODEL" > /tmp/sysinfo/model
  31. }
  32. netlogic_board_name() {
  33. local name
  34. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  35. [ -z "$name" ] && name="unknown"
  36. echo "$name"
  37. }