MakeSD 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/sh
  2. # copy specic sets of file to SD Card
  3. COPY="$(dirname "$0")/CopyToSD"
  4. FlashPrefix=samo-lib/flash
  5. ForthPrefix=samo-lib/forth
  6. programs="${ForthPrefix}/programs"
  7. sdcard=''
  8. for item in /media/SAMO* /media/disk
  9. do
  10. if [ -d "${item}" ]
  11. then
  12. sdcard="${item}"
  13. break
  14. fi
  15. done
  16. while :
  17. do
  18. case "$1" in
  19. "")
  20. break
  21. ;;
  22. all|--all)
  23. ${COPY} --sdcard="${sdcard}" kernel.elf "${ForthPrefix}/"*.elf "${programs}/"*.4mu "${programs}/"*.4th "${programs}/"*.ini "${programs}/"*.tst
  24. ;;
  25. forth|--forth)
  26. ${COPY} --sdcard="${sdcard}" "${ForthPrefix}/"*.elf "${programs}/"*.4mu "${programs}/"*.4th "${programs}/"*.ini "${programs}/"*.tst
  27. ;;
  28. 2|--2|stage2|--stage2)
  29. ${COPY} --sdcard="${sdcard}" "${ForthPrefix}/forth.elf" "${ForthPrefix}/forth.elf:kernel.elf" "${programs}/"*test.4th "${programs}/"stage2.4th:forth.ini
  30. ;;
  31. mtbf|--mtbf)
  32. ${COPY} --sdcard="${sdcard}" "${ForthPrefix}/forth.elf" "${ForthPrefix}/forth.elf:kernel.elf" "${programs}/"mtbf.4th "${programs}/"mtbf.4mu:forth.ini
  33. ;;
  34. image\=*|--image\=*)
  35. image=${1#*=}
  36. ${COPY} --sdcard="${sdcard}" "${image}/"*
  37. ;;
  38. flash\=*|--flash\=*)
  39. image=${1#*=}
  40. ${COPY} --sdcard="${sdcard}" "${FlashPrefix}/flash.elf" "${image}":flash.rom
  41. ;;
  42. *)
  43. echo usage: $(basename "$0") '<option>'
  44. echo
  45. echo The following options are available:
  46. echo
  47. echo ' all - copy kernel.elf and all the forth programs'
  48. echo ' forth - copy all of forth (leaving existing kernel)'
  49. echo ' 2 - make a stage 2 production test card'
  50. echo ' mtbf - make an mtbf test card'
  51. echo
  52. echo 'If the card is not mounted, the script will use sudo'
  53. echo 'to mount/umount the card.'
  54. echo
  55. echo 'Note: to format SD Card use a command like:'
  56. echo ' sudo mkfs.vfat -n SAMO-8G /dev/sdb1'
  57. echo ' sudo mkfs.vfat -n SAMO-4G /dev/sdb1'
  58. echo ' sudo mkfs.vfat -n SAMO-512M /dev/sdb1'
  59. echo
  60. echo '(Change /dev/sdb1 to your drive and partition)'
  61. exit 1
  62. ;;
  63. esac
  64. shift
  65. done