PLEASE READ THIS FIRST : A CHDK installation utility for Windows, Linux or Apple computers is available here : STICK. For Windows users, there is also this utility : CHIMP. This wiki page documents other ways to install CHDK on your camera's SD card. |
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.
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 CHDK 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 :
- 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.
- 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 utility.
- Put the SD card back into in your camera.
- Start your camera directly into Play Mode by pressing the Play button or, if you camera does not have a play button, with the Play/Rec switch or Mode dial in the Play position. Do not start the camera in Rec (shooting) mode - the firmware update method will not be available if you do.
- 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.
- Select "Firm Update..." and press FUNC.SET button.
- It should say "Update firmware version?" Press OK. If everything went correctly, the CHDK splash screen will appear briefly on the Camera's screen.
- Go back to the camera mode and you should see some new OSD (on screen display) elements. (to go to the camera mode half press the shutter button)
- Activate the CHDK menus with the <ALT> key or key sequence defined for your camera.
Bootable SD Card Method[]
Overview[]
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[]
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:[]
For recent cameras, a single FAT32 partition configured to be bootable is the preferred SD card configuration for automatically loading CHDK.
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 "Method 3" 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 where it's just not available).
Method 1 - Using the STICK utility
- 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.
- 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.
- 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.)
- 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.
- Remove the card from your camera and put it into the SD card reader of your PC.
- 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.
- 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!
- Unpack the appropriate build of CHDK for your camera and firmware version directly to the card (including all subdirectories).
- With the Card Lock switch still in the unlocked position put the card back into your camera.
- Start your camera in Playback (image review) mode, not shooting mode. For most cameras, this is done by powering on the camera using the Play button. For cameras where Playback mode is selected using a switch or mode dial position, select play before pressing the power button. If camera starts in Rec (shooting) mode, the firmware update option will generally not be available, even if you subsequently switch to playback.
- Start CHDK manually by selecting the Firmware Update option in the Canon menus.
- After the CHDK logo briefly displays, start CHDK by using the <ALT> key sequence for your camera.
- Enter the CHDK menu, and select Miscellaneous stuff -'> SD Card' -> Make Card Bootable
- 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.
- 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.)
- 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.).
- 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).
- 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.
- 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.
Method 4 - Using Chimp to create a dual partition exFat bootable SD card.
this method is only suitable for large sd cards (SDXC) on >2011 cams that use the card lock boot method. although it will give minor speed gains on cards sized 64GB, consider if you want the trouble a dual partition card can give. if your card is 256GB or bigger you might encounter missing CHDK modules at boot with a FAT32 formatted card. in that case this is your only solution to make it work.
needed: 64Gb or larger sdxc card, pc with Chimp, >2011 chdk capable cam, chdk build that supports dual partition
- if you have a single partition card, unpack the build to your sd card.
- place the card in your cam. card locked or with firmware update.
- go to chdk menu>miscellaneous stuff>Sd card> create dual partition
- place the card back in your pc, quick format the second partition to exFAT
- place the correct build without the CHDK folder on the first, small FAT partition
- place the correct build with the CHDK folder on the second exFAT partition
- use Chimp to make the card bootable
- lock the card and place it in your camera
if you want to make the card single partition again:
- use Chimp to remove the bootflag. if you don't the dual partition bootflag will be there even after formats and you'll be unable to remove it with Chimp unless you reformat to dual partition.
- delete the files on the FAT partition
- place the card in your cam and do a quick format
- quick format the card on your pc in your favorite file format
Utilities for cameras released after 2010:
- MS Windows:
- CHIMP: downloads, partitions and installs CHDK for any supported camera and SD card size
- 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.
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 :
- Setup the SD card by creating either a single partition (FAT16) or two partitions (a small FAT16 and a larger FAT32).
- Modify the boot block of the first partition on the card by writing the text string "BOOTDISK" at offset 0x40.
- 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
- 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.
- 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)
- 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.)
- 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 FAT32).
- Remove the card from your camera and put it into the SD card reader of your PC.
- 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!
- Unpack the appropriate build of CHDK for your camera and firmware version directly to the card (including all subdirectories).
- With the Card Lock switch still in the unlocked position put the card back into your camera.
- Start your camera in Playback (image review) mode, not shooting mode. For most cameras, this is done by powering on the camera using the Play button. For cameras where Playback mode is selected using a switch or mode dial position, select play before pressing the power button. If camera starts in Rec (shooting) mode, the firmware update option will generally not be available, even if you subsequently switch to playback.
- Start CHDK manually by selecting the Firmware Update option in the Canon menus.
- After the CHDK logo briefly displays, start CHDK by using the <ALT> key sequence for your camera.
- Enter the CHDK menu, and select Miscellaneous stuff -> Make Card Bootable
- 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)
- Low level format card in camera. The card now contains either at FAT16 or FAT32 partition.
- Unpack the CHDK build zip file directly to the card using your PC (make sure the folder structure in the zip file is preserved)
- Start CHDK manually using the Firmware Update method.
- 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.
- Put the card back in PC. If necessary, format the newly created 2MB partition to FAT16.
- Re-unpack 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 CHDK from the card (make sure the folder structure in the zip file is preserved)
- Enter the CHDK menus, and select Miscellaneous stuff -> SD Card -> Swap partitions
- 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)
- Lock the card and put it back in the camera.
- 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)
- 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.)
- 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).
- 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).
- 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.
- 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:
- CHIMP: downloads, partitions and installs CHDK for any supported camera and SD card size + allows easy swapping of primary & secondary partitions of dual partition cards
- 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.
- instruction are also available for using Partition Wizard and MBRFix
- 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:
- to make a card bootable use the Linux Installer for CHDK and SDM.
- Apple Mac:
- to make a card bootable use the SDMInst app as described in FAQ/Mac.
- pay particular attention to Problems loading CHKD on SD cards with a Mac computer.
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 SD card lock, 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 before Windows 10, do not have drivers which can properly handle SD cards with multiple partitions. Affected Windows versions 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)
- First format your card FAT32.
- On a PC, use HxD http://mh-nexus.de/en/hxd/ to EDIT the boot sector of the SD card.
- In Extra- > Open Disk Deselect Read Only: BE CAREFUL! Select the Unit x: or what ever of your SD card - not your hard disk!!!
- Go to the right part at the level of 00001E0 and change the letters "any key " to "BOOTDISK"
- SAVE.
- 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 original directory structure).
- 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:
- Format card by any method on this page (recommend using your camera)
- Make card bootable by any method on this page (recommend using STICK)
- 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:
- Format card
- 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 utility 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 [https://me ga .nz/#!bV1XQIyB!2w2BisA4O5xaF-e1ATXb9n-u41Ay5v7GzWUE1xd8_MY] 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 #5: 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. Once more, 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 from 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.
Windows Method #6: 2017 Experimental Windows Installation Utility
CHIMP: Canon Hack Installation and Management Platform
General Windows Caveat: Prior to the Q2/2017 Windows 10 update, Windows was not able to access both partitions on a dual partition SD card at once. See the note below about using Linux to fix that. Otherwise you will have to run the CHDK menu item 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.
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 partitions 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 formatted 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 sometime 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 create 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.
- 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.
- 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)
- 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
- 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
- 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
- Directly
#!/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 Windows[]
Assuming your memory card is /dev/sdX
- Open fdisk
- fdisk /dev/sdX
- Create an empty dos partition table.
- o <enter>
- Create sdX1 and sdX2 as primary partitions:
- n <enter> p <enter> 1 <enter> 1 <enter> +10M <enter>
- n <enter> p <enter> 2 <enter> <enter> <enter>
- Change sdX1 -> fat16, sdX2 -> fat32
- t <enter> 1 <enter> 6 <enter>
- t <enter> 2 <enter> b <enter>
- Write changes to disk & exit
- w <enter>
- Make filesystems
- mkdosfs /dev/sdX1; mkdosfs -F32 /dev/sdX2
- Make the sdX1 bootable (see instructions above)
- Look at the partition layout for /dev/sdX1
- fdisk -l /dev/sdX
- Note the numbers under the "Start", "#sectors", and "Id" parameters
- Example output:
- 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
- Device Boot Start End #sectors Id System
- use sfdisk to create sdX3 as clone of sdX1
- sfdisk -uS -N3 -f /dev/sdX
- Use the numbers you wrote down in the last step for sdX1.
- {start} {#sectors} {id} <enter>
- From the example output: type "32 18400 6" and press <enter>
- Note: It will warn you that partitions 1 and 3 overlap. This is normal. Type "y" confirming that you want to run the command.
- y <enter>
- Change partition id of sdX1 to extended
- sfdisk --id /dev/sdX 1 5
Credit from above instructions to cg at http://chdk.setepontos.com/index.php/topic,255.30.html