Project

General

Profile

Environment » History » Version 25

Jorge L. Florit, 02/12/2014 09:07 PM

1 1 Pau Escrich
h1. Development Environment
2 18 Jorge L. Florit
3 1 Pau Escrich
4 25 Jorge L. Florit
To know how to set the basics for the development go to: http://qmp.cat/Development
5 14 Pau Escrich
6 25 Jorge L. Florit
_Note: only tricks or hack articles in this wiki._
7 19 Roger Pueyo Centelles
8 19 Roger Pueyo Centelles
9 19 Roger Pueyo Centelles
10 22 Roger Pueyo Centelles
h3(#compiling_previous_revision). Compiling qMp from a "previous git revision":http://dev.qmp.cat/projects/qmp/repository of the source code
11 19 Roger Pueyo Centelles
12 19 Roger Pueyo Centelles
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:
13 19 Roger Pueyo Centelles
14 19 Roger Pueyo Centelles
* Get the qMp firmware generator using git: <pre>git clone git://qmp.cat/qmpfw.git qmpfw-r944c45d</pre>
15 19 Roger Pueyo Centelles
16 19 Roger Pueyo Centelles
* Enter the source directory: <pre>cd qmpfw-r944c45d</pre>
17 19 Roger Pueyo Centelles
18 19 Roger Pueyo Centelles
* Do a checkout specifying the revision: <pre>make .checkout_qmp QMP_GIT_BRANCH=%GIT_REVISION%</pre>
19 19 Roger Pueyo Centelles
20 19 Roger Pueyo Centelles
Example for revision 944c45d: <pre>make .checkout_qmp QMP_GIT_BRANCH=944c45d</pre>
21 19 Roger Pueyo Centelles
22 19 Roger Pueyo Centelles
The result is:
23 19 Roger Pueyo Centelles
<pre>
24 19 Roger Pueyo Centelles
git clone git://qmp.cat/qmp.git build/qmp
25 19 Roger Pueyo Centelles
Cloning into 'build/qmp'...
26 19 Roger Pueyo Centelles
remote: Counting objects: 8822, done.
27 19 Roger Pueyo Centelles
remote: Compressing objects: 100% (4160/4160), done.
28 19 Roger Pueyo Centelles
remote: Total 8822 (delta 4060), reused 7827 (delta 3544)
29 19 Roger Pueyo Centelles
Receiving objects: 100% (8822/8822), 2.03 MiB | 670.00 KiB/s, done.
30 19 Roger Pueyo Centelles
Resolving deltas: 100% (4060/4060), done.
31 19 Roger Pueyo Centelles
Checking connectivity... done.
32 19 Roger Pueyo Centelles
cd build/qmp; git checkout 944c45d; cd ..
33 19 Roger Pueyo Centelles
Note: checking out '944c45d'.
34 19 Roger Pueyo Centelles
35 19 Roger Pueyo Centelles
You are in 'detached HEAD' state. You can look around, make experimental
36 19 Roger Pueyo Centelles
changes and commit them, and you can discard any commits you make in this
37 19 Roger Pueyo Centelles
state without impacting any branches by performing another checkout.
38 19 Roger Pueyo Centelles
39 19 Roger Pueyo Centelles
If you want to create a new branch to retain commits you create, you may
40 19 Roger Pueyo Centelles
do so (now or later) by using -b with the checkout command again. Example:
41 19 Roger Pueyo Centelles
42 19 Roger Pueyo Centelles
  git checkout -b new_branch_name
43 19 Roger Pueyo Centelles
44 19 Roger Pueyo Centelles
HEAD is now at 944c45d... Import "Fix typo in RouterStationPro switch configuration".
45 19 Roger Pueyo Centelles
</pre>
46 19 Roger Pueyo Centelles
47 19 Roger Pueyo Centelles
However, git now is not in a branch, but in a detached state:
48 19 Roger Pueyo Centelles
49 19 Roger Pueyo Centelles
<pre>
50 19 Roger Pueyo Centelles
git --git-dir=build/qmp/.git branch
51 19 Roger Pueyo Centelles
52 19 Roger Pueyo Centelles
* (detached from 944c45d)
53 19 Roger Pueyo Centelles
  master
54 19 Roger Pueyo Centelles
</pre>
55 19 Roger Pueyo Centelles
56 19 Roger Pueyo Centelles
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:
57 19 Roger Pueyo Centelles
58 19 Roger Pueyo Centelles
<pre>
59 19 Roger Pueyo Centelles
git --git-dir=build/qmp/.git checkout -b pladebarris
60 19 Roger Pueyo Centelles
61 19 Roger Pueyo Centelles
[...]
62 19 Roger Pueyo Centelles
Switched to a new branch 'pladebarris'
63 19 Roger Pueyo Centelles
</pre>
64 19 Roger Pueyo Centelles
65 21 Roger Pueyo Centelles
* [Optional] qMp is based on "OpenWrt":http://www.openwrt.org, which is also developed using "revisions":https://dev.openwrt.org/timeline. The qMp firmware build process downloads, by default, the "stable OpenWrt release":http://wiki.openwrt.org/about/history with the latest revision (as of 4th January 2014, "Attitude Adjustment":https://dev.openwrt.org/browser/branches/attitude_adjustment "revision 39154":https://dev.openwrt.org/log/branches/attitude_adjustment?rev=39154. It might be possible that an old revision of qMp would not work with the latest OpenWrt revision. If, for any reason, the qMp firmware must be built from a previous OpenWrt revision, the Makefile file must be edited:
66 21 Roger Pueyo Centelles
67 21 Roger Pueyo Centelles
Uncomment the OWRT_SVN_REV variable and specify the desired OpenWrt revision, for example "r36842":https://dev.openwrt.org/log/branches/attitude_adjustment?rev=36842
68 21 Roger Pueyo Centelles
<pre>
69 21 Roger Pueyo Centelles
OWRT_SVN_REV = 36842
70 21 Roger Pueyo Centelles
</pre>
71 21 Roger Pueyo Centelles
72 21 Roger Pueyo Centelles
Then add the OpenWrt revision declaration in every _svn co $(OWRT_SVN)..._ or _svn co ${OWRT_PKG_SVN}..._ command inside the Makefile:
73 21 Roger Pueyo Centelles
74 21 Roger Pueyo Centelles
<pre>
75 21 Roger Pueyo Centelles
[...]
76 21 Roger Pueyo Centelles
77 21 Roger Pueyo Centelles
define checkout_src
78 23 Roger Pueyo Centelles
        svn --quiet co $(OWRT_SVN) $(BUILD_PATH)
79 23 Roger Pueyo Centelles
80 21 Roger Pueyo Centelles
[...]
81 1 Pau Escrich
82 21 Roger Pueyo Centelles
define checkout_owrt_pkg_override
83 23 Roger Pueyo Centelles
        svn --quiet co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET)
