01_sysinfo 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. do_sysinfo_octeon() {
  2. local machine
  3. local name
  4. machine=$(grep "^system type" /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g")
  5. of_machine=$(head -n1 /sys/firmware/devicetree/base/compatible)
  6. # Sadly for whatever reason the N821 (Cisco Viptela vEdge 1000) uses the
  7. # same supposedly unique board ID as the EdgeRouter. This is bad, so
  8. # we override what cpuinfo gives us using the device tree as a hint.
  9. case "$of_machine" in
  10. "cisco,vedge1000"*)
  11. return 0
  12. esac
  13. case "$machine" in
  14. "UBNT_E100"*)
  15. name="erlite"
  16. ;;
  17. "UBNT_E200"*)
  18. name="er"
  19. ;;
  20. "UBNT_E220"*)
  21. name="erpro"
  22. ;;
  23. "UBNT_E300"*|\
  24. "UBNT_USG"*)
  25. # let generic 02_sysinfo handle it since device has its own device tree
  26. return 0
  27. ;;
  28. "ITUS_SHIELD"*)
  29. name="itus,shield-router"
  30. ;;
  31. *)
  32. name="generic"
  33. ;;
  34. esac
  35. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  36. echo "$name" > /tmp/sysinfo/board_name
  37. echo "$machine" > /tmp/sysinfo/model
  38. }
  39. boot_hook_add preinit_main do_sysinfo_octeon