Update documentation with AArch64 specifics
[armband.git] / docs / buildprocedure / build.instruction.rst
1 .. This document is protected/licensed under the following conditions
2 .. (c) Jonas Bjurel (Ericsson AB)
3 .. Licensed under a Creative Commons Attribution 4.0 International License.
4 .. You should have received a copy of the license along with this work.
5 .. If not, see <http://creativecommons.org/licenses/by/4.0/>.
6
7 ========
8 Abstract
9 ========
10
11 This document describes how to build the Fuel deployment tool for the
12 AArch64 Colorado release of OPNFV build system, dependencies and
13 required system resources.
14
15 ============
16 Introduction
17 ============
18
19 This document describes the build system used to build the Fuel
20 deployment tool for the AArch64 Colorado release of OPNFV, required
21 dependencies and minimum requirements on the host to be used for the
22 build system.
23
24 The Fuel build system is designed around Docker containers such that
25 dependencies outside of the build system can be kept to a minimum. It
26 also shields the host from any potential dangerous operations
27 performed by the build system.
28
29 The audience of this document is assumed to have good knowledge in
30 network and Unix/Linux administration.
31
32 Due to early docker and nodejs support on AArch64, we will still use an
33 x86_64 Fuel Master to build and deploy an AArch64 target pool, as well
34 as an x86_64 build machine for building the OPNFV ISO.
35
36 ============
37 Requirements
38 ============
39
40 Minimum Hardware Requirements
41 =============================
42
43 - ~50 GB available disc
44
45 - 4 GB RAM
46
47 Minimum Software Requirements
48 =============================
49
50 The build host should run Ubuntu 14.04 or 16.04 (x86_64) operating system.
51
52 On the host, the following packages must be installed:
53
54 - An x86_64 host (Bare-metal or VM) with Ubuntu 14.04 LTS installed
55
56   - **Note:** Builds on Wily (Ubuntu 15.x) are currently not supported
57   - A kernel equal- or later than 3.19 (Vivid), simply available through
58
59 .. code-block:: bash
60
61     $ sudo apt-get install linux-generic-lts-vivid
62
63 - docker - see https://docs.docker.com/installation/ubuntulinux/ for
64   installation notes for Ubuntu 14.04. Note: use the latest version from
65   Docker (docker-engine) and not the one in Ubuntu 14.04.
66
67 - git
68
69 - make
70
71 - curl
72
73 - fuseiso
74
75 Apart from docker, all other package requirements listed above are
76 simply available through:
77
78 .. code-block:: bash
79
80     $ sudo apt-get install git make curl fuseiso
81
82
83 ============
84 Preparations
85 ============
86
87 Setting up the Docker build container
88 =====================================
89
90 After having installed Docker, add yourself to the docker group:
91
92 .. code-block:: bash
93
94     $ sudo usermod -a -G docker [userid]
95
96 Also make sure to define relevant DNS servers part of the global
97 DNS chain in your </etc/default/docker> configuration file.
98 Uncomment, and modify the values appropriately.
99
100 For example:
101
102 .. code-block:: bash
103
104     DOCKER_OPTS=" --dns=8.8.8.8 --dns=8.8.8.4"
105
106 Then restart docker:
107
108 .. code-block:: bash
109
110     $ sudo service docker restart
111
112 Setting up OPNFV Gerrit in order to being able to clone the code
113 ----------------------------------------------------------------
114
115 - Start setting up OPNFV gerrit by creating a SSH key (unless you
116   don't already have one), create one with ssh-keygen
117
118 - Add your generated public key in OPNFV Gerrit (https://gerrit.opnfv.org/)
119   (this requires a Linux foundation account, create one if you do not
120   already have one)
121
122 - Select "SSH Public Keys" to the left and then "Add Key" and paste
123   your public key in.
124
125 Clone the armband@OPNFV code Git repository with your SSH key
126 -------------------------------------------------------------
127
128 Now it is time to clone the code repository:
129
130 .. code-block:: bash
131
132     $ git clone ssh://<Linux foundation user>@gerrit.opnfv.org:29418/armband
133
134 Now you should have the OPNFV armband repository with its
135 directories stored locally on your build host.
136
137 Check out the Colorado release:
138
139 .. code-block:: bash
140
141     $ cd armband
142     $ git checkout colorado.1.0
143
144 Clone the armband@OPNFV code Git repository without a SSH key
145 -------------------------------------------------------------
146
147 You can also opt to clone the code repository without a SSH key:
148
149 .. code-block:: bash
150
151     $ git clone https://gerrit.opnfv.org/gerrit/armband
152
153 Make sure to checkout the release tag as described above.
154
155 Support for building behind a http/https/rsync proxy
156 ====================================================
157
158 The build system is able to make use of a web proxy setup if the
159 http_proxy, https_proxy, no_proxy (if needed) and RSYNC_PROXY or
160 RSYNC_CONNECT_PROG environment variables have been set before invoking make.
161
162 The proxy setup must permit port 80 (http) and 443 (https).
163 Rsync protocol is currently not used during build process.
164
165 Important note about the host Docker daemon settings
166 ----------------------------------------------------
167
168 The Docker daemon on the host must be configured to use the http proxy
169 for it to be able to pull the base Ubuntu 14.04 image from the Docker
170 registry before invoking make! In Ubuntu this is done by adding a line
171 like:
172
173 .. code-block:: bash
174
175     export http_proxy="http://10.0.0.1:8888/"
176
177 to </etc/default/docker> and restarting the Docker daemon.
178
179 Setting proxy environment variables prior to build
180 --------------------------------------------------
181
182 The build system will make use the following environment variables
183 that needs to be exported to subshells by using export (bash) or
184 setenv (csh/tcsh).
185
186 .. code-block:: bash
187
188      http_proxy (or HTTP_PROXY)
189      https_proxy (or HTTP_PROXY)
190      no_proxy (or NO_PROXY)
191      RSYNC_PROXY
192      RSYNC_CONNECT_PROG
193
194 As an example, these are the settings that were put in the user's
195 .bashrc when verifying the proxy build functionality:
196
197 .. code-block:: bash
198
199     export RSYNC_PROXY=10.0.0.1:8888
200     export http_proxy=http://10.0.0.1:8888
201     export https_proxy=http://10.0.0.1:8888
202     export no_proxy=localhost,127.0.0.1,.consultron.com,.sock
203
204 Using a ssh proxy for the rsync connection
205 ------------------------------------------
206
207 If the proxy setup is not allowing the rsync protocol, an alternative
208 solution is to use a SSH tunnel to a machine capable of accessing the
209 outbound port 873. Set the RSYNC_CONNECT_PROG according to the rsync
210 manual page (for example to "ssh <username>@<hostname> nc %H 873")
211 to enable this. Also note that netcat needs to be installed on the
212 remote system!
213
214 Make sure that the ssh command also refers to the user on the remote
215 system, as the command itself will be run from the Docker build container
216 as the root user (but with the invoking user's SSH keys).
217
218
219 Note! Armband build system uses git submodules to track fuel and
220 other upstream repos, so in order to apply the above change, one
221 should first initialize the submodules and apply armband patches
222 (only needed once):
223
224 .. code-block:: bash
225
226     $ make patches-import
227
228
229 Configure your build environment
230 ================================
231
232 ** Configuring the build environment should not be performed if building
233 standard Colorado release **
234
235 Select the versions of the components you want to build by editing the
236 <armband/upstream/fuel/build/config.mk> and
237 <armband/upstream/fuel/build/armband.mk> files.
238
239 Note! The same observation as above, before altering Makefile, run:
240
241 .. code-block:: bash
242
243     $ make patches-import
244
245
246 Non official build: Selecting which plugins to build
247 ====================================================
248
249 In order to cut the build time for unofficial builds (made by an
250 individual developer locally), the selection if which Fuel plugins to
251 build (if any) can be done by environment variable
252 "BUILD_FUEL_PLUGINS" prior to building.
253
254 Only the plugin targets from <armband/upstream/fuel/build/armband.mk> that
255 are specified in the environment variable will then be built. In order
256 to completely disable the building of plugins, the environment variable
257 is set to " ". When using this functionality, the resulting iso file
258 will be prepended with the prefix "unofficial-" to clearly indicate
259 that this is not a full build.
260
261 This method of plugin selection is not meant to be used from within
262 Gerrit!
263
264 Note! So far, only ODL, OVS and BGPVPN plugins were ported to AArch64.
265
266 ========
267 Building
268 ========
269
270 There are two methods available for building Fuel:
271
272 - A low level method using Make
273
274 - An abstracted method using build.sh
275
276 Low level build method using make
277 =================================
278
279 The low level method is based on Make:
280
281 From the <armband> directory, invoke <make [target]>
282
283 Following targets exist:
284
285 - release - this will do the same as:
286
287   - make submodules-clean patches-import build
288
289 - none/all/build -  this will:
290
291   - Initialize the docker build environment
292
293   - Build Fuel from upstream (as defined by fuel-build/config-spec)
294
295   - Build the OPNFV defined plugins/features from upstream
296
297   - Build the defined additions to fuel (as defined by the structure
298     of this framework)
299
300   - Apply changes and patches to fuel (as defined by the structure of
301     this framework)
302
303   - Reconstruct a fuel .iso image
304
305 - clean - this will remove all artifacts from earlier builds.
306
307 - debug - this will simply enter the build container without starting a build, from here you can start a build by enter "make iso"
308
309 If the build is successful, you will find the generated ISO file in
310 the <armband/upstream/fuel/build/release> subdirectory!
311
312 Abstracted build method using build.sh
313 ======================================
314
315 The abstracted build method uses the <armband/ci/build.sh> script which
316 allows you to:
317
318 - Create and use a build cache - significantly speeding up the
319   build time if upstream repositories have not changed.
320
321 - push/pull cache and artifacts to an arbitrary URI (http(s):, file:, ftp:)
322
323 For more info type <armband/ci/build.sh -h>.
324
325 =========
326 Artifacts
327 =========
328
329 The artifacts produced are:
330
331 - <OPNFV_XXXX.iso> - Which represents the bootable Fuel for AArch64 image,
332   XXXX is replaced with the build identity provided to the build system
333
334 - <OPNFV_XXXX.iso.txt> - Which holds version metadata.
335
336 ==========
337 References
338 ==========
339
340 1) `OPNFV Installation instruction for the AArch64 Colorado release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/colorado/docs/installationprocedure/index.html>`_: http://artifacts.opnfv.org/armband/colorado/docs/installationprocedure/index.html
341
342 2) `OPNFV Build instruction for the AArch64 Colorado release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/colorado/docs/buildprocedure/index.html>`_: http://artifacts.opnfv.org/armband/colorado/docs/buildprocedure/index.html
343
344 3) `OPNFV Release Note for the AArch64 Colorado release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/colorado/docs/releasenotes/index.html>`_: http://artifacts.opnfv.org/armband/colorado/docs/releasenotes/index.html