Compiling CHDK on Ubuntu 11.10 - General Discussion and Assistance - CHDK Forum

Compiling CHDK on Ubuntu 11.10

  • 5 Replies

Offline ahull

  • *****
  • 634
Compiling CHDK on Ubuntu 11.10
« on: 29 / April / 2012, 07:59:02 »
I thought this might help anyone attempting to compile CHDK on Ubuntu based Linux machines.

Please note this is not the standard supported configuration for compiling CHDK on linux, so use at your own risk.

Note, it is not necessary to compile your own CHDK unless you are adding featues or porting to a new camera. Most CHDK users can simply download the precompiled versions from the autobuild server.

I should explain that before going down the route I am about to describe,  I had followed a couple of other forum posts, regarding compiling on Linux, however I kept ending up  in dependency hell, or compiler version and switch confusion. I therefore decided to look to see if there was a reliable PPA for the arm-elf compiler packages for Ubuntu 11.10. I make no claims for the hard work done by the PPA's author, and any problems with it should be addressed to him via the links on the PPA page. Also note that there are packages for Natty and Lucid in this PPA too, so if you are using an earlier version you may be in luck. I haven't tested these versions to build CHDK however so let us know if you have success with them. 

The build process boils down to a few simple steps.

First create a folder for the chdk download. I tend to put non mainstream stuff in a subfolder of my home folder called PersonalApps. So fire up your a terminal window with <CTRL>+<ALT>T and proceed as follows.

Code: [Select]
mkdir ~/PersonalApps
mkdir ~/PersonalApps/CHDK
cd ~/PersonalApps/CHDK

Next checkout the latest CHDK code.

Code: [Select]
svn checkout chdk-devel

or if you perfer the stable branch,

Code: [Select]
svn checkout chdk-release

Now that we have some code to work with, we need a suitable compiler. There are other forum posts which detail obtaining and building from scratch, but we can cut out all of that hard work by using prebuilt packages.

Navigate to

You will see on the page that there are packages for Lucid and Natty too, I haven't tried them, but I cant think why they would not work.

Follow the instructions for adding the PPA and installing the packages and you should be ready to compile.

Code: [Select]
sudo add-apt-repository ppa:bdrung/bsprak
sudo apt-get update
sudo apt-get install arm-elf-toolchain

And finally compile your code. To do this, cd to the folder where you downloaded the code to, and run make.

Code: [Select]
cd  ~/PersonalApps/CHDK/chdk-devel

Note we use make, not gmake, and it takes a number of opions (see the for all of the possibilities).
Note also that if you make a mess, either use make clean, or remove the folder and download again using svn.

Here are a couple of examples for different models, f/w versions, to cleanup and to compile all of the downloaded code and save the results as .zip

Code: [Select]
make PLATFORM=ixus70_sd1000 PLATFORMSUB=102a firzipsubcomplete
make PLATFORM=ixus85_sd770 PLATFORMSUB=100b firzipsubcomplete
make PLATFORM=ixus85_sd770 PLATFORMSUB=100a all
make batch-clean
make batch-zip-complete

Have a play, I'm sure you will quickly get the idea.

Note: the resultant compiled code ends up in the bin folder of the source folder.

I hope this helps make life a little simpler for anyone using a Ubuntu based distro and trying to roll their own CHDK.

I have tested this on my Ixy 25 (Ixus 85) and it produces a fully fuctional CHDK.  Next on the agenda, I am going to try to port the Ixus Wireless. Wish me luck  :D
« Last Edit: 21 / May / 2012, 03:45:19 by ahull »

Re: Compiling CHDK on Ubuntu 11.10
« Reply #1 on: 29 / April / 2012, 15:56:05 »
Ported :   A1200    SD940   G10    Powershot N    G16


Offline kosy

  • *
  • 28
Re: Compiling CHDK on Ubuntu 11.10
« Reply #2 on: 16 / May / 2012, 02:32:16 »
I followed the instructions and installed the PPA on my Ubuntu 10.4 (Lucid) system, used svn to copy the stable release, and tried building the A3300 code.

However, I got some warnings and errors, and would like a little more information.

ten@ten-four:~/CHDK/chdk-release$ make PLATFORM=a3300 PLATFORMSUB=100c all
>> Entering to tools
pakwif.c -> pakwif.o
pakwif.o -> pakwif
gensig_dryos.c -> gensig_dryos.o
gensig_dryos.c: In function 'dump_sig':
gensig_dryos.c:295: warning: ignoring return value of 'fread', declared with attribute warn_unused_result

I got the same warnings on lines 817 and 1471 as well.
Is this a warning I need to do something about, or is it safe to ignore it?

gensig_dryos.o -> gensig_dryos
-> signatures_dryos.h
CAUTION! 'signatures_dryos.h' is not updated due to 'sig_ref_dryos_?.bin` is empty!

I don't know what to do about this -- suggestions?

Much later in the log I get this:

boot.c -> boot.o
stubs_min.S -> stubs_min.o
stubs_auto.S -> stubs_auto.o
-> stubs_entry.S
CAUTION! 'stubs_entry.S' is not updated due to target firmware binary not found!

Isn't this an expected result? I thought 'stubs_entry.S' was created to help in disassembling the firmware.

But the real showstopper is this, which gets repeated many times:

-> main.elf
/usr/lib-arm-elf/gcc/arm-elf/4.2.3/../../../../arm-elf/bin/ld: Warning: /usr/lib-arm-elf/gcc/arm-elf/4.2.3/thumb/libgcc.a(_udivsi3.o) does not support interworking, whereas main.elf does

as well as multiple lines of

  first occurrence: ../platform/a3300/libplatform.a(main.o): arm call to thumb
/usr/lib-arm-elf/gcc/arm-elf/4.2.3/../../../../arm-elf/bin/ld: /usr/lib-arm-elf/gcc/arm-elf/4.2.3/thumb/libgcc.a(_udivsi3.o)(__udivsi3): warning: interworking not enabled.

How do I change in my setup to make this work?

I use Linux, but have not used compilers on Linux before.




Offline ahull

  • *****
  • 634
Re: Compiling CHDK on Ubuntu 11.10
« Reply #3 on: 17 / May / 2012, 02:21:40 »
I am not sure if we can ignore these warnings or not, my gut feeling is that we can, however what happens when you run this command?

make PLATFORM=a3300 PLATFORMSUB=100c firzipsubcomplete

Does the compiler build a working firmware in the bin folder?
You should find a couple of files, probably named something like these.

Unzip the "full" one to your SD card and try it.


Offline kosy

  • *
  • 28
Re: Compiling CHDK on Ubuntu 11.10
« Reply #4 on: 18 / May / 2012, 02:21:32 »
> Does the compiler build a working firmware in the bin folder?

No, because the linker cannot resolve the "interwork" issue. I will either have to find a toolchain that includes libgcc.a that includes interworking capability, or build the proper libgcc.a myself.

I decided to try the Windows shell because I want to modify the A3300 version of CHDK, and the person who made CHDK for the A3300 used the Windows shell. My goal is to build exactly the same code he did to make sure my setup is correct, then start modifying it.

Re: Compiling CHDK on Ubuntu 11.10
« Reply #5 on: 09 / June / 2013, 00:10:22 »
Link for PPA repository not working. :'(


Related Topics