arc.sh 891 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2016 OpenWrt.org
  4. #
  5. # defaults
  6. ARC_BOARD_NAME="generic"
  7. ARC_BOARD_MODEL="Generic ARC board"
  8. arc_board_detect() {
  9. local board
  10. local model
  11. local compatible
  12. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  13. model="$( cat /proc/device-tree/model )"
  14. compatible="$( cat /proc/device-tree/compatible )"
  15. case "$compatible" in
  16. "snps,axs103""snps,arc-sdp")
  17. board="arc-sdp";
  18. ;;
  19. "snps,nsim_hs")
  20. board="arc-nsim";
  21. ;;
  22. esac
  23. if [ "$board" != "" ]; then
  24. ARC_BOARD_NAME="$board"
  25. fi
  26. if [ "$model" != "" ]; then
  27. ARC_BOARD_MODEL="$model"
  28. fi
  29. echo "$ARC_BOARD_NAME" > /tmp/sysinfo/board_name
  30. echo "$ARC_BOARD_MODEL" > /tmp/sysinfo/model
  31. echo "Detected $ARC_BOARD_NAME // $ARC_BOARD_MODEL"
  32. }
  33. arc_board_name() {
  34. local name
  35. [ -f /tmp/sysinfo/board_name ] && name="$(cat /tmp/sysinfo/board_name)"
  36. [ -z "$name" ] && name="unknown"
  37. echo "$name"
  38. }