Projecte

General

Perfil

Environment » Historial » Revisió 22

Revisió 21 (Roger Pueyo Centelles, 04-01-2014 23:31) → Revisió 22/25 (Roger Pueyo Centelles, 05-01-2014 14:59)

http://qmp.cat/Development 
 TO DO: mantain this page in the main site. Only tricks or hack articles recommended in the wiki. 



 h1. Development Environment 

 h3. Get the needed software 

 First of all you should take a look on the system requirements: 

 In a Debian based distributions (like Ubuntu), a set of packages are needed, you should install them: 

 <pre> 
 sudo aptitude install \ 
 git subversion zlib1g-dev gawk flex unzip bzip2 gettext build-essential \ 
 libncurses5-dev libncursesw5-dev binutils cpp psmisc docbook-to-man 
 </pre> 

 And if your machine is x86_64 you will need 32 bit development files. 
 In Debian/Ubuntu: 
 <pre>sudo aptitude install gcc-multilib</pre> 

 In CentOS/Fedora/RHEL the packets: 
 <pre>gcc.i686, libgcc.i686, and glibc-devel.i686</pre> 




 h3. Get the code and compile 

 * [Recomended] Get the qMp firmware generator using git: <pre>git clone git://qmp.cat/qmpfw.git qmpfw</pre> 

 * [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> 

 * Then enter to source directory: <pre>cd qmpfw</pre> 

 * [Advanced] Do a checkout specifying the branch: <pre>make .checkout_qmp QMP_GIT_BRANCH=branch_name</pre> 

 Example for testing branch: <pre>make .checkout_qmp QMP_GIT_BRANCH=testing</pre> 

 * And compile it specifying the target: <pre>make build T=alix</pre> 

 You can find available targets by executing: <pre>make list_targets</pre> 

 If you have more than one core in your computer you can use J=N: <pre>make build T=alix J=4</pre> 

 After that, you will find the images ready to install in your devices inside directory images/ 




 h3(#compiling_previous_revision). h3. Compiling qMp from a "previous git revision":http://dev.qmp.cat/projects/qmp/repository of the source code 

 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: 

 * Get the qMp firmware generator using git: <pre>git clone git://qmp.cat/qmpfw.git qmpfw-r944c45d</pre> 

 * Enter the source directory: <pre>cd qmpfw-r944c45d</pre> 

 * Do a checkout specifying the revision: <pre>make .checkout_qmp QMP_GIT_BRANCH=%GIT_REVISION%</pre> 

 Example for revision 944c45d: <pre>make .checkout_qmp QMP_GIT_BRANCH=944c45d</pre> 

 The result is: 
 <pre> 
 git clone git://qmp.cat/qmp.git build/qmp 
 Cloning into 'build/qmp'... 
 remote: Counting objects: 8822, done. 
 remote: Compressing objects: 100% (4160/4160), done. 
 remote: Total 8822 (delta 4060), reused 7827 (delta 3544) 
 Receiving objects: 100% (8822/8822), 2.03 MiB | 670.00 KiB/s, done. 
 Resolving deltas: 100% (4060/4060), done. 
 Checking connectivity... done. 
 cd build/qmp; git checkout 944c45d; cd .. 
 Note: checking out '944c45d'. 

 You are in 'detached HEAD' state. You can look around, make experimental 
 changes and commit them, and you can discard any commits you make in this 
 state without impacting any branches by performing another checkout. 

 If you want to create a new branch to retain commits you create, you may 
 do so (now or later) by using -b with the checkout command again. Example: 

   git checkout -b new_branch_name 

 HEAD is now at 944c45d... Import "Fix typo in RouterStationPro switch configuration". 
 </pre> 

 However, git now is not in a branch, but in a detached state: 

 <pre> 
 git --git-dir=build/qmp/.git branch 

 * (detached from 944c45d) 
   master 
 </pre> 

 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: 

 <pre> 
 git --git-dir=build/qmp/.git checkout -b pladebarris 

 [...] 
 Switched to a new branch 'pladebarris' 
 </pre> 

 * [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: 

 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 
 <pre> 
 OWRT_SVN_REV = 36842 
 </pre> 

 Then add the OpenWrt revision declaration in every _svn co $(OWRT_SVN)..._ or _svn co ${OWRT_PKG_SVN}..._ command inside the Makefile: 

 <pre> 
 [...] 

 define checkout_src 
         svn co $(OWRT_SVN) $(BUILD_PATH) 
 [...] 

 define checkout_owrt_pkg_override 
         svn co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET) 

 [...] 

 .checkout_owrt_pkg: 
         svn co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages 

 [...] 
 </pre> 

 for 

 <pre> 
 [...] 

 define checkout_src 
         svn co --revision=$(OWRT_SVN_REV) $(OWRT_SVN) $(BUILD_PATH) 
 [...] 

 define checkout_owrt_pkg_override 
         svn co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET) 

 [...] 

 .checkout_owrt_pkg: 
         svn co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages 

 [...] 
 </pre> 

 * And compile it specifying the target: <pre>make build T=nsm5</pre> 

 After that, you will find the images ready to install in your devices inside directory images/