Compile Manually

Version 6 (Ilario Gelmetti, 08/02/2014 06:35 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 1 Gioacchino Mazzurco
*Download trunk version of OpenWrt* (Attitude Adjustment isn't supported by Libre-Mesh).
20 1 Gioacchino Mazzurco
21 4 Gioacchino Mazzurco
<pre>
22 4 Gioacchino Mazzurco
git clone git://git.openwrt.org/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 4 Gioacchino Mazzurco
<pre>
37 4 Gioacchino Mazzurco
src-git lime https://github.com/libre-mesh/lime-packages.git;develop
38 4 Gioacchino Mazzurco
</pre>
39 2 Ilario Gelmetti
40 2 Ilario Gelmetti
Download all these packages and put sources in the right place.
41 1 Gioacchino Mazzurco
42 4 Gioacchino Mazzurco
<pre>
43 4 Gioacchino Mazzurco
scripts/feeds update -a
44 4 Gioacchino Mazzurco
scripts/feeds install -a
45 4 Gioacchino Mazzurco
</pre>
46 2 Ilario Gelmetti
47 2 Ilario Gelmetti
Then enter the OpenWrt *configuration* menu.
48 2 Ilario Gelmetti
49 4 Gioacchino Mazzurco
<pre>
50 4 Gioacchino Mazzurco
make menuconfig
51 4 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 2 Ilario Gelmetti
Exit from "Base system" end *enter in "LiMe", select what you want* (for example everything or everything except reghack and lime-full), exit.
56 2 Ilario Gelmetti
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 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. 
60 2 Ilario Gelmetti
61 4 Gioacchino Mazzurco
<pre>
62 6 Ilario Gelmetti
make -j 3
63 4 Gioacchino Mazzurco
</pre>
64 1 Gioacchino Mazzurco
65 6 Ilario Gelmetti
But if you encounter some errors (maybe related to network connectivity problems) it's better to clean up with
66 2 Ilario Gelmetti
67 4 Gioacchino Mazzurco
<pre>
68 6 Ilario Gelmetti
make clean
69 4 Gioacchino Mazzurco
</pre>
70 2 Ilario Gelmetti
71 6 Ilario Gelmetti
and compile without the -j option.
72 1 Gioacchino Mazzurco
73 1 Gioacchino Mazzurco
<pre>
74 6 Ilario Gelmetti
make
75 4 Gioacchino Mazzurco
</pre>
76 2 Ilario Gelmetti
77 2 Ilario Gelmetti
Flash on your devices and enjoy!
78 1 Gioacchino Mazzurco
79 1 Gioacchino Mazzurco
80 6 Ilario Gelmetti
81 6 Ilario Gelmetti
82 5 Ilario Gelmetti
h2. Updating a previous compilation of Libre-Mesh
83 5 Ilario Gelmetti
84 5 Ilario Gelmetti
Enter the base directory of the previous compiled image, for example
85 5 Ilario Gelmetti
86 5 Ilario Gelmetti
<pre>
87 5 Ilario Gelmetti
cd ~/openwrt
88 5 Ilario Gelmetti
</pre>
89 5 Ilario Gelmetti
90 5 Ilario Gelmetti
Remove the unnecessary previously compiled files.
91 5 Ilario Gelmetti
92 5 Ilario Gelmetti
<pre>
93 5 Ilario Gelmetti
make clean
94 5 Ilario Gelmetti
</pre>
95 5 Ilario Gelmetti
96 5 Ilario Gelmetti
Update the OpenWrt source code.
97 5 Ilario Gelmetti
98 5 Ilario Gelmetti
<pre>
99 5 Ilario Gelmetti
git pull
100 5 Ilario Gelmetti
</pre>
101 5 Ilario Gelmetti
102 5 Ilario Gelmetti
Update the Libre-Mesh package source code.
103 5 Ilario Gelmetti
104 5 Ilario Gelmetti
<pre>
105 5 Ilario Gelmetti
scripts/feeds update -a
106 5 Ilario Gelmetti
scripts/feeds install -a
107 5 Ilario Gelmetti
</pre>
108 5 Ilario Gelmetti
109 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. 
110 5 Ilario Gelmetti
111 5 Ilario Gelmetti
<pre>
112 6 Ilario Gelmetti
make -j 3
113 5 Ilario Gelmetti
</pre>
114 5 Ilario Gelmetti
115 6 Ilario Gelmetti
If you encounter some errors try compiling without the -j option or cleaning completely the installation environment
116 5 Ilario Gelmetti
117 5 Ilario Gelmetti
<pre>
118 5 Ilario Gelmetti
make clean
119 5 Ilario Gelmetti
make dirclean
120 5 Ilario Gelmetti
rm -rf feeds/*
121 5 Ilario Gelmetti
</pre>
122 5 Ilario Gelmetti
123 5 Ilario Gelmetti
and restart from the top of this section about updating.