flash.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/sh
  2. # file: scripts/flash.sh
  3. # ====================================================================
  4. # symbols;
  5. # --------------------------------------------------------------------
  6. . ${SCRIPTS}/hardware.sh
  7. . ${SCRIPTS}/firmware.sh
  8. # ====================================================================
  9. # confirm connection;
  10. # --------------------------------------------------------------------
  11. echo -n "Interface [${ETH}]: "; read
  12. if [ ! -z ${REPLY} ]; then
  13. ETH=${REPLY}
  14. fi
  15. # ====================================================================
  16. # check connection;
  17. # --------------------------------------------------------------------
  18. int6kwait -xqsi ${ETH}
  19. if [ ${?} != 0 ]; then
  20. echo "Device is not connected"
  21. exit 1
  22. fi
  23. # ====================================================================
  24. # randomize identity;
  25. # --------------------------------------------------------------------
  26. MAC=auto
  27. DAK=$(rkey secret.key -D)
  28. NMK=$(rkey secret.key -M)
  29. # ====================================================================
  30. # confirm address;
  31. # --------------------------------------------------------------------
  32. echo -n "MAC [${MAC}]: "; read
  33. if [ ! -z ${REPLY} ]; then
  34. MAC="${REPLY}"
  35. fi
  36. echo -n "DAK [${DAK}]: "; read
  37. if [ ! -z ${REPLY} ]; then
  38. DAK="${REPLY}"
  39. fi
  40. echo -n "NMK [${NMK}]: "; read
  41. if [ ! -z ${REPLY} ]; then
  42. NMK="${REPLY}"
  43. fi
  44. # ====================================================================
  45. # edit PIB file;
  46. # --------------------------------------------------------------------
  47. modpib -M ${MAC} -D ${DAK} -N ${NMK} ${PIB}
  48. if [ ${?} != 0 ]; then
  49. exit 1
  50. fi
  51. # ====================================================================
  52. # write SDRAM with firmware and PIB;
  53. # --------------------------------------------------------------------
  54. int6kf -i ${ETH} -C ${CFG} -P ${PIB} -N ${NVM} -FF
  55. if [ ${?} != 0 ]; then
  56. exit 1
  57. fi
  58. # ====================================================================
  59. # confirm identity;
  60. # --------------------------------------------------------------------
  61. int6k -i ${ETH} -I
  62. # ====================================================================
  63. # return success;
  64. # --------------------------------------------------------------------
  65. exit 0