summaryrefslogtreecommitdiffstats
path: root/doc/book-enea-linux-user-guide/doc/using_enea_linux.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/book-enea-linux-user-guide/doc/using_enea_linux.xml')
-rw-r--r--doc/book-enea-linux-user-guide/doc/using_enea_linux.xml806
1 files changed, 806 insertions, 0 deletions
diff --git a/doc/book-enea-linux-user-guide/doc/using_enea_linux.xml b/doc/book-enea-linux-user-guide/doc/using_enea_linux.xml
new file mode 100644
index 0000000..f22f6a2
--- /dev/null
+++ b/doc/book-enea-linux-user-guide/doc/using_enea_linux.xml
@@ -0,0 +1,806 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<chapter id="using_enealinux">
3 <title>Using Enea Linux</title>
4
5 <section id="build_enealinux">
6 <title>Building Enea Linux</title>
7
8 <para>Enea Linux is made available as sources, this allows for of building
9 various Enea Linux artifacts and is detailed in the following
10 sections:</para>
11
12 <section id="build_images">
13 <title>Building the images</title>
14
15 <para>Build Enea Linux images using the following steps:</para>
16
17 <procedure>
18 <step>
19 <para>Set the $MACHINE/&lt;machine&gt; variable to the target you
20 need, e.g. <literal>intel-corei7-64</literal>.</para>
21 </step>
22
23 <step>
24 <para>Clone Enea Linux sources using Repo tool. Please refer to
25 <xref linkend="getting_sources" /> for more details.</para>
26
27 <programlisting>$ mkdir enea-linux
28$ cd enea-linux
29$ repo init -u git@git.enea.com:linux/manifests/el_manifests-rt.git \
30 -b refs/tags/Enea_Linux_8.0 -m $MACHINE/default.xml
31$ repo sync</programlisting>
32 </step>
33
34 <step>
35 <para>Source the build environment</para>
36
37 <programlisting>$ cd poky
38$ TEMPLATECONF=meta-el-rt/conf/template.&lt;machine&gt; \
39. ./oe-init-build-env &lt;build_dir&gt;</programlisting>
40
41 <para>Sourcing the build environment is needed everytime a new shell
42 is used. However, sourcing using the <literal>TEMPLATECONF</literal>
43 is only needed the first time around. After the first time, it is
44 enough to source the build directory created before.</para>
45
46 <note>
47 <para>The build directory may reside on an NFS mount, but the
48 <literal>TMPDIR</literal>
49 (<literal>&lt;build_dir&gt;/tmp</literal>) may not. Either build
50 all on a local disk, or update <literal>TMPDIR</literal> in
51 <literal>conf/local.conf</literal> to point to a local
52 disk.</para>
53 </note>
54 </step>
55
56 <step>
57 <para>Build Enea Linux image</para>
58
59 <programlisting># You have already initiated the build environment and are in the &lt;build_dir&gt;
60$ bitbake &lt;enea-image-name&gt;
61$ cd &lt;build_dir&gt;/tmp/deploy/images/&lt;target&gt;/ # Here are the build binaries</programlisting>
62
63 <note>
64 <para>Some builds have restrictions on the length of the path
65 name. If you get a build error indicating that the length is too
66 long, you need to move your build to obtain a shorter path.</para>
67 </note>
68
69 <para>Generated images are by default saved in
70 <literal><literal>&lt;build_dir&gt;/tmp/deploy/images/&lt;target&gt;</literal></literal>,
71 where <literal>&lt;build_dir&gt;</literal> by default is the current
72 working directory. Images are created for emulation on host or for
73 booting a physical target, according to how the build environment
74 was set up before running bitbake.</para>
75
76 <para>Depending on the number of processors and cores, the amount or
77 RAM, the speed of your Internet connection and other factors, the
78 build process can take several hours the first time you run it.
79 Subsequent builds run much faster since parts of the build are
80 cached.</para>
81
82 <note>
83 <para>Make sure that the user running the build has access to the
84 Git repositories on git.enea.com. The build process fetches
85 information from git.enea.com so the user running the build shall
86 have the ssh key properly configured. Please refer to <xref
87 linkend="getting_sources" /> for more details on how to get access
88 to Enea Linux sources.</para>
89 </note>
90 </step>
91 </procedure>
92 </section>
93
94 <section id="build_sdk">
95 <title>Building the SDK</title>
96
97 <para>If you want to rebuild a cross-compilation toolchain to be used by
98 in application development, use the following steps:</para>
99
100 <procedure>
101 <step>
102 <para>Clone Enea Linux sources using Repo tool. Please refer to
103 <xref linkend="getting_sources" /> for more details on how to do
104 this.</para>
105
106 <programlisting>$ mkdir enea-linux
107$ cd enea-linux
108$ repo init -u git@git.enea.com:linux/manifests/el_manifests-rt.git \
109 -b refs/tags/Enea_Linux_8.0 -m $MACHINE/default.xml
110$ repo sync</programlisting>
111 </step>
112
113 <step>
114 <para>Source the build environment</para>
115
116 <programlisting>$ cd poky
117$ TEMPLATECONF=meta-el-rt/conf/template.&lt;machine&gt; \
118. ./oe-init-build-env &lt;build_dir&gt;</programlisting>
119
120 <para>Sourcing the build environment is needed everytime a new shell
121 is used. However, sourcing using the <literal>TEMPLATECONF</literal>
122 is only needed the first time around. Afterwards it is enough to
123 source the build directory created before.</para>
124
125 <note>
126 <para>The build directory may reside on an NFS mount, but the
127 <literal>TMPDIR</literal>
128 (<literal>&lt;build_dir&gt;/tmp</literal>) may not. Either build
129 all on a local disk, or update TMPDIR in conf/local.conf to point
130 to a local disk.</para>
131 </note>
132 </step>
133
134 <step>
135 <para>Build Enea Linux SDK</para>
136
137 <programlisting># You have already initiated the build environment and are in the &lt;build_dir&gt;
138$ bitbake &lt;enea-image-name&gt; -c populate_sdk_ext
139$ cd &lt;build_dir&gt;/tmp/deploy/sdk/ # Here is the SDK installer script</programlisting>
140
141 <note>
142 <para>Some builds have restrictions on the length of the path
143 name. If you get a build error indicating that the length is too
144 long, you need to move your build to obtain a shorter path.</para>
145 </note>
146
147 <para>Generated SDK installer script is by default saved in
148 <literal>&lt;build_dir&gt;/tmp/deploy/sdk</literal>, where
149 <literal>&lt;build_dir&gt;</literal> by default is the current
150 working directory.</para>
151
152 <para>Depending on the number of processors and cores, the amount or
153 RAM, the speed of your Internet connection and other factors, the
154 build process can take several hours the first time you run it.
155 Subsequent builds run much faster since parts of the build are
156 cached.</para>
157
158 <para>For more details on how to install and use the SDK, please
159 refer to <xref linkend="install_el_sdk" />.</para>
160 </step>
161 </procedure>
162 </section>
163 </section>
164
165 <section id="boot_enealinux">
166 <title>Booting Enea Linux</title>
167
168 <para>Regardless whether you decide to use the pre-built images or if you
169 choose to build your own, the end result should be similar. Once you have
170 the artifacts availalbe, you may proceed to booting Enea Linux on
171 target.</para>
172
173 <para>Enea Linux supports multiple booting methods so those will be
174 described in the following sections.</para>
175
176 <section id="enea-linux-x86-pxe">
177 <title>Boot via PXE using DHCP, TFTP, and NFS servers</title>
178
179 <para>Below you find an example of how to boot Enea Linux in a target
180 supporting PXE. The PXE boot is handled by the target BIOS.</para>
181
182 <para>This requires the setup of DHCP, TFTP and NFS servers on the host.
183 The DHCP server contains a configuration for the target, found via the
184 target MAC address, and refers to the TFTP server for the boot image and
185 to the NFS server for the root file system.</para>
186
187 <para>For the DHCP server, in addition to the general configuration, the
188 DHCPD configuration should contain an entry for the target with the
189 following information:</para>
190
191 <itemizedlist spacing="compact">
192 <listitem>
193 <para>Host name</para>
194 </listitem>
195
196 <listitem>
197 <para>MAC hardware ethernet address (also available in the TFTP
198 configuration)</para>
199 </listitem>
200
201 <listitem>
202 <para>IP address, (assuming a fixed IP address is used)</para>
203 </listitem>
204
205 <listitem>
206 <para>The TFTP server shall be defined as
207 <literal>next-server</literal></para>
208 </listitem>
209
210 <listitem>
211 <para>The relative path in the TFTP server to the PXE file
212 <filename><literal>pxelinux.0</literal></filename></para>
213 </listitem>
214
215 <listitem>
216 <para>The NFS server IP address and the path to the rootfs on the
217 NFS server, defined as <literal>option root-path</literal></para>
218 </listitem>
219 </itemizedlist>
220
221 <para>Example of a DHCP server configuration:</para>
222
223 <programlisting>host intel-corei7-64_host {
224 hardware ethernet 01:00:25:90:c8:c5:98;
225 fixed-address 192.168.1.38;
226 next-server 192.168.2.10;
227 filename "intel-corei7-64_tftp/pxelinux.0";
228 option root-path "192.168.2.20:/export/intel-corei7-64_rootfs";
229}</programlisting>
230
231 <para>For the TFTP server, the TFTP path to the target's pxelinux.0 file
232 is given in the DHCP Configuration. Examples of files included in the
233 TFTP subdirectory indicated by the DHCP configuration are:</para>
234
235 <programlisting>pxelinux.0
236vesamenu.c32
237boot/device01/bzImage (bootable image file)
238pxelinux.cfg/01-00-25-90-c8-c5-98 (Configuration file)</programlisting>
239
240 <para>One configuration file has the same name as the target's MAC
241 address (but with hyphens instead of a colon). This configuration file
242 contains a pointer to the bootable image and also a list of command line
243 arguments to append when the image is started. The same NFS path to the
244 root file system is both in the DHCP and the TFTP configuration.</para>
245
246 <para>Example of a configuration file:</para>
247
248 <programlisting>default vesamenu.c32
249prompt 0
250timeout 100
251
252label device01
253 menu label ^EneaLinuxNFS
254 menu default
255 kernel boot/device01/bzImage
256 <emphasis role="bold">append</emphasis> root=/dev/nfs nfsmount=192.168.2.20:/export/intel-corei7-64_rootfs ip=dhcp
257 console=ttyS0,115200</programlisting>
258
259 <para><emphasis role="bold">NFS server</emphasis>: The NFS server shall
260 contain an unpacked root file system in the path indicated both in the
261 DHCP and in the TFTP configuration.</para>
262
263 <para>After configuring the servers, copy files from the build directory
264 into the correctly configured paths:</para>
265
266 <orderedlist spacing="compact">
267 <listitem>
268 <para>Ensure the target is not already running an OS, otherwise the
269 target might attempt to change files on the root file system while
270 it is populated with new files.</para>
271 </listitem>
272
273 <listitem>
274 <para>Copy <filename>pxelinux.0</filename> and
275 <filename>vesamenu.c32</filename> from the build directory, e.g.
276 from
277 <filename>&lt;build_dir&gt;tmp/work/corei7-64-enea-linux/syslinux/6.03-r0/image/usr/share/syslinux/</filename>.</para>
278 </listitem>
279
280 <listitem>
281 <para>Copy <filename>bzImage</filename> from
282 <filename>&lt;build_dir&gt;/tmp/deploy/images/&lt;target&gt;/</filename>.</para>
283 </listitem>
284
285 <listitem>
286 <para>Populate the root file system in the NFS directory by
287 unpacking
288 <filename>enea-image-rt-intel-corei7-64.tar.gz</filename>
289 found at
290 <filename>&lt;build_dir&gt;/tmp/deploy/images/&lt;target&gt;/</filename>.</para>
291 </listitem>
292 </orderedlist>
293
294 <para>Boot the target by:</para>
295
296 <orderedlist>
297 <listitem>
298 <para>Use the BIOS or boot setup to select PXE boot, if not already
299 selected.</para>
300 </listitem>
301
302 <listitem>
303 <para>Reboot the target.</para>
304 </listitem>
305 </orderedlist>
306
307 <para>The boot setup menu is usually launched by pressing F12 or ESC
308 during BIOS power up tests. Look up the manufacturer's documentation for
309 your board model to find the appropriate key.</para>
310 </section>
311 </section>
312
313 <section id="custom_enealinux">
314 <title>Customizing Enea Linux</title>
315
316 <section id="layers_adaptations">
317 <title>Layers and Adaptations</title>
318
319 <para>Bitbake allows a modular approach of Metadata, by building images
320 for the layers listed in the conf/bblayers.conf file from your build
321 directory.</para>
322
323 <para>To avoid polluting the build with unnecessary packages, before
324 adding a new layer, it is recommended to check if the Metadata you need
325 is already available in the enabled layers, in which case, for the
326 intended configuration, it may require less modification.</para>
327
328 <para>To ease further use of the layer, try to follow as many best
329 practices as possible when creating it:</para>
330
331 <itemizedlist>
332 <listitem>
333 <para>Use names starting with the meta prefix (although this is not
334 a requirement)</para>
335 </listitem>
336 </itemizedlist>
337
338 <itemizedlist>
339 <listitem>
340 <para>Place your layer under poky</para>
341 </listitem>
342 </itemizedlist>
343
344 <itemizedlist>
345 <listitem>
346 <para>Isolate different customizations by layer</para>
347 </listitem>
348 </itemizedlist>
349
350 <itemizedlist>
351 <listitem>
352 <para>Assign the layer to a repository (to easily have access to
353 maintenance)</para>
354 </listitem>
355 </itemizedlist>
356
357 <para>To enable a layer, its top path must be specified in the
358 <filename>BBLAYERS</filename> variable, as follows:</para>
359
360 <programlisting># POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
361# changes incompatibly
362POKY_BBLAYERS_CONF_VERSION = "2"
363
364BBPATH = "${TOPDIR}"
365BBFILES ?= ""
366
367BBLAYERS ?= " \
368 /path/to/poky/meta \
369 /path/to/poky/meta-el-common \
370 /path/to/poky/meta-el-rt \
371 /path/to/poky/meta-enea-bsp-common \
372 /path/to/poky/meta-enea-bsp-x86 \
373 /path/to/poky/meta-openembedded/meta-oe \
374 /path/to/poky/meta-openembedded/meta-networking \
375 /path/to/poky/meta-openembedded/meta-filesystems \
376 /path/to/poky/meta-openembedded/meta-python \
377 /path/to/poky/meta-poky \
378 /path/to/poky/meta-&lt;layer&gt; \
379 "</programlisting>
380
381 <para>Before adding an extra layer, please keep in mind that the order
382 of layers is important (due to BitBake parsing conf/layer.conf as
383 specified in <filename>BBLAYERS</filename>). To add an extra layer, you
384 can modify the <filename>build/conf/bblayers.conf</filename> file in the
385 source code editor you prefer, as described above, or use one of the
386 specially designed Yocto tools.</para>
387
388 <para>To do such, you can simply modify the build/conf/bblayers.conf
389 file in the source code editor you prefer, as described above, or use
390 one of the specially designed Yocto tools.</para>
391
392 <para>For instance, in addition to the above, the Yocto Bitbake layers
393 utility ensures a very useful checking of some basic layer requirements.
394 Bitbake layers are available, as most of the BitBake tools, when
395 sourcing oe-init-build-env. Therefore, to enable a custom meta layer,
396 you should simply run the following from the build directory:</para>
397
398 <programlisting>bitbake-layers add-layer &lt;meta-layer&gt;</programlisting>
399
400 <para>If the specified layer doesn't contain a
401 <filename>conf/layer.conf</filename> file, you should add one with the
402 needed configuration. Also, to make sure the layer insertion is done in
403 the right metadata, the utility looks for the bblayers.conf
404 configuration file in the corresponding path, which should be satisfied
405 if running the command from the generated build directory.</para>
406
407 <para>For further information on this or on other utilities belonging to
408 the same suite, run:</para>
409
410 <programlisting>bitbake-layers -h</programlisting>
411
412 <para>As a result, <filename>BBLAYERS</filename> shall be extended with
413 the bsp-layer/s layer for your target and any other additional layer/s.
414 For details on how to do this, see the <ulink
415 url="http://www.yoctoproject.org/docs/2.5/dev-manual/dev-manual.html#understanding-and-creating-layers">Yocto
416 2.5 Dev Manual, section "Understanding and Creating Layers".</ulink> If
417 needed replace the Yocto version.</para>
418
419 <para>Layers can be added when you initialize the build environment. The
420 layers required for each target are specified in the build commands in
421 the Enea Linux distribution's Release Information.</para>
422
423 <para>Each Enea Linux customer is advised to add a custom layer for
424 customer-specific additions and customizations, instead of modifying
425 existing layers.</para>
426
427 <para>The recommended way to modify a package is to edit directly in the
428 recipe file. Utilizing the devshell, <literal>bitbake -c devshell
429 &lt;image_name&gt;</literal>, when constructing or modifying recipes is
430 really handy when experimenting, but do not forget to make the final
431 updates directly in the recipe file. It is difficult to keep track of
432 exactly what in the user environment is "dirty" and not in sync with
433 current recipes. Therefore, always make sure to <literal>bitbake -c
434 clean &lt;image_name&gt;</literal> after finishing up a devshell
435 session, and adapt recipes accordingly to ensure a shareable and
436 repeatable build environment.</para>
437 </section>
438
439 <section id="add_recipe">
440 <title>Adding a Recipe</title>
441
442 <para>Study the <ulink
443 url="https://www.yoctoproject.org/docs/2.5/dev-manual/dev-manual.html#new-recipe-single-c-file-package-hello-world"><ulink
444 url="https://www.yoctoproject.org/docs/2.5/dev-manual/dev-manual.html#new-recipe-single-c-file-package-hello-world">Hello
445 World recipe</ulink></ulink> in the Yocto Project Development Manual. If
446 needed replace the example version (2.5) with the Yocto version in your
447 Enea Linux distribution.</para>
448 </section>
449
450 <section id="config_pkg_recipes">
451 <title>Configuring Packages via Recipes</title>
452
453 <para>The default configuration produces a standard Linux installation,
454 but it is often desirable to configure specific packages in more detail.
455 Different packages implement their configuration in different ways, and
456 there is no single method that is valid for all packages. As always, in
457 a collaborative development environment, the developer should make sure
458 that the recipes in the custom layer are upgraded accordingly when a
459 reconfiguration of a specific package is done.</para>
460
461 <para>In subsequent sections you find examples on how to configure some
462 common packages.</para>
463
464 <section id="linux_kern">
465 <title>The Linux Kernel</title>
466
467 <para>The Linux kernel provides a vast array of configuration options,
468 managed using its own configuration system. The kernel package can be
469 supplied from different providers, and this example uses the
470 virtual/kernel package name to refer to the kernel used in the
471 build:</para>
472
473 <programlisting>$ bitbake -c menuconfig virtual/kernel</programlisting>
474
475 <note>
476 <para>menuconfig requires Ncurses. If the terminal that pops up
477 immediately closes instead of showing the menuconfig interface,
478 check that the Ncurses development library is installed.</para>
479 </note>
480
481 <para>First build the kernel:</para>
482
483 <programlisting>$ bitbake -f -c compile -c install -c deploy virtual/kernel</programlisting>
484
485 <para>Then build the whole distribution:</para>
486
487 <programlisting>$ bitbake enea-image-&lt;name&gt;</programlisting>
488 </section>
489
490 <section id="busybox">
491 <title>Busybox</title>
492
493 <para>Busybox uses the same configuration system as the Linux kernel
494 and is therefore invoked similarly. In contrast to the kernel, there
495 is generally only one variant of busybox in a distribution and we can
496 therefore refer to it by the package name alone:</para>
497
498 <programlisting>$ bitbake -c menuconfig busybox</programlisting>
499 </section>
500 </section>
501
502 <section id="build_com_licenses">
503 <title>Building with Commercial Licenses</title>
504
505 <note>
506 <para>Adding commercial-licensed packages might pose distribution
507 problems due to license agreements or patents.</para>
508 </note>
509
510 <para>Commercial-licensed packages are not provided with Enea Linux.
511 Depending on your use case, you might need to extend the initial image
512 with more packages by adding recipes and updating the image definition,
513 always in accordance with the license conditions. To succeed with
514 building the customized image, you might need to solve dependencies by
515 adding even more packages.</para>
516
517 <para>Below is an example with steps on how to add a package with a
518 commercial license. The configuration is updated in two places and the
519 recipes are selected for the packages and any dependencies.</para>
520
521 <note>
522 <para>This is only an illustrating example, the exact configuration
523 may differ between different packages. Some packages could require
524 other defines added to local.conf and some packages might need an
525 added <filename>DEPENDS</filename> in the *.inc file, or other
526 particular changes.</para>
527 </note>
528
529 <itemizedlist>
530 <listitem>
531 <para>Append the package name to the
532 <filename>IMAGE_INSTALL</filename> definition, used in the recipe
533 corresponding to the image you will build, as in one of the examples
534 below:</para>
535
536 <orderedlist>
537 <listitem>
538 <para>If you need the package in a set of images, to avoid
539 defining it in each recipe, add the following line to
540 <filename>IMAGE_INSTALL</filename> in
541 <filename>meta-el-common/images/enea-image-common.inc</filename></para>
542
543 <programlisting> package_name \</programlisting>
544 </listitem>
545
546 <listitem>
547 <para>If you have specific images in which you need the package,
548 add the following line in the corresponding recipes in
549 meta-el-&lt;profile&gt;/images/enea-image-&lt;profile&gt;.bb</para>
550
551 <programlisting> IMAGE_INSTALL += " \
552 package_name \
553 "</programlisting>
554 </listitem>
555 </orderedlist>
556 </listitem>
557
558 <listitem>
559 <para>Add the required license to the
560 <filename>LICENSE_FLAGS_WHITELIST</filename> definition. This can be
561 done by adding script lines in the corresponding
562 scripts/conf_setup.sh file, which appends
563 <filename>LICENSE_FLAGS_WHITELIST +=
564 "&lt;suitable-license&gt;</filename> to
565 <filename>conf/local.conf.</filename></para>
566 </listitem>
567
568 <listitem>
569 <para>To mitigate the build errors caused by packages with
570 commercial licenses, you might also need to append the generic
571 license <filename>LICENSE_FLAGS_WHITELIST += "commercial"</filename>
572 in the same way as above.</para>
573 </listitem>
574
575 <listitem>
576 <para>Select the needed recipes for the packages and add these to
577 the build configuration.</para>
578 </listitem>
579
580 <listitem>
581 <para>Select the needed recipes to resolve dependencies for the new
582 packages and add these to the build configuration.</para>
583 </listitem>
584 </itemizedlist>
585
586 <para>More information about recipes can be found here:</para>
587
588 <itemizedlist>
589 <listitem>
590 <para><ulink
591 url="http://git.openembedded.org/">http://git.openembedded.org/</ulink></para>
592 </listitem>
593 </itemizedlist>
594
595 <itemizedlist>
596 <listitem>
597 <para><ulink
598 url="https://wiki.yoctoproject.org/wiki/Building_your_own_recipes_from_first_principles">https://wiki.yoctoproject.org/wiki/Building_your_own_recipes_from_first_principles</ulink></para>
599 </listitem>
600 </itemizedlist>
601
602 <itemizedlist>
603 <listitem>
604 <para><ulink
605 url="http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#new-recipe-writing-a-new-recipe">http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#new-recipe-writing-a-new-recipe</ulink></para>
606 </listitem>
607 </itemizedlist>
608 </section>
609 </section>
610
611 <section id="install_el_sdk">
612 <title>Installing the Enea Linux SDK</title>
613
614 <para>Before cross-compiling applications for your target, you need to
615 install the Software Development Kit (SDK) - which contains the
616 cross-compilation toolchain - and set up the cross-compilation environment
617 on your host. The toolchain for each supported target contains a 64-bit
618 library for gcc. The toolchain and the environment-setup script are
619 wrapped together inside a toolchain installer in the form of a shell
620 script.</para>
621
622 <para>The cross-compilation toolchain is packaged as follows:</para>
623
624 <itemizedlist>
625 <listitem>
626 <para>The &lt;target&gt; toolchain contains the lib64 (64-bit)
627 library.</para>
628 </listitem>
629
630 <listitem>
631 <para>The &lt;target&gt; installer has an environment-setup script
632 which will select the lib64 to be used by gcc. This way, a 64-bit
633 application can be cross-compiled.</para>
634 </listitem>
635 </itemizedlist>
636
637 <para>Do as in the example below to install the SDK and set up the
638 cross-compilation environment:</para>
639
640 <orderedlist>
641 <listitem>
642 <para>The fastest alternative is to use a precompiled
643 cross-compilation toolchain installer for your host and target.</para>
644
645 <para>Please refer to the Release Information document, in section 1.1
646 Provided Contents, for more details on where to find the pre-compiled
647 SDK installer.</para>
648 </listitem>
649
650 <listitem>
651 <para>Run the installer to unpack the cross-compilation toolchain and
652 the environment-setup script:</para>
653
654 <programlisting>$ chmod 770 enea-*-toolchain-&lt;version&gt;.sh
655$ ./enea-*-toolchain-&lt;version&gt;.sh</programlisting>
656
657 <para>When prompted, select to install the SDK in the desired
658 directory, referred to as &lt;sdkdir&gt;. The default path where the
659 SDK will be installed, will be shown in the prompt. The installer
660 unpacks the environment setup script in &lt;sdkdir&gt; and the
661 toolchain under &lt;sdkdir&gt;/sysroots.</para>
662
663 <note>
664 <para>Choose a unique directory for each toolchain. Installing a
665 second toolchain of any type (buildtools toolchain or
666 cross-compilation toolchain) in the same directory as a previously
667 installed one will break the $PATH variable of the first one.</para>
668 </note>
669 </listitem>
670
671 <listitem>
672 <para>Setup the toolchain environment for your target by sourcing the
673 environment-setup script:</para>
674
675 <programlisting>$ . &lt;sdkdir&gt;/environment-setup-&lt;arch&gt;-enea-linux</programlisting>
676
677 <para>Example:</para>
678
679 <programlisting>$ . /opt/enea/environment-setup-corei7-64-enea-linux</programlisting>
680 </listitem>
681 </orderedlist>
682
683 <para>Once the cross-compilation toolchain is in place and the environment
684 set up, you can proceed with Cross-Compiling Applications from Command
685 Line (4.1) or, if Eclipse is installed, Cross-Compiling from Eclipse
686 (5.4.1).</para>
687 </section>
688
689 <section id="pkg_mg">
690 <title>Using Package Management</title>
691
692 <para>A Package Management System (PMS) can be used to customize your
693 image in a consistent way, e.g. to install, upgrade, or delete packages
694 considering the dependencies. The package management systems supported by
695 Enea Linux are described in this section. More information about PMS can
696 be found in the Yocto 2.5 document <ulink
697 url="http://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html">Yocto
698 Project Mega Manual</ulink>. If needed replace the Yocto version in the
699 link.</para>
700
701 <section id="apt_pktmgmt">
702 <title>APT Package Management (DEB Packages)</title>
703
704 <para>Enea Linux provides DEB packages on <ulink
705 url="http://linux.enea.com/EneaLinux8.0/">linux.enea.com</ulink> site,
706 in directory
707 <literal><literal>&lt;release&gt;/&lt;target&gt;/deb</literal>/</literal>.</para>
708
709 <para>The application for performing runtime package management of DEB
710 packages on the target is called <filename>apt-get</filename>.</para>
711
712 <para>Use the <literal>apt-get</literal> command to install, upgrade, or
713 remove packages. Before using any apt-get options that require network
714 access, please check that the network is configured and working
715 properly.</para>
716
717 <para>The <literal>apt-get</literal> command is by default included in
718 Enea Linux images.</para>
719
720 <section id="apt_config">
721 <title>Configuring</title>
722
723 <para>APT relies on the concept of repositories in order to find
724 packages and resolve dependencies.</para>
725
726 <para>Any number of additional repositories can be added to APT's
727 configuration files (.list extension) located in sources.list.d
728 directory (e.g:
729 <filename>/etc/apt/sources.list.d/repos.list</filename>) and then be
730 queried by APT.</para>
731
732 <programlisting># touch /etc/apt/sources.list.d/repos.list
733# echo "deb [trusted=yes] http://server-address/path/to/the/package/directory ./" | \
734tee -a /etc/apt/sources.list.d/repos.list</programlisting>
735
736 <para>Run <literal>apt-get update</literal> to fetch information from
737 the new repository:</para>
738
739 <programlisting># apt-get update</programlisting>
740 </section>
741
742 <section id="apt_install">
743 <title>Installing</title>
744
745 <para>DEB packages typically have file names like
746 foo-1.0.1-r0.0_arm64.deb The file name includes the package name
747 (foo), version (1.0.1), revison (r0.0), and architecture (arm64). To
748 install a package, log in as root and type the following command at a
749 shell prompt:</para>
750
751 <programlisting># apt-get install foo</programlisting>
752
753 <para>The <literal>apt-get install</literal> command will install one
754 or more packages in the system.</para>
755 </section>
756
757 <section id="apt_upgrade">
758 <title>Upgrading</title>
759
760 <para>The <literal>apt-get upgrade</literal> command will upgrade one
761 or more packages which are currently installed in the system. If no
762 packages are given, all installed packages will be checked.</para>
763
764 <programlisting># apt-get upgrade foo</programlisting>
765 </section>
766
767 <section id="apt_rm">
768 <title>Removing</title>
769
770 <para>The <literal>apt-get remove</literal> command will remove one or
771 more packages which are currently installed in the system.
772 Example:</para>
773
774 <programlisting># apt-get remove ptest-runner
775Reading package lists... Done
776Building dependency tree
777Reading state information... Done
778The following packages were automatically installed and are no longer required:
779 libc6-dbg libc6-dev libc6-extra-nss libc6-thread-db libcidn1
780 linux-libc-headers-dev
781Use 'apt autoremove' to remove them.
782The following packages will be REMOVED:
783 ptest-runner
7840 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
785After this operation, 0 B of additional disk space will be used.
786Do you want to continue? [Y/n] y
787(Reading database ... 5766 files and directories currently installed.)
788Removing ptest-runner (2.0.2+git0+6d2872116c-r0.0) ...
789</programlisting>
790 </section>
791
792 <section id="pm_searching">
793 <title>Searching</title>
794
795 <para>The <literal>apt-cache search</literal> allows searching for the
796 given expressions in the name, summary and description of known
797 packages. Example:</para>
798
799 <programlisting># apt-cache search ptest-runner
800ptest-runner - A C program to run all installed ptests
801ptest-runner-dbg - A C program to run all installed ptests - Debugging files
802ptest-runner-dev - A C program to run all installed ptests - Development files</programlisting>
803 </section>
804 </section>
805 </section>
806</chapter>