Project

General

Profile

Environment » History » Version 24

« Previous - Version 24/25 (diff) - Next » - Current version
Roger Pueyo Centelles, 01/05/2014 08:31 PM


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

Development Environment

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:

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

And if your machine is x86_64 you will need 32 bit development files.
In Debian/Ubuntu:

sudo aptitude install gcc-multilib

In CentOS/Fedora/RHEL the packets:

gcc.i686, libgcc.i686, and glibc-devel.i686

Get the code and compile

  • [Recomended] Get the qMp firmware generator using git:
    git clone git://qmp.cat/qmpfw.git qmpfw
  • [Outdated] Or get the code using http:
    wget -c -q -O - "http://qmp.cat/gitrevision_download?project_id=7&rev=anonymous" | tar zxvf -
  • Then enter to source directory:
    cd qmpfw
  • [Advanced] Do a checkout specifying the branch:
    make .checkout_qmp QMP_GIT_BRANCH=branch_name

Example for testing branch:

make .checkout_qmp QMP_GIT_BRANCH=testing

  • And compile it specifying the target:
    make build T=alix

You can find available targets by executing:

make list_targets

If you have more than one core in your computer you can use J=N:

make build T=alix J=4

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

Compiling qMp from a previous git revision 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, do the following:

  • Get the qMp firmware generator using git:
    git clone git://qmp.cat/qmpfw.git qmpfw-r944c45d
  • Enter the source directory:
    cd qmpfw-r944c45d
  • Do a checkout specifying the revision:
    make .checkout_qmp QMP_GIT_BRANCH=%GIT_REVISION%

Example for revision 944c45d:

make .checkout_qmp QMP_GIT_BRANCH=944c45d

The result is:

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".

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

git --git-dir=build/qmp/.git branch

* (detached from 944c45d)
  master

A new local branch must be created. Otherwise compilation will most surely fail. The new local branch can be named pladebarris:

git --git-dir=build/qmp/.git checkout -b pladebarris

[...]
Switched to a new branch 'pladebarris'
  • [Optional] qMp is based on OpenWrt, which is also developed using revisions. The qMp firmware build process downloads, by default, the stable OpenWrt release with the latest revision (as of 4th January 2014, Attitude Adjustment revision 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

OWRT_SVN_REV = 36842

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

[...]

define checkout_src
        svn --quiet co $(OWRT_SVN) $(BUILD_PATH)

[...]

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

[...]

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

[...]

for

[...]

define checkout_src
        svn --quiet co --revision=$(OWRT_SVN_REV) $(OWRT_SVN) $(BUILD_PATH)

[...]

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

[...]

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

[...]
  • And compile it specifying the target (follow the instructions above). For a Nanostation M5:
    make build T=nsm5

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