ARM cross-compiler » History » Version 1
Vanč Levstik, 14.01.2011 14:58
1 | 1 | Vanč Levstik | h1. Tutorial for cross-compiling for our ARM processor. |
---|---|---|---|
2 | |||
3 | Just a short tutorial helping you build Buildroot that compiles programs for ARM. It is made for Ubuntu Linux, but should work on other distros too. |
||
4 | |||
5 | h2. To build the Buildroot |
||
6 | |||
7 | With @apt-get install@, you should get yourself following packages (you probably have some of them already, but just to be sure): |
||
8 | *build-essential - this installs a complete build environment |
||
9 | *libssl-dev |
||
10 | *libncurses-dev |
||
11 | *bison |
||
12 | *flex |
||
13 | *texinfo |
||
14 | *zlib1g-dev |
||
15 | *gettext |
||
16 | *autoconf |
||
17 | *wget |
||
18 | *patch |
||
19 | |||
20 | Then you should set your shell to bash instead of dash, you do this with: |
||
21 | @#sudo dpkg-reconfigure dash@ |
||
22 | And then select No |
||
23 | |||
24 | h2. Getting and compiling Buildroot |
||
25 | |||
26 | You can get our Buildroot here: "Buildroot-FRISMS":http://laps.fri.uni-lj.si/fri-sms/datoteke/buildroot-2009.11-fri.tar.bz2 |
||
27 | Then you just extract the Buildroot, move into that folder and do: |
||
28 | #make |
||
29 | Compiling takes some time, check that there are no errors. |
||
30 | |||
31 | h2. Compiling our programs |
||
32 | |||
33 | After compiling Buildroot is done, you should add: @\PATH_TO_YOUR_FOLDER\buildroot-2009.11-fri\output\staging\bin@ into your enviroment variable (PATH) |
||
34 | Then your Makefile for compiling programs should look something like this (made for simple helloworld with name main.c): |
||
35 | |||
36 | <pre> |
||
37 | CC=arm-linux-gcc |
||
38 | CFLAGS=-I. --sysroot=/PATH_TO_YOUR_FOLDER/buildroot-2009.11-fri/output/staging |
||
39 | OBJ=main.o |
||
40 | |||
41 | %.o: %.c |
||
42 | $(CC) -c -o $@ $< $(CFLAGS) |
||
43 | main: $(OBJ) |
||
44 | $(CC) -o $@ $^ $(CFLAGS) |
||
45 | .PHONY: clean |
||
46 | clean: |
||
47 | rm -f *.o *~ main |
||
48 | </pre> |