For an embeded Debian3 operating system, Emdebian4, on an Armel5 (ARM/ATMEL) processor. The cross-compiler toolchain will be installed on a Linux box running Ubuntu 10.04 (Lucid Lynx).
Adding Embedian repositories to the aptitude install system
sudo gedit /etc/apt/sources.list
Add the following lines to that file:
#
# -- Emdebian cross toolchains
#
deb http://buildd.emdebian.org/debian/ lenny main
deb-src http://buildd.emdebian.org/debian/ lenny main
NOTE: Since late 2010, the repository location has been changed to:
# deb http://www.emdebian.org/debian/ unstable main
# deb http://www.emdebian.org/debian/ testing main
deb http://www.emdebian.org/debian/ lenny main
deb-src http://www.emdebian.org/debian/ lenny main
In order to verify and be able to use the repositories they have to be authenticated via GPG.
The simple way to do this is:
sudo apt-get install emdebian-archive-keyring
If you want to do it manually, please check http://www.emdebian.org/packages/keys.html.
Installing the tool-chain via aptitude
sudo apt-cache search armel
sudo apt-get install linux-libc-dev-armel-cross
sudo apt-get install libc6-armel-cross libc6-dev-armel-cross
sudo apt-get install binutils-arm-linux-gnueabi
sudo apt-get install gcc-4.3-arm-linux-gnueabi
sudo apt-get install g++-4.3-arm-linux-gnueabi
In the case of library version conflicts the following might help:
sudo apt-get autoremove
Installing the cross-tools own aptitude and dpkg
The embedian tool-chain comes along with it's own package management, that will allow you to install pre-compiled versions of essential basic libraries that will make it easier to get going.
sudo apt-get install apt-cross dpkg-cross
Update the list of available software and list/install packages using:
sudo apt-cross -a armel -u
sudo apt-cross -a armel -l
sudo apt-cross -a armel -i
Using the Embedian cross-compiler
In order to compile code using the cross-compiler, you need to tell your PC explicitly to use it.
NOTE that the binaries created do NOT run on your PC as they are compiled to run on an ARM architecture! You can check for which platform etc. a file is by displaying it's ELF header:
readelf -h
Custom Makefile
Make sure that the following variables are set in your Makefile/environment:
CC = arm-linux-gnueabi-gcc (or arm-linux-gnueabi-g++)
CXX = arm-linux-gnueabi-g++
If you want to link static libraries, which can be helpful in the case of embedded systems where not necessarily all libraries are available as dynamically linked versions on the target system, use:
CFLAGS += -static
Software that uses the "configure" workflow (usually the case!)
./configure --prefix=/usr/arm-linux-gnueabi --host=arm-linux-gnueabi
No comments:
Post a Comment