ich9macchange 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. # ich9macchange script: uses ich9gen to change the MAC address on GM45/GS45 machines.
  3. #
  4. # Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. set -u -e -v
  20. arch="unknown"
  21. if [ $(uname -i) = "i686" ] || [ $(uname -m) = "i686" ]; then
  22. arch="i686"
  23. elif [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ]; then
  24. arch="x86_64"
  25. elif [ $(uname -i) = "armv7l" ] || [ $(uname -m) = "armv7l" ]; then
  26. arch="armv7l"
  27. else
  28. echo "This script must be run on an i686, x86_64 or armv7l host."
  29. exit 1
  30. fi
  31. if (( $# != 1 )); then
  32. echo "Usage: ./ich9macchange XX:XX:XX:XX:XX:XX"
  33. echo "(XX replaced with hex from your desired MAC address)"
  34. exit 1
  35. fi
  36. path="unknown"
  37. if [ -f "DEBLOB" ]; then
  38. path="./resources/utilities/ich9deblob/ich9gen"
  39. else
  40. path="./ich9deblob/$arch/ich9gen"
  41. fi
  42. $(echo $path) --macaddress $1
  43. for size in "8m" "4m"
  44. do
  45. cd bin/x200_"$size"b/
  46. for rom in $(ls)
  47. do
  48. dd if=../../ich9fdgbe_"$size".bin of="$rom" bs=1 count=12k conv=notrunc
  49. done
  50. cd ../../
  51. done
  52. rm -f ich9fdgbe_4m.bin
  53. rm -f ich9fdgbe_8m.bin
  54. rm -f mkgbe.c
  55. rm -f mkgbe.h