[Tutorial] Cross Compile for arm-linux (Finally it works!)

Mitteilungen und Ankündigungen

[Tutorial] Cross Compile for arm-linux (Finally it works!)

Beitragvon mschnell » 14. Jan 2010, 10:17 [Tutorial] Cross Compile for arm-linux (Finally it works!)

siehe http://lazarus.freepascal.org/index.php ... cseen.html:
fredvs January 13, 2010, 08:33:12 pm hat geschrieben:Hello folks.
Here some infos for installing cross-arm-compiler on a working fpc-lazarus system.
Many-many thanks to Kjooob who have done all the work :D

1. Install FPC and Lazarus sources and SVN

Here is the best link i have find to install it (explanations are in French, just follow the command or use a translator)

http://lazarus-fr.espace-malin.fr/index ... s&Itemid=4

In this tuto i have installed the sources folder in /home/user/lazarus
(!!!! Replace user by your user name in all the command following !!!!).

2. Install & Configure Binutils

1) Download binutils-2.20.tar.gz from http://ftp.gnu.org/gnu/binutils/binutils-2.20.tar.gz

2) Extract binutils-2.20.tar.gz in:
home/user/fpc_tools/binutils-2.20

3) From console : cd /fpc_tools/binutils-2.20

4) From console : ./configure --target=arm-linux --disable-werror

5) From console : make

6) From console : sudo make install

7) From console :
mkdir home/user/lazarus/fpc/binutils
ln -s /usr/local/bin/arm-linux-ar home/user/lazarus/fpc/binutils/ar
ln -s /usr/local/bin/arm-linux-ld home/user/lazarus/fpc/binutils/ld
sudo mv /usr/local/bin/arm-linux-as /usr/local/bin/arm-linux-as_org


8 ) From console :
sudo gedit /usr/local/bin/arm-linux-as

paste:

#!/bin/sh
/usr/local/bin/arm-linux-as_org -meabi=5 $@

9) save and close gedit

10) From console : sudo chmod +x /usr/local/bin/arm-linux-as

11) From console : ln -s /usr/local/bin/arm-linux-as home/user/lazarus/fpc/binutils/as


3. Configure FPC for ARM:

1) From console : cd /lazarus/fpc/2.5.1/

2) From console : sudo make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/home/user/lazarus/fpc/binutils/ OPT=-dFPC_ARMEL INSTALL_PREFIX=/usr

3) From console : sudo gedit /etc/fpc.cfg

4) Paste at end:

#DEFINE LAZARUS

-Fu/usr/lib/fpc/2.5.1/units/$fpctarget/*
-Fl/usr/lib/fpc/2.5.1/units/$fpctarget/rtl/

-a
-Sd
-Xd
-Xs

-O-

#IFDEF CPUARM
-XP/home/kjow/lazarus/fpc/binutils/
-Xr/usr/lib/fpc/2.5.1/units/arm-linux/rtl/
-Xr/home/kjow/lazarus/fpc/libcross
-XR/home/kjow/lazarus/fpc/
-darm
-Tlinux
#ENDIF

5) save and close gedit

6) From console : sudo ln -sf /usr/lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm

4. Cross compile the LCL:

From the IDE:
* Open Tools / Configure Build Lazarus / Advanced Build Options.
* In Target OS write linux and in Target CPU write arm.
* Set LCL and Package registration to Build (the middle radio button) and all other to None (left radio buttons).
* Click the Build button.

5. Set Targets:

From the IDE:
* Set in Project / Compiler Options / Code / Target OS (-T): Linux
* Set in Project / Compiler Options / Code / Target CPU family (-P): arm

That all folks :roll:


Hat das hier schon 'mal jemand probiert ?

-Michael
mschnell
 
Beiträge: 3243
Registriert: 11. Sep 2006, 09:24
Wohnort: Krefeld
OS, Lazarus, FPC: svn (Window32, Linux x64, Linux ARM (QNAP) (cross+nativ) | 
CPU-Target: X32 / X64 / ARMv5
Nach oben

Beitragvon Scotty » 14. Jan 2010, 12:07 Re: [Tutorial] Cross Compile for arm-linux (Finally it works!)

Ich habe etwa gleichzeitig mit Kjoow (der originale Thread-Ersteller und Basis für fredvs' Beitrag) einen Compiler für ARM (in meinem Fall kein Maemo sondern ein Sheeva-Plug) gebaut. Ich kann Kjoows Tutorial nur bedingt empfehlen, fredvs' ist etwas besser, und habe in diesem Thread relativ weit vorn meine Prozedur beschrieben. Ich kann jedenfalls nach Hilfe von Jonas Maebe (http://forum.lazarus.freepascal.org/ind ... 057.0.html) problemlos für ARM kompilieren.
Scotty
 
Beiträge: 770
Registriert: 4. Mai 2009, 12:24
OS, Lazarus, FPC: Arch Linux, Lazarus 1.3 r44426M FPC 2.6.4 | 
CPU-Target: x86_64-linux-qt/gtk2
Nach oben

• Themenende •

Zurück zu Ankündigungen



Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 4 Gäste

porpoises-institution
accuracy-worried