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