Project

General

Profile

Howto build » History » Version 8

Gordon Shumway, 02/23/2012 03:41 PM
Add note about host settings influencing the build

1 1 Eric Krausser
h1. Howto build
2 1 Eric Krausser
3 1 Eric Krausser
h2. Fetch sources
4 1 Eric Krausser
5 4 Eric Krausser
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)
6 1 Eric Krausser
7 1 Eric Krausser
For this tutorial we expect you check out / unpack the sources to @/projects/ZRouter/[email protected]
8 1 Eric Krausser
9 1 Eric Krausser
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.
10 1 Eric Krausser
11 3 Eric Krausser
Get it via Mercurial or by fetching "ZRouter's patched FreeBSD sources":http://archive.zrouter.org/nightly/FreeBSD-zrouter-head-latest.tgz
12 5 Eric Krausser
13 5 Eric Krausser
For this tutorial we expect you check out / unpack the modified FreeBSD sources to @/projects/ZRouter/[email protected]
14 5 Eric Krausser
15 5 Eric Krausser
h2. Build
16 5 Eric Krausser
17 8 Gordon Shumway
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]]).
18 1 Eric Krausser
19 8 Gordon Shumway
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.
20 8 Gordon Shumway
21 5 Eric Krausser
As root do:
22 1 Eric Krausser
<pre>
23 5 Eric Krausser
cd /projects/ZRouter/zrouter
24 8 Gordon Shumway
env __MAKE_CONF=/dev/null SRCCONF=/dev/null make FREEBSD_SRC_TREE=/projects/ZRouter/FreeBSD/head TARGET_PAIR=D-Link/DIR-320
25 5 Eric Krausser
</pre>
26 6 Eric Krausser
27 6 Eric Krausser
h2. Customize the build
28 6 Eric Krausser
29 6 Eric Krausser
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:
30 6 Eric Krausser
31 6 Eric Krausser
e.g. /projects/ZRouter/zrouter/Makefile.local.opts
32 6 Eric Krausser
<pre>
33 6 Eric Krausser
FREEBSD_SRC_TREE=/projects/ZRouter/FreeBSD/head
34 6 Eric Krausser
35 6 Eric Krausser
# override default /usr/obj
36 6 Eric Krausser
OBJ_DIR=/projects/ZRouter/obj
37 6 Eric Krausser
38 6 Eric Krausser
TARGET_PAIR=D-Link/DIR-320
39 6 Eric Krausser
</pre>
40 6 Eric Krausser
41 6 Eric Krausser
Now just run @[email protected]
42 7 Aleksandr Rybalko
If you want to have ability to override that variable, assign it with *?=*,
43 7 Aleksandr Rybalko
this will allow you to set variable at @[email protected](1) command line.
44 7 Aleksandr Rybalko
45 7 Aleksandr Rybalko
For example, very useful to have TARGET_PAIR override-able, then you
46 7 Aleksandr Rybalko
will be able build image for different devices by call @[email protected](1) with
47 7 Aleksandr Rybalko
additional variable TARGET_PAIR=other/device. So place into
48 7 Aleksandr Rybalko
Makefile.local.opts following line:
49 7 Aleksandr Rybalko
<pre>
50 7 Aleksandr Rybalko
TARGET_PAIR?=D-Link/DIR-320
51 7 Aleksandr Rybalko
</pre>
52 7 Aleksandr Rybalko
and now if you run @[email protected](1) w/o variables you will have image for D-Link DIR-320.
53 7 Aleksandr Rybalko
But if you run @make TARGET_PAIR?=D-Link/[email protected], you will have image for DIR-620.