[HOWTO] Canon G7 CHDK 8Gb SDHC Autoboot

Ok, looks like the title is all tags but I assure you, it is not.

Here is how to get your Canon G7 to autoboot CHDK with a 8Gb SDHC card:

Things not covered in this HOWTO:  CHDK.  Linux.  If you need help with either of those, or don’t know what they are, then this HOWTO is not for you as you may damage your computer, camera, your pride, or all of the above.

Items Needed:

  1. Canon G7 (Other Canon point and shoots cameras should work fine)
  2. 8Gb SDHC Card
  3. Ubuntu live CD (If you use windows)
  4. SD Card Reader
  5. About 30 minutes

First things first.  Go to Ubuntu’s Website and download the latest desktop version.  Once you’ve got the ISO, burn it to a blank CD disc.  When the burn is complete, reboot your computer and boot off of the CD.  This will put you in a linux environment which is needed to do this procedure simply.

Ok, you’re in linux now.  Insert your SDHC card into your card reader.  If the card was already formatted, then you should get a new icon on your desktop for the SD Card.  Right click on that icon and select “Unmount”.

Open up a terminal window (Applications > Accessories > Terminal).

ubuntu@ubuntu:~$  sudo bash
root@ubuntu:~# fdisk -l

What you’re looking for is something like the following:

Disk /dev/sde: 7969 MB, 7969177600 bytes
221 heads, 20 sectors/track, 3521 cylinders
Units = cylinders of 4420 * 512 = 2263040 bytes
Disk identifier: 0x00000000

Make sure that you see the one that is close to 8000 MB.  This is important because if you choose the wrong one, you may erase your normal windows hard disk.

See the part that says “/dev/sde”?  That device is your SD card.  Write it down, or remember it.  On your system it may be “/dev/sdb” or “/dev/sdc” or something similar.  It all depends on how many hard drives you have in your computer.

Ok, now we start playing (read, getting dangerous):

root@ubuntu:~#  dd if=/dev/zero bs=4k of=/dev/sde

What this command is doing is writing 0s to the SD card and erasing all of it’s contents.

Once that is complete, eject the card with the following command:

root@ubuntu:~#  eject /dev/sde

Take the card out of the reader and put it into your camera.

Turn the camera on and format the SD card using the camera’s menu.

Put the card back in your SD card reader.  Unmount the card since Ubuntu will re-mount it.

Back to the terminal window  Type the commands, even the single letter commands, in the order you see below (explanations are in parenthesis):

root@ubuntu:~#  fdisk /dev/sde
d  (delete)
1  (delete partition #1)
n  (create new partition)
p  (primary partition)
1  (partition #1)
+1M  (make this partition 1 Mb)
t  (change partition type)
1  (partition #1)
4  (partition type 4 [FAT16])
n  (new partition)
p  (primary partition)
2  (partition #2)
ENTER (just hit enter to accept the default)
ENTER (just hit enter again to accept the default)
t  (change partition type)
2  (partition #2)
b  (partition type b [FAT32])

Ok.  Now press “p” and you should see something like this:

Command (m for help): p

Disk /dev/sde: 7969 MB, 7969177600 bytes
221 heads, 20 sectors/track, 3521 cylinders
Units = cylinders of 4420 * 512 = 2263040 bytes
Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1           1        2200    4  FAT16 <32M
/dev/sde2               2        3521     7779200    b  W95 FAT32

Command (m for help):

You should have 2 partitions on the SD card, one with a type of FAT16 and the other with a type of FAT32

Now, press “w” to write the new partition table to the SD card.  If you don’t press “w” here, your changes will not be saved and you will have to start over.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

Ok.  You should be sitting back at a root prompt.  We’re almost complete!

Now we need to create the file systems (or “format the disk” in windows speak):

root@ubuntu:~# mkdosfs -n CANON_DC /dev/sde1
mkdosfs 3.0.3 (18 May 2009)
root@ubuntu:~# mkdosfs -F 32 -n CANON_DC /dev/sde2
mkdosfs 3.0.3 (18 May 2009)

Ok.  You now have a SD card set up with 2 partitions, formatted correctly for our use.  But wait!  We’re not quite done yet.  We need to make the small FAT16 partition bootable or the camera will not automatically load CHDK (which is the point of all this work).

root@ubuntu:~# printf “BOOTDISK\000″ > bootdisk
root@ubuntu:~# dd if=bootdisk bs=1 count=9 seek=64 of=/dev/sde1
9+0 records in
9+0 records out
9 bytes (9 B) copied, 3.3766e-05 s, 267 kB/s

Ok.  That’s basically all there is to it.  Make sure you have the latest version of CHDK and copy the files to the following locations:

The DISKBOOT.BIN, PS.FIR, and vers.req files need to go on the small 1Mb partition.  You can copy these using the GUI if you eject the SD card and then put it back in.  Copy the CHDK folder to the 7Gb partition.

To make the card auto-boot, eject the SD card from your computer and slide the lock on the card into the LOCKED position.  Yes, it sounds backwards, but the card needs to be locked in order for it to automatically boot.

What CHDK does is, if the card is locked, is load itself into memory, and then it tells the camera the the 7Gb partition is the only one on the card since the default camera firmware cannnot see 2 partitions.  CHDK fools it into thinking there is only one partition.  Rest assured, you will still be able to take pictures and use the big partition just like before.

Only one more minor note.  Windows cannot see 2 partitions on a SD card either.  So what you need to do in order to get your pictures off the camera is plug it into your computer with a USB cable instead of popping the card out and into a card reader.

That is all.  Hope everything worked out for you.  Any questions or corrections, please leave them in the comments section below.

initrd