Howto build » History » Version 9
Oleksandr Rybalko, 11/14/2018 03:14 PM
1 | 1 | Eric Krausser | h1. Howto build |
---|---|---|---|
2 | 1 | Eric Krausser | |
3 | 1 | Eric Krausser | h2. Fetch sources |
4 | 1 | Eric Krausser | |
5 | 9 | Oleksandr Rybalko | Check out the ZRouter source code with git or by fetching "the latest ZRouter sources":https://github.com/ZRouter/ZRouter/archive/master.zip ("as zip":https://github.com/ZRouter/ZRouter/archive/master.zip) |
6 | 1 | Eric Krausser | |
7 | 1 | Eric Krausser | For this tutorial we expect you check out / unpack the sources to @/projects/ZRouter/zrouter@. |
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/FreeBSD@. |
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 @make@. |
42 | 7 | Oleksandr Rybalko | If you want to have ability to override that variable, assign it with *?=*, |
43 | 7 | Oleksandr Rybalko | this will allow you to set variable at @make@(1) command line. |
44 | 7 | Oleksandr Rybalko | |
45 | 7 | Oleksandr Rybalko | For example, very useful to have TARGET_PAIR override-able, then you |
46 | 7 | Oleksandr Rybalko | will be able build image for different devices by call @make@(1) with |
47 | 7 | Oleksandr Rybalko | additional variable TARGET_PAIR=other/device. So place into |
48 | 7 | Oleksandr Rybalko | Makefile.local.opts following line: |
49 | 7 | Oleksandr Rybalko | <pre> |
50 | 7 | Oleksandr Rybalko | TARGET_PAIR?=D-Link/DIR-320 |
51 | 7 | Oleksandr Rybalko | </pre> |
52 | 7 | Oleksandr Rybalko | and now if you run @make@(1) w/o variables you will have image for D-Link DIR-320. |
53 | 7 | Oleksandr Rybalko | But if you run @make TARGET_PAIR?=D-Link/DIR-620@, you will have image for DIR-620. |