How does CHDK work?

The CHDK main menu organizes the numerous functions into 11 groups. The menu is obtained by changing into <Alt> mode, then pressing the MENU button.

Canon cameras perform several steps when switched on:

  • First, the camera’s firmware checks the memory card. If the card is write-protected, and if it contains a file named DISKBOOT.BIN in its root directory, then this file is loaded and executed. This allows almost any program in the camera to be infiltrated.
  • If such a file is not found, the normal start-up process continues. This includes the launch of four different native tasks that run in parallel and manage the different units of the camera:
    • The Logging task takes care of the camera’s display unit. It is responsible for presenting information to the user.
    • The Keyboard task monitors the camera’s buttons for key presses.
    • The Image-capturing task is responsible for exposure and focus control and for reading the data from the sensor.
    • The File-system task is responsible for writing images to the memory card and managing the card’s file system.

The CHDK adds an additional task that manages the CHDK functions. In addition, the CHDK needs hooks in the native tasks to communicate with them. Therefore, the CHDK loader embodied in the file DISKBOOT.BIN performs the following steps:

  • Copies the core CHDK code into a suitable memory location within the camera. Of course, this is only possible if the camera has enough free memory. On some cameras this is not the case, and limited or no CHDK support is possible.
  • Restarts the camera with the CHDK code as the entry point. Instead of the native boot process, the CHDK boot process is now performed. This process will:
    • Launch the CHDK task.
    • Add hooks to the native tasks (logging task, keyboard task, image-capturing task, file-system task) while loading and launching those tasks.

In this way, the changes applied to the native firmware are only temporary and remain minimal. Unfortunately, the position of the hooks is different for every firmware version, so a different CHDK version is required for each firmware version. The main task of migrating the CHDK code to a new camera is to find out the correct position of the required hooks.

No comments yet.

Leave a Reply