84 21 Roger Pueyo Centelles
85 1 Pau Escrich
[...]
86 21 Roger Pueyo Centelles
87 21 Roger Pueyo Centelles
.checkout_owrt_pkg:
88 23 Roger Pueyo Centelles
        svn --quiet co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages
89 21 Roger Pueyo Centelles
90 21 Roger Pueyo Centelles
[...]
91 21 Roger Pueyo Centelles
</pre>
92 21 Roger Pueyo Centelles
93 21 Roger Pueyo Centelles
for
94 21 Roger Pueyo Centelles
95 1 Pau Escrich
<pre>
96 1 Pau Escrich
[...]
97 21 Roger Pueyo Centelles
98 21 Roger Pueyo Centelles
define checkout_src
99 23 Roger Pueyo Centelles
        svn --quiet co --revision=$(OWRT_SVN_REV) $(OWRT_SVN) $(BUILD_PATH)
100 23 Roger Pueyo Centelles
101 21 Roger Pueyo Centelles
[...]
102 21 Roger Pueyo Centelles
103 1 Pau Escrich
define checkout_owrt_pkg_override
104 23 Roger Pueyo Centelles
        svn --quiet co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET)
105 21 Roger Pueyo Centelles
106 21 Roger Pueyo Centelles
[...]
107 21 Roger Pueyo Centelles
108 21 Roger Pueyo Centelles
.checkout_owrt_pkg:
109 23 Roger Pueyo Centelles
        svn --quiet co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages
110 21 Roger Pueyo Centelles
111 21 Roger Pueyo Centelles
[...]
112 21 Roger Pueyo Centelles
</pre>
113 20 Roger Pueyo Centelles
114 24 Roger Pueyo Centelles
* And compile it specifying the target (follow the instructions above). For a Nanostation M5: <pre>make build T=nsm5</pre>
115 19 Roger Pueyo Centelles
116 19 Roger Pueyo Centelles
After that, you will find the images ready to install in your devices inside directory images/