CHDK Wiki
m (Category)
(added --disable-werror for binutils configure (fixes compile errors with gcc 4))
 
(4 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
* Create a directory where to load the CHDK source code.
 
* Create a directory where to load the CHDK source code.
   
> mkdir ~/chdk && cd ~/chdk
+
> mkdir ~/chdk && cd ~/chdk
   
 
* Get the CHDK source code.
 
* Get the CHDK source code.
   
> svn co http://tools.assembla.com/svn/chdk/trunk
+
> svn co https://tools.assembla.com/svn/chdk/trunk
   
 
or
 
or
   
> svn co http://tools.assembla.com/svn/chdk/grand
+
> svn co https://tools.assembla.com/svn/chdk/branches/grand/
   
 
* Or update the source code
 
* Or update the source code
   
> cd grand && svn up
+
> cd grand && svn up
   
 
* Install the cross compiler
 
* Install the cross compiler
   
:Get the sources of gcc and binutils from a GNU repository. I used the latest available version of each.
+
: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.
 
:Decide where the cross compiler will be on your computer.
   
> mkdir ~/arm-elf
+
> mkdir ~/arm-elf
   
 
:Tell your computer you are going to run programs from that location.
 
:Tell your computer you are going to run programs from that location.
   
> export PATH=${HOME}/arm-elf/bin:$PATH
+
> export PATH=${HOME}/arm-elf/bin:$PATH
   
 
:Create a working area and build binutils and gcc.
 
:Create a working area and build binutils and gcc.
   
> mkdir ~/wa
+
> mkdir ~/wa
 
> cd ~/wa
 
> cd ~/wa
 
> tar xvfj ../src/rlx_dist/binutils-2.17.tar.bz2
 
> tar xvfj ../src/rlx_dist/binutils-2.17.tar.bz2
 
> tar xvfj ../src/rlx_dist/gcc-4.1.2.tar.bz2
 
> tar xvfj ../src/rlx_dist/gcc-4.1.2.tar.bz2
   
> cd binutils-2.17
+
> cd binutils-2.17
 
> ./configure --srcdir=../binutils-2.17 --target=arm-elf \
 
> ./configure --srcdir=../binutils-2.17 --target=arm-elf \
--prefix=~/arm-elf
+
--prefix=~/arm-elf --disable-werror
 
> make
 
> make
 
> make install
 
> make install
Line 45: Line 45:
 
:Manually edit file <gcc-4.1.2/gcc/config/arm/t-arm-elf> to include the following lines without a "#" character in front of the line.
 
:Manually edit file <gcc-4.1.2/gcc/config/arm/t-arm-elf> to include the following lines without a "#" character in front of the line.
   
MULTILIB_EXCEPTIONS += *mapcs-26/*mthumb-interwork
+
MULTILIB_EXCEPTIONS += *mapcs-26/*mthumb-interwork
 
MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
 
MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
 
MULTILIB_DIRNAMES += normal interwork
 
MULTILIB_DIRNAMES += normal interwork
   
   
> mkdir gcc-4.1.2-arm-elf && cd gcc-4.1.2-arm-elf
+
> 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
 
> ../gcc-4.1.2/configure --srcdir=../gcc-4.1.2 --target=arm-elf
 
--with-cpu=arm9 --disable-libm --disable-libc --disable-threads
 
--with-cpu=arm9 --disable-libm --disable-libc --disable-threads
Line 61: Line 61:
 
: That's it for the installation of the cross-compiler.
 
: That's it for the installation of the cross-compiler.
   
* Compiling the CHDK. Go to either 'trunk' or 'grand'.
+
* Compiling the CHDK. Go to either 'trunk' or 'grand'.
   
> cd ~/chdk/grand
+
> cd ~/chdk/grand
   
 
: Manually edit file <makefile.inc> to select PLATFORM and PLATFORMSUB for your camera: just remove the "#" comment characters. Also, add the following line at the beginning of file <makefile.inc> to tell CHDK where the arm cross compiler is,
 
: Manually edit file <makefile.inc> to select PLATFORM and PLATFORMSUB for your camera: just remove the "#" comment characters. Also, add the following line at the beginning of file <makefile.inc> to tell CHDK where the arm cross compiler is,
   
PATH := $(HOME)/arm-elf/bin:$(PATH)
+
PATH := $(HOME)/arm-elf/bin:$(PATH)
   
 
: You should be ready to compile everything.
 
: You should be ready to compile everything.
   
> make fir
+
> make fir
   
 
: PS.FIR should be in the "bin" directory.
 
: PS.FIR should be in the "bin" directory.
Line 77: Line 77:
 
: If you want to compile firmware for an another camera, just execute make with <tt>PLATFORM</tt> and <tt>PLATFORMSUB</tt> arguments. For example:
 
: If you want to compile firmware for an another camera, just execute make with <tt>PLATFORM</tt> and <tt>PLATFORMSUB</tt> arguments. For example:
   
> make PLATFORM=a620 PLATFORMSUB=100f fir
+
> make PLATFORM=a620 PLATFORMSUB=100f fir
   
 
: To compile firmware for all cameras just type:
 
: To compile firmware for all cameras just type:
   
> make batch-zip
+
> make batch-zip
   
   
 
= An alternative method with gcc-3.4.6 =
 
= 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.
+
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:
 
Remember to clear any CFLAGS you've got set:
   
> export CFLAGS=""
+
> export CFLAGS=""
   
 
== Compile and install binutils ==
 
== Compile and install binutils ==
 
Extract the source, change to its directory, and
 
Extract the source, change to its directory, and
   
> mkdir binutils-2.17-arm-elf
+
> mkdir binutils-2.17-arm-elf
 
> cd binutils-2.17-arm-elf/
 
> cd binutils-2.17-arm-elf/
 
> ../configure --srcdir=../ --target=arm-elf && make && sudo make install
 
> ../configure --srcdir=../ --target=arm-elf && make && sudo make install
Line 102: Line 102:
 
Patch the GCC source with the toolkit patch:
 
Patch the GCC source with the toolkit patch:
   
> patch -p0 < [path_to_hdk]/grand/tools/patches/gcc-3.4-arm.diff
+
> patch -p0 < [path_to_hdk]/grand/tools/patches/gcc-3.4-arm.diff
   
 
: Build the source:
 
: Build the source:
   
> mkdir gcc-arm-elf
+
> mkdir gcc-arm-elf
 
> cd gcc-arm-elf/
 
> cd gcc-arm-elf/
 
> ../configure --srcdir=../ --target=arm-elf --with-cpu=arm9 \
 
> ../configure --srcdir=../ --target=arm-elf --with-cpu=arm9 \
Line 114: Line 114:
 
You can now build the HDK source as directed above
 
You can now build the HDK source as directed above
   
  +
[[Category:German]]
 
  +
===Python GUI===
  +
{{notice|''' An GUI written in python is available here: [http://drop.io/chdk_linux chdk_linux drop]}}
  +
  +
cd directory/where/chdk-linux-compiler-v*.py/is
  +
python chdk-linux-compiler-v(version number here).py example:(python chdk-linux-compiler-v1.py)
  +
  +
Click on "download env and trunk"<br />
  +
Uncomment your cameras row in "trunk/makefile.inc" (by default is s3is 100a enabled)<br />
  +
Click on "compile complete"
  +
  +
The files should be in "compiled_files"
  +
[[Category:German|CHDK unter Linux kompilieren]]

Latest revision as of 09:08, 2 May 2010

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 https://tools.assembla.com/svn/chdk/trunk

or

> svn co https://tools.assembla.com/svn/chdk/branches/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 --disable-werror
 > make
 > make install
 > cd ..
Manually edit file <gcc-4.1.2/gcc/config/arm/t-arm-elf> 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 <makefile.inc> to select PLATFORM and PLATFORMSUB for your camera: just remove the "#" comment characters. Also, add the following line at the beginning of file <makefile.inc> 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


Python GUI

Notice

An GUI written in python is available here: chdk_linux drop


cd directory/where/chdk-linux-compiler-v*.py/is
python chdk-linux-compiler-v(version number here).py  example:(python chdk-linux-compiler-v1.py)

Click on "download env and trunk"
Uncomment your cameras row in "trunk/makefile.inc" (by default is s3is 100a enabled)
Click on "compile complete"

The files should be in "compiled_files"