CHDK/German/CHDK unter Linux kompilieren

This is the procedure I used to compile CHDK (April 2007).


 * Create a directory where to load the CHDK source code.

> mkdir ~/chdk && cd ~/chdk


 * Get the CHDK source code.

> svn co http://tools.assembla.com/svn/chdk/trunk

or

> svn co http://tools.assembla.com/svn/chdk/grand


 * Or update the source code

> cd grand && svn up


 * Install the cross compiler


 * Get the sources of gcc and binutils from a GNU repository. I used the latest available version of each.


 * Decide where the cross compiler will be on your computer.

> mkdir ~/arm-elf


 * Tell your computer you are going to run programs from that location.

> export PATH=${HOME}/arm-elf/bin:$PATH


 * Create a working area and build binutils and gcc.

> mkdir ~/wa > cd ~/wa > tar xvfj ../src/rlx_dist/binutils-2.17.tar.bz2 > tar xvfj ../src/rlx_dist/gcc-4.1.2.tar.bz2

> cd binutils-2.17 > ./configure --srcdir=../binutils-2.17 --target=arm-elf \ --prefix=~/arm-elf > make > make install > cd ..


 * Manually edit file  to include the following lines without a "#" character in front of the line.

MULTILIB_EXCEPTIONS += *mapcs-26/*mthumb-interwork MULTILIB_OPTIONS   += mno-thumb-interwork/mthumb-interwork MULTILIB_DIRNAMES  += normal interwork

> mkdir gcc-4.1.2-arm-elf && cd gcc-4.1.2-arm-elf > ../gcc-4.1.2/configure --srcdir=../gcc-4.1.2 --target=arm-elf --with-cpu=arm9 --disable-libm --disable-libc --disable-threads --disable-nls --disable-libssp --disable-intl --disable-libiberty --enable-languages=c --with-softfloat-supp --with-float=soft --prefix=~/arm-elf > make > make install


 * That's it for the installation of the cross-compiler.


 * Compiling the CHDK. Go to either 'trunk' or 'grand'.

> cd ~/chdk/grand


 * Manually edit file  to select PLATFORM and PLATFORMSUB for your camera: just remove the "#" comment characters. Also, add the following line at the beginning of file  to tell CHDK where the arm cross compiler is,

PATH := $(HOME)/arm-elf/bin:$(PATH)


 * You should be ready to compile everything.

> make fir


 * PS.FIR should be in the "bin" directory.


 * If you want to compile firmware for an another camera, just execute make with PLATFORM and PLATFORMSUB arguments. For example:

> make PLATFORM=a620 PLATFORMSUB=100f fir


 * To compile firmware for all cameras just type:

> make batch-zip

= An alternative method with gcc-3.4.6 = There is a patch included in HDK for building with gcc-3.4.6. It's a simpler install if you want to use this version of gcc. This method uses a global install of the arm-elf tools.

Remember to clear any CFLAGS you've got set:

> export CFLAGS=""

Compile and install binutils
Extract the source, change to its directory, and

> mkdir binutils-2.17-arm-elf > cd binutils-2.17-arm-elf/ > ../configure --srcdir=../ --target=arm-elf && make && sudo make install

Compile and install GCC-3.4.6
Download gcc-3.4.6, extract it and change to that directory. Patch the GCC source with the toolkit patch:

> patch -p0 < [path_to_hdk]/grand/tools/patches/gcc-3.4-arm.diff


 * Build the source:

> mkdir gcc-arm-elf > cd gcc-arm-elf/ > ../configure --srcdir=../ --target=arm-elf --with-cpu=arm9 \ --with-newlib --enable-multilib --enable-languages=c \ && make && sudo make install

You can now build the HDK source as directed above