CHDK Wiki
Register
Advertisement
Notice

This wiki page describes many ways to install CHDK on your camera's SD memory card. However a simple Java based program for Windows, Linux or Apple computers that does everything for you is available at this web site : STICK : Simple Tool for Installing CHDK

Overview

CHDK loads from a camera's SD card into the camera's RAM memory. It extends the functionality of the camera without changing (flashing) the camera's firmware. Two methods are available to load CHDK into camera memory: the Firmware Update Method and the Bootable SD Card Method. Read the descriptions below to understand the strengths and weaknesses of each method and the step required to configure your SD card for each method.

SDcardunlocked

Prior to starting to use CHDK, you will need to:

  • Determine what year your camera was released using the Camera Platform ID Table wiki page;
  • Determine the firmware version of your camera using firmware version information from the CHDK FAQ;
  • Download the complete release of the correct version of CHDK for your camera's firmware from Firmware Download Page;
  • Decide what CHDK loading method you want to use;
  • Configure your SD memory card using the most appropriate method listed below;
  • Load the CHDK distribution to your SD card.

Firmware Update Method*

Overview

The Firmware Update Method allows you to load CHDK from any SD card formatted to work in your camera. It uses the camera's built-in "Firmware Update..." menu item to load CHDK from a file called either "PS.FIR" or "PS.FI2" (depending on the camera model). It is the easiest way to load CHDK but must be done each time the camera is powered on, because CHDK does not make any permanent changes to the camera when it runs.

  • Note that this method does not actually update the camera's firmware. It tricks the camera into thinking it is doing a firmware update but actually causes CHDK to be loaded into RAM. No firmware "flashing" takes place.

Firmware Update Method Card Preparation

Steps to use the firmware update method are :

  1. Start with an SD card formatted by your camera. This should happen automatically when you put a new card in the camera. If the camera does not want to format your card, it is probably already formatted.
  2. Remove the card from your camera. Use your PC and SD card reader to unzip the appropriate CHDK distribution file for your camera model and firmware version into the main root directory of your SD card. Make sure that the CHDK folders are also copied to the SD card. Note that for this method to work, there must now be a file called either ps.fi2 or ps.fir in the root directory of the card. Beta release versions of CHDK downloaded from the CHDK forum might not contain this file. If so, then you cannot use the firmware update method for those cameras until the software is released in the CHDK Autobuild Server Also, Mac users should read the hints in FAQ Mac as as you may have issues with permissions when using Apple Archive utiliy.
  3. Put the SD card back into in your camera.
  4. Start your camera directly into Play Mode by pressing the Play button or Play switch. Do not start the camera with the On/Off button - the firmware update method will not work if you do.
  5. Press the Canon Menu key and scroll around until you find a menu item that says "Firm Update...". There are usually three or four tabs in the Menu (varies by camera). You can probably stay on the first tab (typically Playback Settings) but some experimentation might be necessary.
  6. Select "Firm Update..." and press FUNC.SET button.
    SplashScreen
  7. It should say "Update firmware version?" Press OK. If everything went correctly, the CHDK splash screen will appear briefly on the Camera's screen.
  8. Go back to the camera mode and you should see some new OSD (on screen display) elements.
  9. Activate the CHDK menus with the <ALT> key or key sequence defined for your camera.

Bootable SD Card Method

Overview

SDcardlocked

CHDK can be configured so that it automatically loads each time your camera starts. This is done via the "Bootable SD Card" method of loading and requires that the SD card be setup specially for this purpose. To use this method, format and load the card using the instructions below, and then set the card's lock switch (the little slider mechanism on the side of the SD card) to the "LOCK" position. Insert the card into your camera and turn it on normally - you should briefly see the CHDK logo, indicating that CHDK has successfully loaded.

Note that your SD card needs to be "bootable" to use the SD Card Lock method. This means that for cameras released prior to January 2011 there needs to be a FAT16 partition with a slightly modified boot block. Cameras released after January 2011 can boot from either a FAT16 or a FAT32 partition, although each format requires a different modifications to the boot block.

Setup of the SD card is somewhat complicated as different cameras have different requirements and limitations. Listed below are various methods of configuring an SD card for the "SD Card Lock" method.

Note : setting up an SD card to be bootable is not the same thing as setting the "boot" flag in the card's MBR. That flag is ignored by Canon cameras.

Bootable SD Card Method Preparation

