boot.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/sh
  2. # file: scripts/boot.sh
  3. # use program int6kboot to initialize an INT6400 device having blank
  4. # or corrupt NVRAM; the Bootloader must be running for this script to
  5. # work properly;
  6. # ====================================================================
  7. # host symbols;
  8. # --------------------------------------------------------------------
  9. . ${SCRIPTS}/hardware.sh
  10. . ${SCRIPTS}/firmware.sh
  11. # ====================================================================
  12. # confirm connection;
  13. # --------------------------------------------------------------------
  14. echo -n "Interface [${ETH}]: "; read
  15. if [ ! -z ${REPLY} ]; then
  16. ETH=${REPLY}
  17. fi
  18. # ====================================================================
  19. # check connection;
  20. # --------------------------------------------------------------------
  21. int6kwait -xqsi ${ETH}
  22. if [ ${?} != 0 ]; then
  23. echo "Device is not connected"
  24. exit 1
  25. fi
  26. # ====================================================================
  27. # randomize identity;
  28. # --------------------------------------------------------------------
  29. MAC=auto
  30. DAK=$(rkey secret.key -D)
  31. NMK=$(rkey secret.key -M)
  32. # ====================================================================
  33. # confirm address;
  34. # --------------------------------------------------------------------
  35. echo -n "MAC [${MAC}]: "; read
  36. if [ ! -z ${REPLY} ]; then
  37. MAC="${REPLY}"
  38. fi
  39. echo -n "DAK [${DAK}]: "; read
  40. if [ ! -z ${REPLY} ]; then
  41. DAK="${REPLY}"
  42. fi
  43. echo -n "NMK [${NMK}]: "; read
  44. if [ ! -z ${REPLY} ]; then
  45. NMK="${REPLY}"
  46. fi
  47. # ====================================================================
  48. # modify PIB;
  49. # --------------------------------------------------------------------
  50. modpib -M ${MAC} -D ${DAK} -N ${NMK} ${PIB}
  51. if [ ${?} != 0 ]; then
  52. exit 1
  53. fi
  54. # ====================================================================
  55. # flash NVRAM with firmware and factory PIB;
  56. # --------------------------------------------------------------------
  57. int6kboot -i ${ETH} -P ${PIB} -N ${NVM} -FF
  58. if [ ${?} != 0 ]; then
  59. exit 1
  60. fi
  61. # ====================================================================
  62. # confirm identity;
  63. # --------------------------------------------------------------------
  64. int6k -i ${ETH} -I
  65. # ====================================================================
  66. # return success;
  67. # --------------------------------------------------------------------
  68. exit 0