Sunday, September 25, 2016

Install CHDK 1.4.1 on Canon SX20 with Arch Linux

Thought I'd write this up also since I had to do it again today.

The CHDK instructions are very complete in some places, vague in others. The suggested tools to use to help install are very dated and don't necessarily work, so these are my notes to get CHDK onto a bootable SD card. I wanted to upgrade by CHDK installation to 1.4.x so I can run the Ultimate Intervalometer, which allows the camera to take time lapse photos. Yes, there are others that work with the current 1.1 version of CHDK that I had, but not as nice as this one.

My camera, the Canon SX20, does not support the manual loading of CHDK through the firmware update process since that is not an option in the Canon menus. The only option for this camera is to make a bootable SD card by hand. I have a 16GB card.

Firmware version is 1.02D, full CHDK package is at

http://mighty-hoernsche.de/bins/sx20-102d-1.4.1-4691-full.zip

Small CHDK package is at

http://mighty-hoernsche.de/bins/sx20-102d-1.4.1-4691.zip


Here are the steps:

Back up all photos and scripts (if any) from the card.

Pull the card from the camera and make sure the lock is off.

Insert the card into the card reader on my laptop.

Make 2 partitions, one FAT16 to boot, one FAT32 for photo storage.

sudo fdisk /dev/mmcblk0

d to create a dos partition table

n to create a new partition
p to create a primary partition
1 to make this partition number 1 (1 should be default choice)
use default for first sector
+10M to make the partition 10MB in size

repeat to make a second partition:
n to create a new partition
p to create a primary partition
2 to make this partition number 2 (2 should be default choice)
use default for first sector
use default for last sector, this uses all remaining space

t to set partition type on partition 1
1 for partition 1
6 for FAT16 (use L to see all partition types)

t to set partition type on partition 2
2 for partition 2
b for FAT32

a to set bootable flag on partition 1
1 for partition 1

p to view partition table, should look like this:

Disk /dev/mmcblk0: 15.4 GiB, 16574840832 bytes, 32372736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x652563a2

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *     2048    22527    20480   10M  6 FAT16
/dev/mmcblk0p2      22528 32372735 32350208 15.4G  b W95 FAT32


w to write the changes and exit fdisk.

Format the partitions:

sudo mkdosfs /dev/mmcblk0p1
sudo mkdosfs -F 32 /dev/mmcblk0p2

Make the first partition bootable (setting the flag in fdisk isn't sufficient):

echo -n BOOTDISK | sudo dd bs=1 count=8 seek=64 of=/dev/mmcblk0p1

Copy the CHDK files and the Ultimate Intervalometer script to both partitions. I'm sure it's not necessary to have the script in both places, but I'm not sure which one the camera loads, plus the file is small, only about 40kb, so no big deal to have it in both places:

sudo mount -t vfat /dev/mmcblk0p1 /mnt/sd
sudo cp -r /home/danson/docs/camera/CHDK_1.4.1/* /mnt/sd
sudo cp /home/danson/downloads/ultimate.lua /mnt/sd/CHDK/SCRIPTS/
sudo umount /mnt/sd
sudo mount -t vfat /dev/mmcblk0p2 /mnt/sd
sudo cp -r /home/danson/docs/camera/CHDK_1.4.1/* /mnt/sd
sudo cp /home/danson/downloads/ultimate.lua /mnt/sd/CHDK/SCRIPTS/
sudo umount /mnt/sd

After a little more research, it appears I could have used the small CHDK package in the FAT16 partition and the complete one in the FAT32 partition, but again, they aren't that big and the FAT16 partition has enough space, so I installed the complete package in both.

Remove the SD card from the laptop, turn the lock on the card to locked. CHDK will handle the locking for the camera.

Insert the card into the camera, turn it on, and see the CHDK. Works like a charm.

No comments: