Projecte

General

Perfil

Environment » Historial » Versió 19

Roger Pueyo Centelles, 04-01-2014 19:51
Com compilar una imatge per al pla de barris amb la revisió que s'està emprant actualment

1 18 Jorge L. Florit
http://qmp.cat/Development
2
TO DO: mantain this page in the main site. Only tricks or hack articles recommended in the wiki.
3
4
5
6 12 Victor Oncins
h1. Development Environment
7 1 Pau Escrich
8 14 Pau Escrich
h3. Get the needed software
9
10 15 Simó Albert i Beltran
First of all you should take a look on the system requirements:
11
12 2 Pau Escrich
In a Debian based distributions (like Ubuntu), a set of packages are needed, you should install them:
13 6 Pau Escrich
14
<pre>
15 17 Jorge L. Florit
sudo aptitude install \
16 10 Simó Albert i Beltran
git subversion zlib1g-dev gawk flex unzip bzip2 gettext build-essential \
17 16 Simó Albert i Beltran
libncurses5-dev libncursesw5-dev binutils cpp psmisc docbook-to-man
18 1 Pau Escrich
</pre>
19 17 Jorge L. Florit
20
And if your machine is x86_64 you will need 32 bit development files.
21
In Debian/Ubuntu:
22
<pre>sudo aptitude install gcc-multilib</pre>
23
24
In CentOS/Fedora/RHEL the packets:
25
<pre>gcc.i686, libgcc.i686, and glibc-devel.i686</pre>
26
27
28
29 14 Pau Escrich
30
h3. Get the code and compile
31 1 Pau Escrich
32 15 Simó Albert i Beltran
* [Recomended] Get the qMp firmware generator using git: <pre>git clone git://qmp.cat/qmpfw.git qmpfw</pre>
33 1 Pau Escrich
34 15 Simó Albert i Beltran
* [Outdated] Or get the code using http: <pre>wget -c -q -O - "http://qmp.cat/gitrevision_download?project_id=7&rev=anonymous" | tar zxvf -</pre>
35
36 1 Pau Escrich
* Then enter to source directory: <pre>cd qmpfw</pre>
37
38 15 Simó Albert i Beltran
* [Advanced] Do a checkout specifying the branch: <pre>make .checkout_qmp QMP_GIT_BRANCH=branch_name</pre>
39
40
Example for testing branch: <pre>make .checkout_qmp QMP_GIT_BRANCH=testing</pre>
41 14 Pau Escrich
42
* And compile it specifying the target: <pre>make build T=alix</pre>
43
44
You can find available targets by executing: <pre>make list_targets</pre>
45
46
If you have more than one core in your computer you can use J=N: <pre>make build T=alix J=4</pre>
47
48
After that, you will find the images ready to install in your devices inside directory images/
49 19 Roger Pueyo Centelles
50
51
52
53
h3. Compiling qMp from a "previous git revision":http://dev.qmp.cat/projects/qmp/repository of the source code
54
55
To ensure maximum compatibility between the nodes in a network, all of them should run the same qMp firmware version (or, at least, very similar ones). To compile the firmware from a previous release (for example, "revision 944c45d":http://dev.qmp.cat/projects/qmp/repository/show?branch=master-bugfixes&rev=944c45d, do the following:
56
57
* Get the qMp firmware generator using git: <pre>git clone git://qmp.cat/qmpfw.git qmpfw-r944c45d</pre>
58
59
* Enter the source directory: <pre>cd qmpfw-r944c45d</pre>
60
61
* Do a checkout specifying the revision: <pre>make .checkout_qmp QMP_GIT_BRANCH=%GIT_REVISION%</pre>
62
63
Example for revision 944c45d: <pre>make .checkout_qmp QMP_GIT_BRANCH=944c45d</pre>
64
65
The result is:
66
<pre>
67
git clone git://qmp.cat/qmp.git build/qmp
68
Cloning into 'build/qmp'...
69
remote: Counting objects: 8822, done.
70
remote: Compressing objects: 100% (4160/4160), done.
71
remote: Total 8822 (delta 4060), reused 7827 (delta 3544)
72
Receiving objects: 100% (8822/8822), 2.03 MiB | 670.00 KiB/s, done.
73
Resolving deltas: 100% (4060/4060), done.
74
Checking connectivity... done.
75
cd build/qmp; git checkout 944c45d; cd ..
76
Note: checking out '944c45d'.
77
78
You are in 'detached HEAD' state. You can look around, make experimental
79
changes and commit them, and you can discard any commits you make in this
80
state without impacting any branches by performing another checkout.
81
82
If you want to create a new branch to retain commits you create, you may
83
do so (now or later) by using -b with the checkout command again. Example:
84
85
  git checkout -b new_branch_name
86
87
HEAD is now at 944c45d... Import "Fix typo in RouterStationPro switch configuration".
88
</pre>
89
90
However, git now is not in a branch, but in a detached state:
91
92
<pre>
93
git --git-dir=build/qmp/.git branch
94
95
* (detached from 944c45d)
96
  master
97
</pre>
98
99
A new local branch must be created. Otherwise compilation will most surely fail. The new local branch can be named "pladebarris":http://www.guifi.net/raval:
100
101
<pre>
102
git --git-dir=build/qmp/.git checkout -b pladebarris
103
104
[...]
105
Switched to a new branch 'pladebarris'
106
</pre>
107
108
* And compile it specifying the target: <pre>make build T=nsm5</pre>
109
110
After that, you will find the images ready to install in your devices inside directory images/