Tuesday, February 24, 2009

Guide to install the CHDK

The CHDK is a program that runs over the factory firmware of several models of canon cameras. Due to its nature, the CHDK is not destructive and in case you don't want it anymore in the camera it was installed in, it can easily be removed.

The following are materials needed to install the CHDK:

Φ SD card
Φ Powershot Canon Compatible Camera. (aqui)
Φ SD card reader
Φ Program CARDTRIKS for Windows users
Φ Hexadecimal editor of your choice

The first thing you have to do is check what FIRMWARE version is included in your camera. For this, we create a Dummy file called vers.req which doesn't need any special contents (It can be a 0 Kb file) It is really important for this step, and for all of them, to have a card reader that recognizes our card as an external disc (or as a standard USB flashcard). If you use the USB cable of the camera, you won't have access to the highest level directory of the card, just to the picture folder.

The file vers.req is copied to the card and after that we need to insert the card in the camera. Turn on the camera in the display mode and press SET for one second. After this, press the DISP button without releasing the SET button, this will cause our FIRMWARE version to appear on the display. In our case, our camera has the GM1.00A.

Once you know the firmware version, download CHDK for the right camera. (http://mighty-hoernsche.de/)

Before installing CHDK on the SD card, we need to set it as we previously described. Windows users will use the program we already mentioned. Mac and Linux users (among other OS based on UNIX) can use the command line to do it. In this case, we formatted the card as FAT16 (just for cards with storage of less than 4gb).

After the command line in the terminal (for Mac users) you use the command dd if=/dev/diskXsX of=BootSector.bin bs=512 count=1 where diskXsX is changed for the card id (something like disk1s1) and this gets copied to your computer in the running sector of the card. The instruction in ubuntu would be dd if=/dev/sdx1 of=BootSector_G9.bin bs=512 count=1 where sdx1 is the card id. This will create the file Bootsector.bin in the "home" file of the user you are currently being at the time.




After this step, you open the file that was copied to the hard disk with an hexadecimal editor and in the 40hexadecimal sector (64 in decimal system) you add the word BOOTDISK, save the file and then do the inverse procedure: You should copy the file to the memory, (in the running sector) in Windows you can use a program for this, in Mac you use a command line in terminal similar to the one used before: dd if=BootSector.bin of=/dev/diskXsX bs=512 count=1 where diskXsX gets replaced by the identifier of the disk, like disk1s1 is. The command line in ubuntu is dd if=BS.bootable of=/dev/sdx1 bs=512, where sdx1 is the card id.
IMPORTANT: in case some of the instructions show you an error message like “dd: /dev/disk1s1: Resource busy” it means that the card is being used by the operating system, so you need to "unmount it," in UBUNTU you can do this from the command line, in MAC you need to go to DiskUtility and select UNMOUNT, it is important to notice that this is not the same thing as ejecting the disc, if you eject the card this will lose the conection to the computer, in this case all we are doing is unplugging the controller that allows the OS to perform actions on the card (like copying files or explore its contents) but the card keeps having a conection to our computer.


Once our card is ready you can install CHDK, the first thing you need to do is decompress the file that was downloaded and place it on the card, all the program goes inside of a folder known as CHDK on the card's root. Once done, you insert the card to the camera but watch out! The LOCK switch on it (Image to the left) must be activated. This switch shows that you can't write files on the card and it is necessary because, in theory, you cannot write on the disk you are using to run the software, but the CHDK overwrites with software this function so the card can also be used to take pictures.

Finally, we just need to turn on the camera and enjoy the CHDK functions.

If you want to use an extra program, go to:
http://chdk.wikia.com/wiki/UBASIC/Scripts
In this webpage they offer a series of extra functions programmed for the CHDK. A really interesting script is the one that senses movement, the demonstration of this program will be done in class.
http://chdk.wikia.com/wiki/UBASIC/Scripts:_Multipurpose_Motion_Detection
To use this scripts, you just need to copy them to the card and load them from the CHDK menu.

No comments:

Post a Comment