Bootable SD Card Format Options

There are several possible configurations that can be used to enable the Bootable SD Card method of loading CHDK. The best method to use depends on when your camera was released, the size of your SD card and your tolerance for needing to take extra steps with some configurations. Details of what to do in each situation are given below.


For Cameras Released After 2010 :

With recent cameras a single FAT32 partition configured to be bootable is the preferred SD card configuration for automatically loading CHDK.

Notice

Some recent cameras format SD cards as exFAT. This format cannot be used for autobooting - you must reformat these cards as FAT32 on your PC. Note also that newer cameras do not support dual partition CHDK booting.


You can also use a single FAT16 partition if your card is 4G or smaller (or if you are willing to just use 4G of a larger card). You might choose to use a FAT16 partition because you wish to use one of the automated configuration tool (see below) and that tool does not support FAT32 booting.

There are quite a few method of setting up an SD Card for cameras released after 2010. Listed below are three easy ones - alternative methods can be found at the bottom of this wiki page. Note : use the second method if you are using a CHDK version that has no ps.fi2 file available in the distribution zip file ( eg : a camera still under development or a camera like the S100 where its just not available).

Method 1 - Using the STICK utility

  1. Download STICK and use it to automatically download the right version of CHDK for your camera, format your SD card suitably for CHDK, and install CHDK correctly.
  2. If you are attempting to use a version of CHDK not yet in the autobuild,  instructions on how to do so can be found here


Method 2 - Using CHDK itself to make the SD card bootable.

  1. Start out with your SD Card Lock switch in the unlocked position (the small slide switch on the side of the card - see picture above - make sure it is in the unlocked position to start this process.)
  2. Low level format the card in camera using the camera's built-in card format menu selection. Warning : any images on the card will be erased at this point. 
  3. Remove the card from your camera and put it into the SD card reader of your PC.
  4. The card should now contain a single FAT32 partition. If you are using a large SD card,  please make sure your camera did not format the card as exFAT - see warning note at start of this section.  You may need to use something like FAT32 Format to reformat the card in your PC if so. 
  5. Now please check again (by looking at the properties of your card in an SD card reader in your PC) to ensure that your card is formatted either FAT16 or FAT 32 - and not exFAT!
  6. Unpack the appropriate build of CHDK for your camera and firmware version directly to the card (including all subdirectories).
  7. With the Card Lock switch still in the unlocked position put the card back into your camera.
  8. Turn on your camera by pressing the Play button (or using the Play switch on some cameras). Do not start the camera with the On/Off switch or this process will not work.
  9. Start CHDK manually by selecting the Firmware Update option in the Canon menus.
  10. After the CHDK logo briefly displays, start CHDK by using the <ALT> key sequence for your camera.
  11. Enter the CHDK menu, and select Miscellaneous stuff -> Make Card Bootable
  12. Turn your camera off, write protect the SD card by moving the little switch on the side of the card to the locked position, insert the card back into your camera.  Note that CHDK will cause the camera to ignore the lock switch so that you can take pictures normally.


Method 3 - Using EOSCard to make the SD card bootable.

  1. Start out with the SD Card Lock switch in the unlocked position (there will be a small slide switch on the side of the card - see picture above - make sure it is in the unlocked position to start this process.)
  2. Low level format the card in camera. The card will now contain a single FAT32 partition. (Warning : any images on the card will be erased at this point. Also, make sure your camera did not format the card as exFAT - see warning note at start of this section - you may need to use something like FAT32 Format to format the card in your PC is so. ).
  3. Remove the card from your camera and put it into the SD card reader of your PC. Unpack the appropriate build of CHDK for your camera and firmware version directly to the card (including all subdirectories).
  4. Use EOScard to configure your SD card to be bootable in the camera. Read the instructions on this wiki page EOScard1.2 and download the software from there.
  5. Write protect your SD card by moving the little switch on the side of the card to the locked position, insert the card back into your camera.

Now each time that you turn your camera on, the CHDK logo should briefly display automatically, indicating that CHDK has successfully loaded.

Utilities for cameras released after 2010 :

