1. #!/bin/sh
  2. #
  3. # This is a recovery procedure
  4. #
  5. # (C) 2005 Samsung Electronics
  6. #
  7. # $Log: rc-recovery,v $
  8. # Revision 1.2 2006/01/15 09:41:07 hcyun
  9. # handle install fail case
  10. #
  11. # Revision 1.1 2005/12/22 05:50:18 hcyun
  12. # Moved from images directory.
  13. #
  14. #
  15.  
  16. err()
  17. {
  18. echo $*
  19. exit 1
  20. }
  21.  
  22. format_ufda()
  23. {
  24. echo "Now format the /dev/ufda"
  25. ffdisk /dev/ufda -a
  26.  
  27. fformat -f12 -c 16 /dev/ufda1 || \
  28. fformat -f12 -c 32 /dev/ufda1 || \
  29. fformat -f16 -c 8 /dev/ufda1 || err "Can't format /dev/ufda1"
  30.  
  31. }
  32.  
  33. format_ufdb()
  34. {
  35. echo "Now format the /dev/ufdb"
  36. ffdisk /dev/ufdb -a
  37. fformat -f32 -c 32 /dev/ufdb1 || fformat -f16 -c 32 /dev/ufdb1
  38. }
  39.  
  40.  
  41. format_ufdrawc()
  42. {
  43. echo "Now format the /dev/ufdrawc"
  44. ferasepart /dev/ufdrawc
  45. }
  46.  
  47. # procedure start downloading
  48. download_fw()
  49. {
  50. echo "Download a initial firmware"
  51.  
  52. echo ">> Now ready to connect UMS"
  53. echo "usbcontrol 1" > /proc/gadget_udc
  54. insmod g_file_storage file=/dev/ufdb
  55.  
  56. echo ">> download firmware to the UMS"
  57. echo "after downlod is finished.. !!reboot the target!!"
  58. echo "it will install new firmware automatically"
  59.  
  60. echo
  61. echo ">> Start recovery"
  62. /z-proj/bin/recovery /share/recovery.fb
  63.  
  64. echo ">> Unloading UMS driver"
  65. rmmod g_file_storage
  66. sync
  67.  
  68. echo ">> Reset the system"
  69. /sbin/reboot
  70. echo "main 0" > /proc/powerctl
  71. }
  72.  
  73.  
  74. export PATH=$PATH:/z-proj/bin
  75.  
  76. cat /etc/motd
  77.  
  78. echo "Recovery mode operation"
  79.  
  80. mount -t proc none /proc
  81. mount -t tmpfs none /mnt/tmp
  82.  
  83. format_ufda
  84. format_ufdb
  85. format_ufdrawc
  86. download_fw
  87.  
  88. /bin/sh