Martin Guy, 4 December 2005
However, the precompiled Debian packages are compiled to run on a wide range of ARM processors including ARM 610, ARM 710 and StrongARM, and as such are not optimised for the ARM920T that we use.
This document explores how to compile and install Debian packages from their source code while modifying the compilation options, and of thus making SIM.ONE-specific Debian packages.
By default, GCC-4.0.2 seems to generate code for -march=armv4 (not armv4t) and for -mcpu=arm720, while the best generic options for our platform are -march=armv4t -mcpu=arm920t.
There is more detailed information on GCC option flags in the Speed-space document.
First make sure the things it needs to build it are installed:
# apt-get build-dep aptitudethen fetch and compile the source code
# export CFLAGS="-mcpu=arm920t -O2"This fails with errors, and "aptitude --version" says that it was built with GCC 3.3.5. Let's see if it works with GCC 3.3:
# export CXXFLAGS="$CFLAGS"
# apt-get --compile source aptitude
# export CC=gcc-3.3 CFLAGS="-mcpu=arm920t -O2"Result: 6% reduction in code size and 0.4% increase in code speed.
# export CXX=g++-3.3 CXXFLAGS="$CFLAGS"
# apt-get --compile source aptitude
Standard package:Our arm920t-specific binary has 3% more code but is 4% faster.
text data bss dec hex filename Timing
30305 4812 8852 43969 abc1 /usr/bin/mpg321 73.70r 72.70u 0.15
Home-built package with cpu=arm920t:
31336 4812 8848 44996 afc4 /usr/bin/mpg321 72.17r 70.01u 0.13s
# apt-get build-dep aptitudeThis method works for packages that are built using the standard "configure" scripts. It does not work for (eg) bsdgames, which has its own configuration mechanism and does not react to the CFLAGS environment variable. mpg321's debian/rules file blandly sets CFLAGS with no way to insert extra options.
# apt-get source aptitude
# cd aptitude-*
# export CC=gcc-3.3 CFLAGS="-mcpu=arm920t -O2"
# export CXX=g++-3.3 CXXFLAGS="$CFLAGS"
# dpkg-buildpackage
One way to fix every package would be to reinstall the compiler so that it always generates arm920t code by default instead of generic ARM code, or to replace "gcc" with a wrapper script that calls the real gcc inserting an extra -mcpu=arm920t option:
#! /bin/shThis is the method used for "mpg321" above.
exec /usr/bin/gcc-4.0 -mcpu=arm920t "$@"
apt-build world --reinstallor
apt-build install mozilla-firefoxas a command to recompile the entire current system from source code. Specific compiler flags are configured into apt-build, which then uses a gcc wrapper to supply them to the real compiler. For gcc-4, these would be "-O2 -march=armv4t -mcpu=ep9312"
On our Armadillo native ARM Debian system, apt-build says:
Segmentation faultGreat!