Environment » Historial » Versió 22
Roger Pueyo Centelles, 05-01-2014 14:59
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 | 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 |
54 | 19 | Roger Pueyo Centelles | |
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 | 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: |
109 | |||
110 | 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 |
||
111 | <pre> |
||
112 | OWRT_SVN_REV = 36842 |
||
113 | </pre> |
||
114 | |||
115 | Then add the OpenWrt revision declaration in every _svn co $(OWRT_SVN)..._ or _svn co ${OWRT_PKG_SVN}..._ command inside the Makefile: |
||
116 | |||
117 | <pre> |
||
118 | [...] |
||
119 | |||
120 | define checkout_src |
||
121 | svn co $(OWRT_SVN) $(BUILD_PATH) |
||
122 | [...] |
||
123 | |||
124 | define checkout_owrt_pkg_override |
||
125 | svn co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET) |
||
126 | |||
127 | [...] |
||
128 | |||
129 | .checkout_owrt_pkg: |
||
130 | svn co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages |
||
131 | |||
132 | [...] |
||
133 | </pre> |
||
134 | |||
135 | for |
||
136 | |||
137 | <pre> |
||
138 | [...] |
||
139 | |||
140 | define checkout_src |
||
141 | svn co --revision=$(OWRT_SVN_REV) $(OWRT_SVN) $(BUILD_PATH) |
||
142 | [...] |
||
143 | |||
144 | define checkout_owrt_pkg_override |
||
145 | svn co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET) |
||
146 | |||
147 | [...] |
||
148 | |||
149 | .checkout_owrt_pkg: |
||
150 | svn co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages |
||
151 | |||
152 | [...] |
||
153 | </pre> |
||
154 | 20 | Roger Pueyo Centelles | |
155 | 19 | Roger Pueyo Centelles | * And compile it specifying the target: <pre>make build T=nsm5</pre> |
156 | |||
157 | After that, you will find the images ready to install in your devices inside directory images/ |