Project

General

Profile

Howto build » History » Version 8

Version 7 (Oleksandr Rybalko, 01/17/2012 11:29 AM) → Version 8/9 (Gordon Shumway, 02/23/2012 03:41 PM)

h1. Howto build

h2. Fetch sources

Check out the ZRouter source code with Mercurial hg or by fetching "the latest ZRouter sources":http://zrouter.org/hg/zrouter/archive/tip.tar.bz2 ("as zip":http://zrouter.org/hg/zrouter/archive/tip.zip)

For this tutorial we expect you check out / unpack the sources to @/projects/ZRouter/zrouter@.

For now you also need our patched FreeBSD sources. We work on getting this patches back to official FreeBSD-HEAD, so one day this step will be obsolete.

Get it via Mercurial or by fetching "ZRouter's patched FreeBSD sources":http://archive.zrouter.org/nightly/FreeBSD-zrouter-head-latest.tgz

For this tutorial we expect you check out / unpack the modified FreeBSD sources to @/projects/ZRouter/FreeBSD@.

h2. Build

For this tutorial we expect you want to build a firmware for a device from vendor D-Link, the model is DIR-320 (see [[Supported devices]]).

Watch out for the host having settings in /etc/make.conf or /etc/src.conf that might influence the ZRouter build. It is recommended to set __MAKE_CONF and SRCCONF to /dev/null in order to make the build process ignore any host settings.



As root do:
<pre>
cd /projects/ZRouter/zrouter
env __MAKE_CONF=/dev/null SRCCONF=/dev/null make FREEBSD_SRC_TREE=/projects/ZRouter/FreeBSD/head TARGET_PAIR=D-Link/DIR-320
</pre>

h2. Customize the build

You can create the file _Makefile.local.opts_ in your ZRouter's home with predefined variables, so you can skip to specify them with every make run:

e.g. /projects/ZRouter/zrouter/Makefile.local.opts
<pre>
FREEBSD_SRC_TREE=/projects/ZRouter/FreeBSD/head

# override default /usr/obj
OBJ_DIR=/projects/ZRouter/obj

TARGET_PAIR=D-Link/DIR-320
</pre>

Now just run @make@.
If you want to have ability to override that variable, assign it with *?=*,
this will allow you to set variable at @make@(1) command line.

For example, very useful to have TARGET_PAIR override-able, then you
will be able build image for different devices by call @make@(1) with
additional variable TARGET_PAIR=other/device. So place into
Makefile.local.opts following line:
<pre>
TARGET_PAIR?=D-Link/DIR-320
</pre>
and now if you run @make@(1) w/o variables you will have image for D-Link DIR-320.
But if you run @make TARGET_PAIR?=D-Link/DIR-620@, you will have image for DIR-620.