MS Windows :
  • Stick : downloads, partitions and installs CHDK for any supported camera and SD card size
  • Wicks : partitions and installs CHDK for any supported camera and SD card size
  • EOScard1.2 utility will write a boot string to the correct place on a FAT32 card using Windows computers. Format your SD card as FAT32, use this utility and then unzip the correct CHDK distribution file to the SD card.
  • FAT32 Format allows you to format SD cards in FAT32 format, including cards > 32G Useful if you have a newer camera that only supports exFAT format (exFAT does not support CHDK booting).
  • GUI version of FAT32 Format (see above)
  • Apple Mac :
  • SDMInst app for the Apple Mac can be used to make a FAT32 card bootable. Instructions for the Mac are here FAQ/Mac. Please pay particular attention to this section Problems loading CHKD on SD cards with a Mac computer.
Linux :
  • LICKS the Linux Installer for CHDK and SDM can be used to create FAT32 bootable cards under Linux.

.

For Cameras Released Before 2011 :

With older cameras, the best booting method options depends on the size of the SD card. For cards 4G in size or smaller, the card needs to be formatted as FAT16 and configured to be bootable. For cards 8G or larger, you will need to create two partitions - a small 500K FAT16 partition configured to be bootable and a larger partition formatted as FAT32 to take up the rest of the space on the SD card.

Notice

Not all cameras support dual partitions. Check the wiki page and forum porting thread for your camera before trying to use dual partitions.

Configuring any SD card to load CHDK via the card lock booting method requires these three steps :

  1. Setup the SD card by creating either a single partition (FAT16) or two partitions (a small FAT16 and a larger FAT32).
  2. Modify the boot block of the first partition on the card by writing the text string "BOOTDISK" at offset 0x40.
  3. Copy the "Complete" CHDK executable distribution to the correct places on the SD card. For single partition cards, all the files and folders from the CHDK distribution file belong on that partition. For dual partition cards, all the files and folders from the CHDK distribution file belong on the large second partition except for the files DISKBOOT.BIN and either PS.FIR or PS.FI2, which belong on the smaller FAT16 bootable partition.

There are quite a few method of setting up an SD Card for cameras released before 2011. Listed below are four easy ones - alternative methods can be found at the bottom of this wiki page. Note : use the fourth method if you are using a CHDK version that has no ps.fi2 file available in the distribution zip file ( eg : a camera still under development or a camera like the S100 where its just not available).

Method 1 - Using the STICK utility

  1. Download STICK and use it to automatically download the right version of CHDK for your camera, format your SD card suitably for CHDK, and install CHDK correctly.
  2. If you are attempting to use a version of CHDK not yet in the autobuild,  instructions on how to do so can be found here

Method 2 - Using CHDK itself to make the SD card bootable (cards 4G or smaller)

  1. Start out with your SD Card Lock switch in the unlocked position (the small slide switch on the side of the card - see picture above - make sure it is in the unlocked position to start this process.)
  2. Low level format the card in camera using the camera's built-in card format menu selection. Warning : any images on the card will be erased at this point. (Note:  the card must be 4G or less and must be formatted as FAT16. You will need to verify the format in your PC as some cameras will default to a FAT32 format and pre-2011 cameras will not boot from FAT16).
  3. Remove the card from your camera and put it into the SD card reader of your PC.
  4. Now please check again (by looking at the properties of your card in an SD card reader in your PC) to ensure that your card is formatted FAT16 - not FAT32 or exFAT!
  5. Unpack the appropriate build of CHDK for your camera and firmware version directly to the card (including all subdirectories).
  6. With the Card Lock switch still in the unlocked position put the card back into your camera.
  7. Turn on your camera by pressing the Play button (or using the Play switch on some cameras). Do not start the camera with the On/Off switch or this process will not work.
  8. Start CHDK manually by selecting the Firmware Update option in the Canon menus.
  9. After the CHDK logo briefly displays, start CHDK by using the <ALT> key sequence for your camera.
  10. Enter the CHDK menu, and select Miscellaneous stuff -> Make Card Bootable
  11. Turn your camera off, write protect the SD card by moving the little switch on the side of the card to the locked position, insert the card back into your camera.  Note that CHDK will cause the camera to ignore the lock switch so that you can take pictures normally.


