Instruction
	    how to get and write SD-card image
	          for camera flashing


0. Requirements

   UNIX or Linux environment.


1. Get an SD-card image

   The primary site for released SD-card images is
   http://sigrand.ru/dl/camera/ti/firmware/0.2/

   The directory contains image files
   sigticam-dm368-0.2.NNNN-mmc.zip and
   sigticam-dm368-0.2.NNNN-auto-mmc.zip.
,
   where 0.2.NNNN is a release number
   and -auto is version for flashing without console input.

   The size of the compressed image is about 15 Mbytes.


   After the image release has been selected,
   download the image file by a Web browser or
   by wget command:

   wget http://sigrand.ru/dl/camera/ti/firmware/0.2/sigticam-dm368-0.2.8951-mmc.zip

   Wget log example:

   wget http://sigrand.ru/dl/camera/ti/firmware/0.2/sigticam-dm368-0.2.8951-mmc.zip
   --2015-03-24 20:34:07--  http://sigrand.ru/dl/camera/ti/firmware/0.2/sdcard-0.2.6903-auto.zip
   Resolving sigrand.ru (sigrand.ru)... 93.92.220.90
   Connecting to sigrand.ru (sigrand.ru)|93.92.220.90|:80... connected.
   HTTP request sent, awaiting response... 200 OK
   Length: 15149609 (14M) [application/zip]
   Saving to: `sigticam-dm368-0.2.8951-mmc.zip'

   100%[====================================================================================================================================================>] 15,149,609  10.2M/s   in 1.4s

   2015-03-24 20:34:09 (10.2 MB/s) - `sigticam-dm368-0.2.8951-mmc.zip' saved [15149609/15149609]


2. Unpack the image

   unzip sigticam-dm368-0.2.8951-mmc.zip

3. Select a device to write the image to

   Command

   ls -l /dev/sd*

   will show the list of block devices of your system,

   Example:

   brw-rw---T 1 root disk 8,  0 Sep 13 14:54 /dev/sda
   brw-rw---T 1 root disk 8,  1 Sep 13 14:54 /dev/sda1
   brw-rw---T 1 root disk 8,  2 Sep 13 14:54 /dev/sda2
   brw-rw---T 1 root disk 8,  3 Sep 13 14:54 /dev/sda3

   Note: your list can be longer.


   Insert the SD-card in an USB card reader
   and insert the card reader in an USB port.

   Again,

   ls -l /dev/sd*

   brw-rw---T 1 root disk   8,  0 Sep 13 14:54 /dev/sda
   brw-rw---T 1 root disk   8,  1 Sep 13 14:54 /dev/sda1
   brw-rw---T 1 root disk   8,  2 Sep 13 14:54 /dev/sda2
   brw-rw---T 1 root disk   8,  3 Sep 13 14:54 /dev/sda3
   brw-rw---T 1 root floppy 8, 64 Sep 13 15:28 /dev/sdb
   brw-rw---T 1 root floppy 8, 65 Sep 13 15:28 /dev/sdb1


   Note the difference: /dev/sdb, /dev/sdb1 are added.
   The user's group "floppy" can be an indicator of a
   removable device.
   So, /dev/sdb is the device of the inserted SD-card
   in this example.

   If your card reader has multiple slots,
   multiple devices will be added:

   brw-rw---T 1 root disk   8,  0 Sep 13 14:54 /dev/sda
   brw-rw---T 1 root disk   8,  1 Sep 13 14:54 /dev/sda1
   brw-rw---T 1 root disk   8,  2 Sep 13 14:54 /dev/sda2
   brw-rw---T 1 root disk   8,  3 Sep 13 14:54 /dev/sda3
   brw-rw---T 1 root floppy 8, 64 Sep 13 15:50 /dev/sdb
   brw-rw---T 1 root floppy 8, 80 Sep 13 15:50 /dev/sdc
   brw-rw---T 1 root floppy 8, 81 Sep 13 15:50 /dev/sdc1
   brw-rw---T 1 root floppy 8, 96 Sep 13 15:50 /dev/sdd

   You should determine which one is the SD-card.

   BE CAREFUL: WRONG SELECTION OF DEVICE NAME CAN
   COMPLETELY DAMAGE YOUR SYSTEM OR DATA!


4. Unmount

   Some of systems (like Ubuntu) can automatically mount
   inserted media.
   You must find the mount point and unmount it.

   Example:

   mount

   [...]
   /dev/sdb1 on /media/sd type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,shortname=mixed,errors=remount-ro)

   You must unmount it.

   Example:

   sudo umount /dev/sdb1
   [sudo] password for < user >: < enter your user password here >


5. Write the image

   sudo dd if=sigticam-dm368-0.2.8951-mmc.bin of=/dev/sdb bs=1M

   Log example:

   [sudo] password for < user >: < enter your user password >
   64+0 records in
   64+0 records out
   67108864 bytes (67 MB) copied, 6.5917 s, 10.2 MB/s

   Note however that the write may be failed without notice.
   It would be better to use ddv script, see next item.

6. Multiple cards

   If you are writing multiple SD-cards,
   there can be undetectable failures
   with bad cards.

   To avoid this, use the "ddv" script
   which writes cards with verification.

   6.1. Get the "ddv" script

        wget http://sigrand.ru/dl/camera/ti/misc/ddv

   6.2. Give execution rights

	chmod +x ddv

   6.3. Write the image

	sudo ./ddv sigticam-dm368-0.2.8951-mmc.bin /dev/sdb

	Log example:

	[sudo] password for < user >: < enter your user password >
	Writing   ... OK
	Unplug card reader ... unplugged
	Plug card reader in again ... plugged
	Reading   ... OK
	Comparing ... OK
	All OK