Environment » Historial » Versió 23
Roger Pueyo Centelles, 05-01-2014 20:30
| 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 | 23 | Roger Pueyo Centelles | svn --quiet co $(OWRT_SVN) $(BUILD_PATH) |
| 122 | |||
| 123 | 21 | Roger Pueyo Centelles | [...] |
| 124 | 1 | Pau Escrich | |
| 125 | 21 | Roger Pueyo Centelles | define checkout_owrt_pkg_override |
| 126 | 23 | Roger Pueyo Centelles | svn --quiet co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET) |
| 127 | 21 | Roger Pueyo Centelles | |
| 128 | 1 | Pau Escrich | [...] |
| 129 | 21 | Roger Pueyo Centelles | |
| 130 | .checkout_owrt_pkg: |
||
| 131 | 23 | Roger Pueyo Centelles | svn --quiet co ${OWRT_PKG_SVN} $(BUILD_DIR)/packages |
| 132 | 21 | Roger Pueyo Centelles | |
| 133 | [...] |
||
| 134 | </pre> |
||
| 135 | |||
| 136 | for |
||
| 137 | |||
| 138 | 1 | Pau Escrich | <pre> |
| 139 | [...] |
||
| 140 | 21 | Roger Pueyo Centelles | |
| 141 | define checkout_src |
||
| 142 | 23 | Roger Pueyo Centelles | svn --quiet co --revision=$(OWRT_SVN_REV) $(OWRT_SVN) $(BUILD_PATH) |
| 143 | |||
| 144 | 21 | Roger Pueyo Centelles | [...] |
| 145 | |||
| 146 | 1 | Pau Escrich | define checkout_owrt_pkg_override |
| 147 | 23 | Roger Pueyo Centelles | svn --quiet co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages.$(TARGET) |
| 148 | 21 | Roger Pueyo Centelles | |
| 149 | [...] |
||
| 150 | |||
| 151 | .checkout_owrt_pkg: |
||
| 152 | 23 | Roger Pueyo Centelles | svn --quiet co --revision=$(OWRT_SVN_REV) ${OWRT_PKG_SVN} $(BUILD_DIR)/packages |
| 153 | 21 | Roger Pueyo Centelles | |
| 154 | [...] |
||
| 155 | </pre> |
||
| 156 | 20 | Roger Pueyo Centelles | |
| 157 | 19 | Roger Pueyo Centelles | * And compile it specifying the target: <pre>make build T=nsm5</pre> |
| 158 | |||
| 159 | After that, you will find the images ready to install in your devices inside directory images/ |