Method 3 - Using CHDK itself to make the SD card bootable with two partitions (cards larger than 4G)

  1. Low level format card in camera. The card now contains either at FAT16 or  FAT32 partition.
  2. Unpack the CHDK build zip file directly to the card using your PC ( make sure the folder structure in the zip file is preserved)
  3. Start CHDK manually using the Firmware Update method.
  4. Enter the CHDK menu, and select Miscellaneous stuff -> SD Card -> Create card with two partitions. CHDK now creates the boot partition as before, but also formats it using FAT16 and marks the partition bootable.
  5. Put the card back in PC. If necessary, format the newly created 2MB partition to FAT16.
  6. Re-unpack CHDK to this partition.
  7. Write protect the card (there is usually a switch on the side of the card; move it to the locked position).
  8. The camera should now boot CHDK from the card ( make sure the folder structure in the zip file is preserved)
  9. Enterthe CHDK menus, and select Miscellaneous stuff -> SD Card -> Swap partitions
  10. Shutdown the camera,  remove and unlock the card, and put it back in the PC. Now format the large partition, and unpack CHDK onto it  ( make sure the folder structure in the zip file is preserved)
  11. Lock the card and put it back in the camera.
  12. Start CHDK manually with the Firmware Update method one more time, and select Miscellaneous stuff -> SD Card -> Swap partitions.

Caveats: Windows does not seem to be able to access both partitions at once. You can use the WASP utility to manage that.  Otherwise you will have to run Swap partitions before you take the card out of the camera so Windows can access your photos, then repeat the last step after you put the card back in to make it boot CHDK automatically. To me, this is much better than having to start CHDK manually every time you turn on the camera!


Method 4 - Using EOSCard to make the SD card bootable (cards 4G or smaller)

  1. Start out with the SD Card Lock switch in the unlocked position (there will be a small slide switch on the side of the card - see picture above - make sure it is in the unlocked position to start this process.)
  2. Low level format the card in camera.  Warning : any images on the card will be erased at this point. (Note:  the card must be 4G or less and must be formatted as FAT16. You will need to verify the format in your PC as some cameras will default to a FAT32 format and pre-2011 cameras will not boot from FAT16).
  3. Remove the card from your camera and put it into the SD card reader of your PC. Unpack the appropriate build of CHDK for your camera and firmware version directly to the card (including all subdirectories).
  4. Use EOScard to configure your SD card to be bootable in the camera. Read the instructions on this wiki page EOScard1.2 and download the software from there.
  5. Write protect your SD card by moving the little switch on the side of the card to the locked position, insert the card back into your camera.

Now each time that you turn your camera on, the CHDK logo should briefly display automatically, indicating that CHDK has successfully loaded.

To simplify the steps listed above for the preparation of a CHDK SD card, several utilities are available. These utilities can partition and format bootable SD cards and download & install CHDK to those cards.

Utilities for cameras released before 2011 :

MS Windows :
  • Stick : downloads, partitions and installs CHDK for any supported camera and SD card size
  • Wicks : partitions and installs CHDK for any supported camera and SD card size
  • Wasp : allows easy swapping of primary & secondary partitions of dual partition cards
  • the standalone program sdminste.exe can be extracted from inside this package : Common Files . Instructions are available at Using SDMinste to Create Dual Partition SD cards . It can format 4G or smaller cards as bootable FAT16 and it can format cards 8G or larger for dual partition booting.
  • there is also the older Cardtricks program for use with SD cards of 4G bytes or less, as described in CHDK for Dummies.
  • EOScard1.2 utility will write a boot string to the correct place on a single partition FAT16 card. Format your SD card as FAT16, use this utility and then unzip the correct CHDK distribution file to the SD card.
Linux :
Apple Mac :

A Deep Dive into the Boot Process

During the boot process, a Canon P&S camera powers up and checks to see if the SD card lock switch is in the "Locked" position. If the card is locked, the camera next checks the volume boot sector of the first partition on the SD card for the signature string "BOOTDISK". This signature is stored starting at offset 0x40 (decimal 64) on a FAT16 volume and at offset 0x1E0 on a FAT32 volume. If the signature is found, the camera checks the root directory of the SD card for a file named "DISKBOOT.BIN". If found, this file is loaded into memory and control is passed to that code. Naturally, this file contains the CHDK program

Note : when loaded, CHDK causes the camera to ignore the lock the SD card, so that images may be stored.

