make_backup.sh 545 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. device=ch341a #arduino or raspberry
  3. port=ttyACM0
  4. baud=115200
  5. rpi_speed=20000 # between 512 to 30000, 20000 seems to be the best
  6. if [ $device = "arduino" ]
  7. then
  8. flashrom -p serprog:dev=/dev/$port:$baud -r backup.hex
  9. fi
  10. if [ $device = "raspberry" ]
  11. then
  12. modprobe spi_bcm2835
  13. modprobe spidev
  14. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=$rpi_speed -r backup.hex
  15. fi
  16. if [ $device = "ch341a" ]
  17. then
  18. flashrom -p ch341a_spi -r backup.hex
  19. fi
  20. echo "n'oubliez pas de renomer le fichier !!!!"
  21. echo "d'ont forget to rename your file !!!!"