01_sysinfo 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. "UBNT_E300"*|\
  16. "UBNT_USG"*)
  17. # let generic 02_sysinfo handle it since device has its own device tree
  18. return 0
  19. ;;
  20. "UBNT_E200"*)
  21. name="er"
  22. ;;
  23. "UBNT_E220"*)
  24. name="erpro"
  25. ;;
  26. "ITUS_SHIELD"*)
  27. name="itus,shield-router"
  28. ;;
  29. *)
  30. name="generic"
  31. ;;
  32. esac
  33. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  34. echo "$name" > /tmp/sysinfo/board_name
  35. echo "$machine" > /tmp/sysinfo/model
  36. }
  37. boot_hook_add preinit_main do_sysinfo_octeon