For cameras released prior to 2011, booting only works on FAT16 volumes. The maximum size for FAT16 is 4GB so using an SD card larger than 4GB is more complicated. By dividing such cards into two partitions (volumes), one can have a small FAT16 partition (500K) from which to boot, and a much larger FAT32 volume using the rest of the SD card for storing images. When using this method, the FAT16 partition must be the first one in the partition table. When it loads, CHDK will logically swap the partitions after loading, so the camera only sees the larger one. Because of this, only the DISKBOOT.BIN file needs to be located in the smaller partition - all the other CHDK files need to be located on the larger partition. Failing to do this will mean the CHDK logo will not display at boot, menu icons will not appear and things like fonts and test scripts will not be available.

SD cards do not normally contain multiple partitions. Some operating systems, particularly Windows, do not have drivers which can properly handle SD cards with multiple partitions. Windows will only see the first partition on an SD card. Because of this, the partitions need to be "swapped" before using a card in Windows if one wishes to transfer images directly. The CHDK debug menu has an option which will do this. When moving the card back to the camera, you will have to manually start CHDK via the firmware update method (because the camera will only see the FAT32 partition, so it won't boot), and do a swap again. Alternatively, tools like sdminste.exe can be used to swap the partitions on the PC before returning the card to your camera.

It should also be noted that doing a card format in the camera will format the entire card into one volume, removing CHDK in the process.

If you are still curious about how CHDK autoloads, check out this thread How does CHDK start running.

Other methods for preparation a Bootable SD card

Windows

Windows Method #1: HxD GUI (for cameras released after 2010)

  1. First format your card FAT32.
  2. On a PC, use HxD http://mh-nexus.de/en/hxd/ to EDIT the boot sector of the SD card.
  3. In Extra- > Open Disk Deselect Read Only: BE CAREFUL! Select the Unit x: or what ever of your SD card - not your hard disk!!!
  4. Go to the right part at the level of 00001E0 and change the letters "any key " to "BOOTDISK"
  5. SAVE.
  6. Then all the contents of CHDK distribution zip file have to be extracted into the root of the drive (taking care to have the zip utility restore the orginal directory structure).
  7. Write-protect your SD, and the camera should autoload from it.

Thanks to asm1989 for this method from the CHDK Forum


Windows Method #2: mkbt.exe CLI (for cameras released after 2010)

If you're looking for a Command Line Interface to make your SD card bootable as part of a batch file script, Bart's MKBT does the trick nicely:

  1. Format card by any method on this page (recommend using your camera)
  2. Make card bootable by any method on this page (recommend using STICK )
  3. Copy boot sector from card:
mkbt.exe -c -x f: bootsect.bin

This will create a 512 byte file containing the raw boot sector from the card.

Now whenever you want to make your card bootable again:

  1. Format card
  2. Copy boot sector to card:
mkbt.exe -x bootsect.bin f:


Windows Method #3: HDHacker GUI (updated April 2012)

  • Download the HDHacker utility from here and the xvi32 hex editor from here to execute the following steps.
  • Format you SD card in your camera (see notes above about FAT16, FAT32 and exFAT)
  • Install and run HDHacker.
  • Select the proper drive letter corresponding to your SD card in the card reader.
  • Set drive to operate = "bootsector", select sector = "bootsector"
  • click on "Read sector from disk"
  • click on "save sector to file" (512 bytes named something like: BootSector_G9.bin)
  • Open xvi32 (or another hex editor ) to edit this file
  • For FAT16 cards, go to offset 0x40 (decimal 64) and type BOOTDISK in ASCII mode (as explained here). Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. Do not overwrite anything in that case.
  • For FAT32 cards, go to offset 0x1E0 (decimal 480) and type BOOTDISK in ASCII mode (as explained here).
  • Save it as a different file (for example : BootSector_G9_bootable.bin)
  • With HDHacker again, reselect the proper drive letter corresponding to your SD card in the card reader.
  • Set drive to operate = "bootsector", select sector = "bootsector"
  • press "load sector from file" and choose the file you just saved (for example : BootSector_G9_bootable.bin)
  • press "write sector on disk" (Don't forget to select the correct drive letter!)
  • Unzip you the correct CHDK zip file for your camera and firmware version to the SD card, remembering set your unzip utlitily to recreate the folder structure from the zip file on the SD card.
  • Lock the card, insert in camera, power on and enjoy.


Windows Method #4: bootable.exe CLI

  • Extract from [ http: // ewavr.nm.ru /chdk / bootable.zip ] the "bootable.exe" file (link obfuscated to bypass wikia ban on directly downloadable links - remove spaces to fix it)
  • Put your SD card into reader or SD slot in computer and copy "bootable.exe" to the SD card
  • SD card behaves as disk and has assigned some letter (for example "F:"). Run shell (on winXP: menu Start - Run..., type "cmd") and change to SD card (by typing "F:" and press Enter in this example case)
  • Run "bootable.exe" You will be prompted to give right syntax as "bootable.exe F:"
  • Confirm and your SD card is bootable (Note: Doesn´t work with SanDisk Ultras "USB-Edition"!)


Windows Method #4: CHDK in-camera

If you have a SDHC card that is bigger than 4Gb and a camera released prior to 2011, you have to create two partitions on the card. This can be done entirely on the camera thanks to Thorwak's great modification and guide. Here is how to do it, more or less copied from his guide:

  • Low level format card in camera. The card now contains one FAT32 partition.
  • Unpack the small build of CHDK directly to the card using PC.
  • Start CHDK manually (Firmware update).
  • Enter the CHDK menu, and select Miscellaneous stuff -> Debug Parameters -> Create card with two partitions. CHDK now creates the boot partition as before, but also formats it using FAT12 and marks the partition bootable. (not available on all ports)
  • Put the card back in PC. If necessary, format the newly created 2MB partition. Re-unpack small CHDK to this partition.
  • Write protect the card (there is usually a switch on the side of the card; move it to the locked position).
  • The camera should now boot off of the card.
  • Enter the CHDK menu, and select Miscellaneous stuff -> Swap partitions.
  • Unlock the card, and put it back in the PC. Now format the large partition, and unpack full CHDK onto it.
  • Lock the card and put it back in the camera.
  • Start CHDK manually (Firmware update) one more time, and select Miscellaneous stuff -> Swap partitions.

Congratulations, now your camera should boot from CHDK automatically!

Caveats: Windows does not seem to be able to access both partitions at once. See the note below about using Linux to fix that. Otherwise you will have to run Swap partitions before you take the card out of the camera so windows can access your photos, then repeat the last step after you put the card back in to make it boot CHDK automatically. To me, this is much better than having to start CHDK manually every time you turn on the camera!

Apple Mac

Apple Method #1:

More complete directions - FAQ/Mac

Apple Method #2: MacOS X Leopard

  • Load your SD card in a card reader (unless your camera appears as a disk drive when you connect it)
  • Open Disk Utility and highlight the volume. Click "Info" and look for "Disk Identifier". For me, it was /dev/disk2s1
  • close the Info window
  • With the volume highlighted (not the "drive"), click "Unmount".
  • From a Terminal command line, run a command like this:
sudo newfs_msdos -F 16 -v MYSDCARD -b 4096 -c 128 /dev/disk2s1

If you get an error on the Mac command line after running this command like "newfs_msdos: warning: /dev/disk2s1 is not a character device" go ahead and re-mount the drive in the Apple Disk Utility. The drive should still show up as a FAT 16 drive, you can then continue

Apple Method #3: Darwin ports installed

The instructions for the Linux direct method also work for the Mac, provided you have darwin ports installed

  • Go to MacPorts website and install MacPorts [1]
  • type sudo port install hexedit to install hexedit
  • type man hexedit to familiarize yourself with the commands of hexedit
  • Open Disk Utility and click on the image for the SD card - click on "Get Info" to determine the location of the partition (such as disk4s1)
  • Use Disk Utility to unmount the partition
  • in a terminal window, type sudo hexedit /dev/disk4s1. Press enter (that's fn+return on some keyboards). Type in '40' to go to offset 0x40. Hit enter. Hit "tab" to switch to typing on the ASCII side. Type "BOOTDISK". Hit control-X and type "Y" when prompted to save.

Apple Method #4:

If you don't want to install darwinports and hexedit, you can also use the free 0xED [2], or Hex Fiend, which will work with the indirect way as well. This may be the simplest way for a Mac user to get a bootable SD disk.

  • Go to the Disk Utility. Select your SD card from the list at the left, and click Informations to get the disk identifier (example: disk4s1). Use this in the steps below
  • Using Disk Utility, unmount (don't eject!) your SD card.
  • Open a Terminal window and type: dd if=/dev/disk4s1 of=BootSector_G9.bin bs=512 count=1. This copies a sector of the SD card to your Mac's hard disk.
  • The BootSector_G9.bin file in your Home directory contains your SD card's boot sector. Make a backup of it in case anything goes wrong.
  • Open BootSector_G9.bin with 0xED. Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. Do not overwrite anything in that case.
  • If the file is correct, select the Overwrite writing method (Command+Shift+O).
  • Go to offset hex 40 (decimal 64) and press Tab. Type BOOTDISK. Save and quit.
  • In your Terminal window, type: dd if=BootSector_G9.bin of=/dev/disk4s1 bs=512 count=1. This copies the modified file to the boot sector of your SD card.
  • Using Disk Utility, mount the card.
  • Copy the file DISKBOOT.BIN to the SD card. Make sure to use the correct version for your model of Canon camera.
  • Eject the SD card. Slide the tab to the LOCK position

Linux

Linux Method #1: Smaller SD Cards

SD card no larger than 4Gb. To start from zero, either format your card with the camera, or use GParted (or fdisk) to create a single partition on the SD card. Make sure the format is FAT16. About gparted: Note that making a single partition doesn't mean dividing the card in two parts, it means creating a single data section called a partition.

To make the partition bootable, use:

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


Linux Method #2a: Larger SD Cards (>4G) for cameras released before 2011

If you have a SD card that is bigger than 4Gb you have to create 2 partions on the card. The first has to be formatted with FAT16 and will hold the CHDK files for booting (1MB is enough). The second partition has to be formated with FAT32 and will hold the images. The simplest way to do this in Linux is to install gparted. With this great GUI based partition manager you can set up the partitions. Within gparted, set the "boot" flag for the first partition. It will not work without this. Note: Windows will not be able to see the second partition holding the pictures unless you do some modification to partition table.

To make the first partition bootable use:

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


Notes: from gparted you should already know the correct location of your card (/dev/sdb1 or b2 or a1 or a2 ....). Or by looking at dmesg just after you inserted your card it will show you your SD card device name e.g. look for a line sometine like [ 9888.596295] sdb: sdb1 then sdb1 is your device

gparted tips: Insert the card before starting gparted. If you find the 'fat16'menu option greyed out in the 'format to' menu, you may need to install dosfstools in the package manager (in this case you may also have to restart gparted). Remember to hit 'apply all operations' in the edit menu to apply the changes you made to the card before exiting gparted.


Linux Method #2b: Larger SD Cards (>4G) for cameras released after 2010 :

  • fdisk /dev/<your card device>
  • Press "d<enter>" to delete existing partitions
  • Press "n<enter> p<enter> 1<enter> <enter> <enter>" to crete a new partition that uses all the card space
  • Press "t<enter> b<enter>" to set the type to FAT32
  • Press "w<enter>" to write to card
  • mkdosfs -F 32 -n <some name> /dev/<your card device's 1st partition>
  • echo -n BOOTDISK | dd bs=1 count=8 seek=480 of=/dev/<your card device's 1st partition>
  • Mount the filesystem and copy CHDK files to it
  • Unmount the filesystem and lock the card and enjoy CHDK.


Linux Method #3

  • Start a terminal, if you haven't done so already
  • Determine the location of your card, it is usually something like /dev/sdx. If the card is mounted, you can determine the location from the mount command. Make sure you pick the right one! Replace the x in /dev/sdx appropriately.
  • Make sure your card is unmounted (umount /dev/sdx1)
  • Now, you need to alter the partition's bootsector. There are two ways to do this. This guide assumes hexedit is used, though you can use any hex editor. Keep in mind that, if you do not see FAT12 or FAT16 around 0x36 (decimal 54) in the hex editor, you probably picked the wrong drive. Do not overwrite anything in that case. If you see FAT32, you will have to reformat the card in FAT16 - this can be easily done with mkdosfs -F 16 /dev/your_card_partition. Make sure to copy all the needed images off the card before doing this.
    1. Directly
      • Open your SD card's FAT partition in hexedit: hexedit /dev/sdx1
      • Go to offset 0x40 (decimal 64) and type BOOTDISK in ASCII mode.
      • Save (Ctrl-X in hexedit) and quit.
    2. Directly (without hexedit)
      • echo -n BOOTDISK | dd bs=1 count=8 seek=64 of=/dev/sdx1 (if you get "dd: /dev/sdx1 Permission denied" put "sudo " before dd)
    3. Indirectly
      • First, extract the bootsector like this: dd if=/dev/sdx1 of=BootSector_G9.bin bs=512 count=1
      • Copy the saved file, so you have a backup: cp BootSector_G9{,_bootable}.bin
      • Open the copy in a hex editor: hexedit BootSector_G9_bootable.bin
      • Go to offset 0x40 (decimal 64) and type BOOTDISK in ASCII mode.
      • Save (Ctrl-X in hexedit) and quit.
      • Upload the bootsector to the card again: dd if=BootSector_G9_bootable.bin of=/dev/sdx1 bs=512 count=1
    4. Indirectly (without hexedit, assuming bash)
      • First, extract the start of the bootsector like this: dd if=/dev/sdx1 of=BS.bootable bs=64 count=1
      • Next, append the required name: echo -n BOOTDISK >> BS.bootable
      • Finally, append the rest: dd if=/dev/sdx1 bs=1 skip=72 count=$[512-72] >> BS.bootable
      • Upload the bootsector to the card again like in the former example: dd if=BS.bootable of=/dev/sdx1 bs=512
    5. Indirectly with script (szymonolko_a_t_o2.pl)
      • Save below lines as script
      • Run it with one argument which is the partition to be made bootable, eg. make.bootable /dev/mmcblk1p1
#!/bin/bash
DEV=$1
if [[ -z "${DEV}" ]]
then
   echo "Usage: $0 partition"
   exit 1
fi
dd if=${DEV} of=1.tmp.bin bs=64 count=1
echo "BOOTDISK" > 2.tmp
dd  if=2.tmp of=2.tmp.bin bs=8 count=1
rm 2.tmp
#512-64-8=440
dd if=${DEV} of=3.tmp.bin skip=9 bs=8 count=55
cat 1.tmp.bin 2.tmp.bin 3.tmp.bin > bootable.bin
rm 1.tmp.bin
rm 2.tmp.bin
rm 3.tmp.bin
dd if=bootable.bin of=${DEV} bs=512 count=1
rm bootable.bin

or

#!/bin/bash
[ "$1" ] || { echo "Usage: $0 partition"; exit 1; }
dd if="$1" of=bootable.bin bs=512 count=1
echo -n "BOOTDISK" | dd of=bootable.bin bs=1 count=8 seek=64 conv=notrunc
dd if=bootable.bin of="$1" bs=512 count=1
rm bootable.bin


Linux Method#4

Another  Linux User's Guide can been found here: Install CHDK on Your Canon Camera Using Linux (be sure to format your SD card with FAT16 or directly with your camera). 

Linux Method for making a second partition visible under Windowa

Assuming your memory card is /dev/sdX

  1. Open fdisk
    1. fdisk /dev/sdX
  1. Create an empty dos partition table.
    1. o <enter>
  2. Create sdX1 and sdX2 as primary partitions:
    1. n <enter> p <enter> 1 <enter> 1 <enter> +10M <enter>
    2. n <enter> p <enter> 2 <enter> <enter> <enter>
  3. Change sdX1 -> fat16, sdX2 -> fat32
    1. t <enter> 1 <enter> 6 <enter>
    2. t <enter> 2 <enter> b <enter>
  4. Write changes to disk & exit
    1. w <enter>
  5. Make filesystems
    1. mkdosfs /dev/sdX1; mkdosfs -F32 /dev/sdX2
  6. Make the sdX1 bootable (see instructions above)
  7. Look at the partition layout for /dev/sdX1
    1. fdisk -l /dev/sdX
    2. Note the numbers under the "Start", "#sectors", and "Id" parameters
    3. Example output:
      1. Device Boot Start End #sectors Id System
        /dev/sdd1 32 18431 18400 6 FAT16
        /dev/sdd2 18432 31115263 31096832 b W95 FAT32
        /dev/sdd3 0 - 0 0 Empty
        /dev/sdd4 0 - 0 0 Empty
  8. use sfdisk to create sdX3 as clone of sdX1
    1. sfdisk -uS -N3 -f /dev/sdX
    2. Use the numbers you wrote down in the last step for sdX1.
    3. {start} {#sectors} {id} <enter>
      1. From the example output: type "32 18400 6" and press <enter>
  9. Note: It will warn you that partitions 1 and 3 overlap. This is normal. Type "y" confirming that you want to run the command.
    1. y <enter>
  10. Change partition id of sdX1 to extended
    1. sfdisk --id /dev/sdX 1 5


Credit from above instructions to cg at http://chdk.setepontos.com/index.php/topic,255.30.html

Advertisement