Compile Manually

Version 11 (Ilario Gelmetti, 05/31/2015 08:42 am)

1 1 Gioacchino Mazzurco
h1. Compile Manually
2 2 Ilario Gelmetti
3 5 Ilario Gelmetti
h2. Starting from a new compilation of OpenWrt
4 2 Ilario Gelmetti
5 2 Ilario Gelmetti
*Resources needed:*
6 2 Ilario Gelmetti
7 2 Ilario Gelmetti
Probably a Linux based operating system.
8 2 Ilario Gelmetti
9 2 Ilario Gelmetti
Some tools for the compilation process, on Debian:
10 2 Ilario Gelmetti
11 4 Gioacchino Mazzurco
<pre>
12 4 Gioacchino Mazzurco
apt-get install git build-essential libncurses5-dev zlib1g-dev gawk subversion
13 4 Gioacchino Mazzurco
</pre>
14 2 Ilario Gelmetti
15 2 Ilario Gelmetti
About 9 GB of disk space.
16 2 Ilario Gelmetti
17 2 Ilario Gelmetti
About 3 hours of compilation time.
18 2 Ilario Gelmetti
19 10 Gioacchino Mazzurco
*Download OpenWrt 14.07*.
20 1 Gioacchino Mazzurco
21 4 Gioacchino Mazzurco
<pre>
22 10 Gioacchino Mazzurco
git clone git://git.openwrt.org/14.07/openwrt.git
23 4 Gioacchino Mazzurco
</pre>
24 1 Gioacchino Mazzurco
25 1 Gioacchino Mazzurco
*Add our repositories* to the default ones.
26 4 Gioacchino Mazzurco
27 4 Gioacchino Mazzurco
<pre>
28 4 Gioacchino Mazzurco
cd openwrt
29 2 Ilario Gelmetti
cp feeds.conf.default feeds.conf
30 2 Ilario Gelmetti
echo "src-git libremap git://github.com/libremap/libremap-agent-openwrt.git" >> feeds.conf
31 4 Gioacchino Mazzurco
echo "src-git lime https://github.com/libre-mesh/lime-packages.git" >> feeds.conf
32 4 Gioacchino Mazzurco
</pre>
33 1 Gioacchino Mazzurco
34 2 Ilario Gelmetti
If you want to use a specific branch of lime-packages specify it adding ;nameofthebranch at the end of the last line. For example:
35 1 Gioacchino Mazzurco
36 1 Gioacchino Mazzurco
<pre>
37 1 Gioacchino Mazzurco
src-git lime https://github.com/libre-mesh/lime-packages.git;develop
38 1 Gioacchino Mazzurco
</pre>
39 1 Gioacchino Mazzurco
40 1 Gioacchino Mazzurco
Download all these packages and put sources in the right place.
41 1 Gioacchino Mazzurco
42 1 Gioacchino Mazzurco
<pre>
43 1 Gioacchino Mazzurco
scripts/feeds update -a
44 1 Gioacchino Mazzurco
scripts/feeds install -a
45 1 Gioacchino Mazzurco
</pre>
46 1 Gioacchino Mazzurco
47 1 Gioacchino Mazzurco
Then enter the OpenWrt *configuration* menu.
48 1 Gioacchino Mazzurco
49 1 Gioacchino Mazzurco
<pre>
50 1 Gioacchino Mazzurco
make menuconfig
51 1 Gioacchino Mazzurco
</pre>
52 1 Gioacchino Mazzurco
53 1 Gioacchino Mazzurco
Go in "Base system" and *deselect "dnsmasq"* (this is the IPv4 version which conflicts with Libre-Mesh, the IPv6 version will be automatically selected).
54 1 Gioacchino Mazzurco
55 1 Gioacchino Mazzurco
Exit from "Base system" end *enter in "LiMe", select what you want* (for example everything or everything except reghack and lime-full), exit.
56 1 Gioacchino Mazzurco
57 1 Gioacchino Mazzurco
If you need to compile images only for one type of devices you could specify the type in the menu "Target system" and "Target profile", otherwise keep the default and images for each profile will be produced. Exit and save.
58 1 Gioacchino Mazzurco
59 1 Gioacchino Mazzurco
Launch the *compilation*. The make -j [number] makes the compiler use multiple cores. If you have more than 2 cores, change to the appropriate number. 
60 1 Gioacchino Mazzurco
61 1 Gioacchino Mazzurco
<pre>
62 1 Gioacchino Mazzurco
make -j 3
63 1 Gioacchino Mazzurco
</pre>
64 1 Gioacchino Mazzurco
65 1 Gioacchino Mazzurco
But if you encounter some errors (maybe related to network connectivity problems) it's better to clean up with
66 1 Gioacchino Mazzurco
67 1 Gioacchino Mazzurco
<pre>
68 1 Gioacchino Mazzurco
make clean
69 1 Gioacchino Mazzurco
</pre>
70 1 Gioacchino Mazzurco
71 1 Gioacchino Mazzurco
and compile without the -j option.
72 1 Gioacchino Mazzurco
73 1 Gioacchino Mazzurco
<pre>
74 1 Gioacchino Mazzurco
make
75 1 Gioacchino Mazzurco
</pre>
76 4 Gioacchino Mazzurco
77 11 Ilario Gelmetti
Flash on your devices, optionally [[Configuration|change the default configuration]], and enjoy!
78 4 Gioacchino Mazzurco
79 9 Ilario Gelmetti
80 9 Ilario Gelmetti
h2. Using lime-build
81 9 Ilario Gelmetti
82 9 Ilario Gelmetti
*Resources needed:*
83 9 Ilario Gelmetti
84 9 Ilario Gelmetti
Probably a Linux based operating system.
85 9 Ilario Gelmetti
86 9 Ilario Gelmetti
Some tools for the compilation process, on Debian:
87 9 Ilario Gelmetti
88 9 Ilario Gelmetti
<pre>
89 9 Ilario Gelmetti
apt-get install git build-essential libncurses5-dev zlib1g-dev gawk subversion
90 9 Ilario Gelmetti
</pre>
91 9 Ilario Gelmetti
92 9 Ilario Gelmetti
About 9 GB of disk space.
93 9 Ilario Gelmetti
94 9 Ilario Gelmetti
About 3 hours of compilation time.
95 9 Ilario Gelmetti
96 9 Ilario Gelmetti
*Download* the *lime-build* source:
97 9 Ilario Gelmetti
98 9 Ilario Gelmetti
<pre>
99 9 Ilario Gelmetti
git clone https://github.com/libre-mesh/lime-build.git
100 9 Ilario Gelmetti
</pre>
101 9 Ilario Gelmetti
102 9 Ilario Gelmetti
Have a look at the list of devices supported by lime-build:
103 9 Ilario Gelmetti
104 9 Ilario Gelmetti
<pre>
105 9 Ilario Gelmetti
make list_targets
106 9 Ilario Gelmetti
</pre>
107 9 Ilario Gelmetti
108 9 Ilario Gelmetti
if you see your device you can continue with this guide, otherwise you have to use the instructions in the section "Starting from a new compilation of OpenWrt".
109 9 Ilario Gelmetti
110 9 Ilario Gelmetti
*Compile* specifying the *target device* in T= and roughly the number of CPU cores plus one in J=. That is, for compiling on a dual core computer the image for Ubiquiti NanoStation M5:
111 9 Ilario Gelmetti
112 9 Ilario Gelmetti
<pre>
113 9 Ilario Gelmetti
make J=3 T=nsm5 build
114 9 Ilario Gelmetti
</pre>
115 9 Ilario Gelmetti
116 9 Ilario Gelmetti
You'll find the compiled images in the directory images.
117 9 Ilario Gelmetti
118 9 Ilario Gelmetti
Other options for lime-build are documented here: https://github.com/libre-mesh/lime-build/blob/master/README.md
119 1 Gioacchino Mazzurco
120 6 Ilario Gelmetti
121 6 Ilario Gelmetti
122 5 Ilario Gelmetti
h2. Updating a previous compilation of Libre-Mesh
123 5 Ilario Gelmetti
124 5 Ilario Gelmetti
Enter the base directory of the previous compiled image, for example
125 5 Ilario Gelmetti
126 5 Ilario Gelmetti
<pre>
127 5 Ilario Gelmetti
cd ~/openwrt
128 5 Ilario Gelmetti
</pre>
129 5 Ilario Gelmetti
130 5 Ilario Gelmetti
Remove the unnecessary previously compiled files.
131 5 Ilario Gelmetti
132 5 Ilario Gelmetti
<pre>
133 5 Ilario Gelmetti
make clean
134 5 Ilario Gelmetti
</pre>
135 5 Ilario Gelmetti
136 5 Ilario Gelmetti
Update the OpenWrt source code.
137 5 Ilario Gelmetti
138 5 Ilario Gelmetti
<pre>
139 5 Ilario Gelmetti
git pull
140 5 Ilario Gelmetti
</pre>
141 5 Ilario Gelmetti
142 5 Ilario Gelmetti
Update the Libre-Mesh package source code.
143 5 Ilario Gelmetti
144 5 Ilario Gelmetti
<pre>
145 5 Ilario Gelmetti
scripts/feeds update -a
146 5 Ilario Gelmetti
scripts/feeds install -a
147 5 Ilario Gelmetti
</pre>
148 5 Ilario Gelmetti
149 6 Ilario Gelmetti
Launch the compilation. The make -j [number] makes the compiler use multiple cores. If you have more than 2 cores, change to the appropriate number. 
150 5 Ilario Gelmetti
151 5 Ilario Gelmetti
<pre>
152 6 Ilario Gelmetti
make -j 3
153 5 Ilario Gelmetti
</pre>
154 5 Ilario Gelmetti
155 6 Ilario Gelmetti
If you encounter some errors try compiling without the -j option or cleaning completely the installation environment
156 5 Ilario Gelmetti
157 5 Ilario Gelmetti
<pre>
158 5 Ilario Gelmetti
make clean
159 5 Ilario Gelmetti
make dirclean
160 5 Ilario Gelmetti
rm -rf feeds/*
161 5 Ilario Gelmetti
</pre>
162 5 Ilario Gelmetti
163 5 Ilario Gelmetti
and restart from the top of this section about updating.