make_backup.sh 475 B

12345678910111213141516171819
  1. #!/bin/bash
  2. device=arduino #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. echo "n'oubliez pas de renomer le fichier !!!!"
  17. echo "d'ont forget to rename your file !!!!"