diff options
-rw-r--r-- | doc/book-enea-nfv-access-guide-intel/doc/using_nfv_access_sdks.xml | 420 |
1 files changed, 202 insertions, 218 deletions
diff --git a/doc/book-enea-nfv-access-guide-intel/doc/using_nfv_access_sdks.xml b/doc/book-enea-nfv-access-guide-intel/doc/using_nfv_access_sdks.xml index 25090c6..8a3bd27 100644 --- a/doc/book-enea-nfv-access-guide-intel/doc/using_nfv_access_sdks.xml +++ b/doc/book-enea-nfv-access-guide-intel/doc/using_nfv_access_sdks.xml | |||
@@ -6,9 +6,15 @@ | |||
6 | 6 | ||
7 | <para>Enea NFV Access comes with two Software Development Kits (SDK), the | 7 | <para>Enea NFV Access comes with two Software Development Kits (SDK), the |
8 | "Standard SDK" and the "Extensible SDK". Standard SDK can be used to develop | 8 | "Standard SDK" and the "Extensible SDK". Standard SDK can be used to develop |
9 | user-applications and kernel modules on host to run on target device (i.e. | 9 | and debug user-applications and kernel modules specific to the target |
10 | on ARM, PPC, x86, ..). The standard SDK can also be used for cross debugging | 10 | architecture on host to run on target device (i.e. Xeon D, Atom |
11 | your kernel or application.</para> | 11 | C3000).</para> |
12 | |||
13 | <para>The Extensible SDK provides features that help you easily add a new | ||
14 | Yocto recipe, build, test and package software and optionally deploy it to | ||
15 | target device. The Extensible SDK however is based on core-i7 architecture | ||
16 | and can't be used for building the kernel modules specific to other | ||
17 | architectures.</para> | ||
12 | 18 | ||
13 | <para><emphasis role="bold">Benefits of Extensible | 19 | <para><emphasis role="bold">Benefits of Extensible |
14 | SDK:</emphasis><orderedlist> | 20 | SDK:</emphasis><orderedlist> |
@@ -18,7 +24,7 @@ | |||
18 | 24 | ||
19 | <listitem> | 25 | <listitem> |
20 | <para>Easy to add new apps and libraries, modify source of an existing | 26 | <para>Easy to add new apps and libraries, modify source of an existing |
21 | component or add new layers/recipes</para> | 27 | component or add new Yocto layers/recipes</para> |
22 | </listitem> | 28 | </listitem> |
23 | 29 | ||
24 | <listitem> | 30 | <listitem> |
@@ -34,10 +40,18 @@ | |||
34 | </listitem> | 40 | </listitem> |
35 | 41 | ||
36 | <listitem> | 42 | <listitem> |
37 | <para>Runs on a range of host operating systems (Windows, Mac)</para> | 43 | <para>Runs on a range of host distributions</para> |
38 | </listitem> | 44 | </listitem> |
39 | </orderedlist></para> | 45 | </orderedlist></para> |
40 | 46 | ||
47 | <para>For additional information about SDKs, please refer to the <ulink | ||
48 | url="https://wiki.yoctoproject.org/wiki/Application_Development_with_Extensible_SDK#Extensible_SDK">Application | ||
49 | Development with Extensible SDK, </ulink> <ulink | ||
50 | url="https://wiki.yoctoproject.org/wiki/Extensible_SDK">Extensible SDK Wiki | ||
51 | page</ulink> and <ulink | ||
52 | url="https://www.yoctoproject.org/docs/current/sdk-manual/sdk-manual.html">Yocto | ||
53 | SDK Manual</ulink>.</para> | ||
54 | |||
41 | <section id="std_sdk"> | 55 | <section id="std_sdk"> |
42 | <title>Standard SDK</title> | 56 | <title>Standard SDK</title> |
43 | 57 | ||
@@ -74,17 +88,7 @@ | |||
74 | generate executables for the preferred target machine. Cross-gdb | 88 | generate executables for the preferred target machine. Cross-gdb |
75 | (<filename>x86_64-enea-linux-gdb</filename>) is created by the | 89 | (<filename>x86_64-enea-linux-gdb</filename>) is created by the |
76 | Cross-Development toolchain. It can be used to debug applications on the | 90 | Cross-Development toolchain. It can be used to debug applications on the |
77 | target platform from the development workstation. For kernel debugging, | 91 | target platform from the development workstation.</para> |
78 | <command>ftrace</command> and <command>kgdb</command> are enabled on the | ||
79 | host sdk image.</para> | ||
80 | |||
81 | <para>Various user-space tools helpful in the development process, are | ||
82 | also provided. The tools include <emphasis | ||
83 | role="bold">LatencyTop</emphasis>, <emphasis role="bold">Perf</emphasis>, | ||
84 | <emphasis role="bold">CrossTap</emphasis>, <emphasis | ||
85 | role="bold">OProfile</emphasis>, <emphasis | ||
86 | role="bold">Lttng-ust</emphasis> and <emphasis | ||
87 | role="bold">GDBserver</emphasis>.</para> | ||
88 | 92 | ||
89 | <section id="install-crosscomp"> | 93 | <section id="install-crosscomp"> |
90 | <title>Installing the Cross-Compilation Toolchain</title> | 94 | <title>Installing the Cross-Compilation Toolchain</title> |
@@ -282,63 +286,15 @@ MODULE_LICENSE("GPL");</programlisting> | |||
282 | remote debugging is started and the GDB commands are available to | 286 | remote debugging is started and the GDB commands are available to |
283 | debug your program from the target machine.</para> | 287 | debug your program from the target machine.</para> |
284 | </section> | 288 | </section> |
285 | |||
286 | <section id="kernel_crossdebug"> | ||
287 | <title>Kernel Cross-Debugging</title> | ||
288 | |||
289 | <para>In order to debug the kernel, a serial connection is required | ||
290 | between the development and target machines. Debugging commands will | ||
291 | be sent from your workstation to the target machine via a serial | ||
292 | port.</para> | ||
293 | |||
294 | <para>The KGDB kernel options are enabled in the Enea NFV Access Host | ||
295 | SDK image and the tool can be used in the following way:</para> | ||
296 | |||
297 | <itemizedlist> | ||
298 | <listitem> | ||
299 | <para>On target, once serial communication is established, | ||
300 | configure <literal>kgdboc</literal> after the kernel | ||
301 | boots:<programlisting># echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc</programlisting></para> | ||
302 | </listitem> | ||
303 | |||
304 | <listitem> | ||
305 | <para>In order to connect to gdb via kgdboc, the kernel must first | ||
306 | be stopped:<programlisting># echo g > /proc/sysrq-trigger</programlisting></para> | ||
307 | </listitem> | ||
308 | |||
309 | <listitem> | ||
310 | <para>Close the console to the target, eg.: <command>Ctrl + | ||
311 | ]</command> for a telnet session.</para> | ||
312 | </listitem> | ||
313 | |||
314 | <listitem> | ||
315 | <para>On your development machine, start cross-gdb using the | ||
316 | vmlinux kernel image as a parameter. The image is located in | ||
317 | <filename><sdkdir>/sysroots/corei7-64-enea-linux/boot/</filename> | ||
318 | and should be the same as the image found in the | ||
319 | <literal>/boot</literal> directory from the | ||
320 | target.<programlisting># x86_64-enea-linux-gdb / | ||
321 | ./sysroots/corei7-64-enea-linux/boot/vmlinux-4.9.30-intel-pk-standard</programlisting></para> | ||
322 | </listitem> | ||
323 | |||
324 | <listitem> | ||
325 | <para>Connect GDB to the target machine using target command and | ||
326 | the serial device:<programlisting>(gdb) set remotebaud 115200 | ||
327 | (gdb) target remote /dev/ttyS0</programlisting></para> | ||
328 | </listitem> | ||
329 | </itemizedlist> | ||
330 | |||
331 | <para>The kernel can now be debugged in a similar manner as an | ||
332 | application program.</para> | ||
333 | </section> | ||
334 | </section> | 289 | </section> |
335 | </section> | 290 | </section> |
336 | 291 | ||
337 | <section id="esdk"> | 292 | <section id="esdk"> |
338 | <title>Extensible SDK</title> | 293 | <title>Extensible SDK</title> |
339 | 294 | ||
340 | <para>The Extensible SDK provides features that help you easily build an | 295 | <para>The Extensible SDK provides a number of features that help you |
341 | exsiting or a new component. The Extensible SDK consits of:</para> | 296 | easily build, test and package software, and optionally deploy it to |
297 | target device. The Extensible SDK consits of:</para> | ||
342 | 298 | ||
343 | <itemizedlist> | 299 | <itemizedlist> |
344 | <listitem> | 300 | <listitem> |
@@ -355,8 +311,9 @@ MODULE_LICENSE("GPL");</programlisting> | |||
355 | </listitem> | 311 | </listitem> |
356 | 312 | ||
357 | <listitem> | 313 | <listitem> |
358 | <para>Devtool (to add, build and deploy the application to target | 314 | <para>Devtool (d<emphasis>evtool add </emphasis>to create |
359 | device)</para> | 315 | automatically a recipe for an existing source code, <emphasis>devtool |
316 | modify</emphasis> to build an existing recipe, etc ..)</para> | ||
360 | </listitem> | 317 | </listitem> |
361 | </itemizedlist> | 318 | </itemizedlist> |
362 | 319 | ||
@@ -395,226 +352,253 @@ Run devtool --help for further details.</programlisting></para> | |||
395 | </orderedlist> | 352 | </orderedlist> |
396 | </section> | 353 | </section> |
397 | 354 | ||
398 | <section id="mod_comp_esdk"> | 355 | <section id="add_new_comp_esdk"> |
399 | <title>Modifying an existing component</title> | 356 | <title>Adding a new component</title> |
357 | |||
358 | <para>The <emphasis>devtool add</emphasis> command is used to create a | ||
359 | new recipe and <emphasis>devtool modify</emphasis> command is used to | ||
360 | work on an existing recipe. To add a component, you can:</para> | ||
361 | |||
362 | <para><emphasis role="bold">A) Generate a recipe from the existing | ||
363 | application code and Makefile</emphasis></para> | ||
400 | 364 | ||
401 | <orderedlist> | 365 | <orderedlist> |
402 | <listitem> | 366 | <listitem> |
403 | <para>Extract source and add recipe to workspace:</para> | 367 | <para>Run <emphasis>devtool add</emphasis> command to generate a |
368 | recipe:</para> | ||
404 | 369 | ||
405 | <programlisting>$ devtool modify -x recipename myapp /path/to/source</programlisting> | 370 | <programlisting>$ devtool add recipe /path/to/your_application |
406 | </listitem> | ||
407 | 371 | ||
408 | <listitem> | 372 | EX: |
409 | <para>Edit the source code and build it:</para> | 373 | $ devtool add bbexample /path/to/bbexample |
374 | or download from upstream git repository | ||
375 | $ devtool add bbexample https://github.com/whbruce/bbexample.git | ||
410 | 376 | ||
411 | <programlisting>$ devtool build recipename </programlisting> | 377 | NOTE: Recipe <SDK_dir>/workspace/recipes/bbexample/bbexample.bb has been |
378 | automatically created; further editing may be required to make it fully functional | ||
379 | NOTE: devtool creates a Git repository locally during the extraction under | ||
380 | <SDK_dir>/workspace/source/bbexample</programlisting> | ||
412 | </listitem> | 381 | </listitem> |
382 | </orderedlist> | ||
383 | |||
384 | <para><emphasis role="bold">B) Use an existing recipe from a Yocto | ||
385 | layer</emphasis></para> | ||
413 | 386 | ||
387 | <orderedlist> | ||
414 | <listitem> | 388 | <listitem> |
415 | <para>Push source code changes, or generate as patches on top of | 389 | <para>Use any recipe from <SDK_dir>/layers/poky/meta*</para> |
416 | recipe:</para> | 390 | |
391 | <programlisting>$ devtool mdify recipe | ||
417 | 392 | ||
418 | <programlisting>$ devtool updaterecipe recipename</programlisting> | 393 | EX: |
394 | $ devtool modify curl</programlisting> | ||
419 | </listitem> | 395 | </listitem> |
420 | </orderedlist> | 396 | </orderedlist> |
421 | </section> | ||
422 | 397 | ||
423 | <section id="add_comp_esdk"> | 398 | <para><emphasis role="bold">C) Alternatively bring a new recipe from the |
424 | <title>Adding a new component</title> | 399 | upstream Yocto project if the recipe is not included in your Extensible |
400 | SDK </emphasis></para> | ||
425 | 401 | ||
426 | <orderedlist> | 402 | <orderedlist> |
427 | <listitem> | 403 | <listitem> |
428 | <para>Add application to workspace:</para> | 404 | <para>Clone a recipe from the upstream Yocto project, e.g. |
405 | meta-security:</para> | ||
429 | 406 | ||
430 | <programlisting>$ devtool add myapp /path/to/source</programlisting> | 407 | <programlisting>$ pushd <SDK_dir>/layers/poky |
408 | $ git clone -b rocko git://git.yoctoproject.org/meta-security</programlisting> | ||
431 | </listitem> | 409 | </listitem> |
432 | 410 | ||
433 | <listitem> | 411 | <listitem> |
434 | <para>Build it:</para> | 412 | <para>Use the <emphasis>bitbake-layers</emphasis> script to add the |
413 | meta-security to BBLAYERS:</para> | ||
414 | |||
415 | <programlisting>$ layers/poky/bitbake/bin/bitbake-layers add-layer layers/poky/meta-security | ||
416 | |||
417 | If you get dependency ERROR, you need to clone all required layer as well: | ||
418 | ERROR: Layer 'security' depends on layer 'perl-layer', but this layer is | ||
419 | not enabled in your configuration | ||
435 | 420 | ||
436 | <programlisting>$ devtool build myapp </programlisting> | 421 | clone meta-perl from openembedded and run add-layers again: |
422 | $ layers/poky/bitbake/bin/bitbake-layers add-layer layers/poky/meta-security | ||
423 | |||
424 | NOTE: Now <SDK_dir>/layers/poky/meta-security is created and the layer has been | ||
425 | added to: <SDK_dir>/conf/bblayers.conf | ||
426 | ... | ||
427 | ${SDKBASEMETAPATH}/layers/poky/meta-security \</programlisting> | ||
428 | </listitem> | ||
429 | |||
430 | <listitem> | ||
431 | <para>Use <emphasis>devtool modify</emphasis> command to work an an | ||
432 | existing recipe inside meta-security layer:</para> | ||
433 | |||
434 | <programlisting>$ devtool modify recipe | ||
435 | |||
436 | EX: | ||
437 | $ devtool modify isic | ||
438 | |||
439 | NOTE: following directories and files are created: | ||
440 | <SDK_dir>/workspace/appends/isic_0.07.bbappend | ||
441 | <SDK_dir>/workspace/sources/isic</programlisting> | ||
437 | </listitem> | 442 | </listitem> |
438 | </orderedlist> | 443 | </orderedlist> |
439 | </section> | 444 | </section> |
440 | 445 | ||
441 | <section id="create_recipe_esdk"> | 446 | <section id="devtool_build"> |
442 | <title>Creating recipe for a new application </title> | 447 | <title>Build your application/recipe</title> |
443 | |||
444 | <para>Devtool provides a number of features that help you easily to | ||
445 | build, test and package software within the extensible SDK, and | ||
446 | optionally deploy it to target device:</para> | ||
447 | 448 | ||
448 | <para>This example will show how to generate a recipe from the existing | 449 | <para>Use devtool build command to build the recipe:</para> |
449 | application code and Makefile, edit the recipe in order to provide an | ||
450 | installation path for the application, build the recipe, and deploy the | ||
451 | output on a target, or create a DEB package from the recipe and install | ||
452 | the package.</para> | ||
453 | 450 | ||
454 | <orderedlist> | 451 | <orderedlist> |
455 | <listitem> | 452 | <listitem> |
456 | <para>Create a simple application and Makefile in | 453 | <para><programlisting>$ devtool build [recipe] |
457 | <literal><workspace_dir>/my_app</literal>:</para> | ||
458 | 454 | ||
459 | <para><literal><workspace_dir>/my_app/my_hello_app.c</literal></para> | 455 | EX: |
456 | $ devtool build isic</programlisting>The recipe build results can be seen | ||
457 | here:<literal> | ||
458 | <literal><SDK_dir>/tmp/work/<arch>-enea-linux/isic</literal></literal></para> | ||
459 | </listitem> | ||
460 | </orderedlist> | ||
461 | </section> | ||
462 | </section> | ||
460 | 463 | ||
461 | <programlisting>#include <stdio.h> | 464 | <section id="deploy"> |
465 | <title>Deploy your Application to target</title> | ||
462 | 466 | ||
463 | int main(void) | 467 | <para>Deploy your application to target by using <emphasis>devtool |
464 | { | 468 | deploy-target</emphasis> command or build an docker image and dploy the |
465 | printf("Hello world!\n"); | 469 | docker image.</para> |
466 | return 0; | ||
467 | }</programlisting> | ||
468 | 470 | ||
469 | <para><literal><workspace_dir>/my_app/Makefile</literal></para> | 471 | <section id="deploy-artifacts-esdk"> |
472 | <title>Using <emphasis>devtool deploy-target</emphasis> command</title> | ||
470 | 473 | ||
471 | <programlisting>my_hello_app:</programlisting> | 474 | <para>Deploy the application to the target device:</para> |
472 | </listitem> | ||
473 | 475 | ||
476 | <orderedlist> | ||
474 | <listitem> | 477 | <listitem> |
475 | <para>Generate a recipe (my-hello-recipe) using the source tree of | 478 | <para>Deploy to target:</para> |
476 | the application | ||
477 | (<literal><workspace_dir>/my_app</literal>):</para> | ||
478 | |||
479 | <programlisting>$ devtool add my-hello-recipe <workspace_dir>/my_app | ||
480 | NOTE: Using source tree as build directory since that would be the default for this | ||
481 | recipe | ||
482 | NOTE: Recipe <SDK_dir>/workspace/recipes/my-hello-recipe/my-hello-recipe.bb has been | ||
483 | automatically created; further editing may be required to make it fully functional</programlisting> | ||
484 | |||
485 | <programlisting>$ cat <SDK_dir>/workspace/recipes/my-hello-recipe/my-hello-recipe.bb | ||
486 | # Recipe created by recipetool | ||
487 | # This is the basis of a recipe and may need further editing in order to be fully | ||
488 | # functional. | ||
489 | # (Feel free to remove these comments when editing.) | ||
490 | # | ||
491 | # Unable to find any files that looked like license statements. Check the | ||
492 | # accompanying documentation and source headers and set LICENSE and | ||
493 | # LIC_FILES_CHKSUM accordingly. | ||
494 | # | ||
495 | # NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if | ||
496 | # this is not accurate with respect to the licensing of the software being built (it | ||
497 | # will not be in most cases) you must specify the correct value before using this | ||
498 | # recipe for anything other than initial testing/development! | ||
499 | LICENSE = "CLOSED" | ||
500 | LIC_FILES_CHKSUM = "" | ||
501 | |||
502 | # No information for SRC_URI yet (only an external source tree was specified) | ||
503 | SRC_URI = "" | ||
504 | |||
505 | |||
506 | # NOTE: this is a Makefile-only piece of software, so we cannot generate much of the | ||
507 | # recipe automatically - you will need to examine the Makefile yourself and ensure | ||
508 | # that the appropriate arguments are passed in. | ||
509 | |||
510 | do_configure () { | ||
511 | # Specify any needed configure commands here | ||
512 | : | ||
513 | } | ||
514 | 479 | ||
515 | do_compile () { | 480 | <programlisting>$ devtool deploy-target isic root@<target_ip_address> |
516 | # You will almost certainly need to add additional arguments here | 481 | root@xeon-d:~# isic |
517 | oe_runmake | 482 | isic: error while loading shared libraries: libnet.so.9: cannot open shared |
518 | } | 483 | object file: No such file or directory |
519 | 484 | ||
520 | do_install () { | 485 | NOTE: If you get dependency error, you need to build that recipe as well and |
521 | # NOTE: unable to determine what to put here - there is a Makefile but no | 486 | deploy to target: |
522 | # target named "install", so you will need to define this yourself | 487 | $ devtool modify libnet |
523 | : | 488 | $ devtool build libnet |
524 | }</programlisting> | 489 | $ devtool deploy-target libnet root@<target_ip_address> |
525 | </listitem> | ||
526 | 490 | ||
527 | <listitem> | 491 | Now isic runs on target: |
528 | <para>Edit the recipe to provide an installation path for the | 492 | |
529 | application:</para> | 493 | root@xeon-d:~# isic |
530 | 494 | usage: isic [-v] [-D] -s <source ip> -d <destination ip> [-r <random seed>] | |
531 | <programlisting>$ devtool edit-recipe my-hello-recipe</programlisting> | ||
532 | |||
533 | <programlisting>$ cat <SDK_dir>/workspace/recipes/my-hello-recipe/my-hello-recipe.bb | ||
534 | ... | ||
535 | do_install () { | ||
536 | # NOTE: unable to determine what to put here - there is a Makefile but no | ||
537 | # target named "install", so you will need to define this yourself | ||
538 | install -d ${D}${bindir} | ||
539 | install -m 0777 ${S}/my_hello_app ${D}${bindir} | ||
540 | } | ||
541 | ...</programlisting> | 495 | ...</programlisting> |
542 | </listitem> | 496 | </listitem> |
543 | 497 | ||
544 | <listitem> | 498 | <listitem> |
545 | <para>Build the recipe:</para> | 499 | <para>Remove/uninstall the application from target if you don't need |
546 | 500 | it:</para> | |
547 | <programlisting>$ devtool build my-hello-recipe</programlisting> | ||
548 | 501 | ||
549 | <para>The recipe build results can be seen here: | 502 | <programlisting>$ devtool undeploy-target isic root@<target_ip_address></programlisting> |
550 | <literal><SDK_dir>/tmp/work/<arch>-enea-linux/my-hello-recipe/1.0-r0/</literal></para> | ||
551 | </listitem> | 503 | </listitem> |
552 | 504 | ||
553 | <listitem> | 505 | <listitem> |
554 | <para>Deploy the output (in this case, the application) on | 506 | <para>Delete recipe and source files from workspace:</para> |
555 | target:</para> | ||
556 | |||
557 | <programlisting>$ devtool deploy-target my-hello-recipe root@<target_ip_address> | ||
558 | Parsing recipes..done. | ||
559 | NOTE: Successfully deployed | ||
560 | <SDK_dir>/tmp/work/<arch>-enea-linux/my-hello-recipe/1.0-r0/image</programlisting> | ||
561 | 507 | ||
562 | <para>As an alternative you can create a DEB package:</para> | 508 | <programlisting>$ devtool finish isic recipes/isic |
563 | 509 | ||
564 | <programlisting>$ devtool package my-hello-recipe | 510 | NOTE: Leaving source tree <SDK_dir>/workspace/sources/isic as-is; |
565 | ...NOTE: Your packages are in <SDK_dir>/tmp/deploy/deb</programlisting> | 511 | if you no longer need it then please delete it manually |
566 | 512 | ||
567 | <para>Then copy the DEB package on the target and install it using | 513 | rm -rf <SDK_dir>/workspace/appends/isic_0.07.bbappend |
568 | dpkg:</para> | 514 | rm -rf <SDK_dir>/workspace/source/isic</programlisting> |
569 | |||
570 | <programlisting># dpkg -i my-hello-recipe-1.0-r0.1.<arch>.deb</programlisting> | ||
571 | </listitem> | 515 | </listitem> |
572 | </orderedlist> | 516 | </orderedlist> |
573 | </section> | 517 | </section> |
574 | 518 | ||
575 | <section id="update_esdk"> | 519 | <section id="docker_deploy"> |
576 | <title>Updating and Extending the Extensible SDK</title> | 520 | <title>Creating and Deploying a Docker image</title> |
577 | 521 | ||
578 | <para>Update and Extend your Extensible SDK:</para> | 522 | <para>Docker can build images automatically by reading the instructions |
523 | from a Dockerfile. A Dockerfile is a text document that contains all the | ||
524 | commands a user could call on the command line to assemble an image. For | ||
525 | detailed info about docker, please refer to the <ulink | ||
526 | url="https://docs.docker.com/">Docker documentation.</ulink></para> | ||
579 | 527 | ||
580 | <orderedlist> | 528 | <orderedlist> |
581 | <listitem> | 529 | <listitem> |
582 | <para>Update your SDK</para> | 530 | <para>Create a Dockefile for helloworld:</para> |
531 | |||
532 | <programlisting>####################################### | ||
533 | # helloworld example Dockerfile | ||
534 | ######################################## | ||
583 | 535 | ||
584 | <programlisting>$ devtool sdk-update [url]</programlisting> | 536 | FROM ubuntu |
537 | MAINTAINER John Smith <John.Smith@gmail.com> | ||
538 | LABEL version="0.1" description="Helloworld example" | ||
585 | 539 | ||
586 | <para>The recipe build results can be seen here: | 540 | COPY path/to/helloworld /helloworld |
587 | <literal><SDK_dir>/tmp/work/<arch>-enea-linux/my-hello-recipe/1.0-r0/</literal></para> | 541 | |
542 | CMD /helloworld</programlisting> | ||
543 | |||
544 | <note> | ||
545 | <para>Don't forget to add required dependecies for the recipe in | ||
546 | the docker image as well. As we saw in the previous example isic | ||
547 | depended on libnet so we had to build and deploy libnet to target | ||
548 | separately. The same needs to be done here, e.g. if you build a | ||
549 | docker image for isic, you need to add libnet to the container | ||
550 | filesystem.</para> | ||
551 | </note> | ||
588 | </listitem> | 552 | </listitem> |
589 | 553 | ||
590 | <listitem> | 554 | <listitem> |
591 | <para>Extend your SDK</para> | 555 | <para>Build it:</para> |
592 | 556 | ||
593 | <programlisting>$ devtool search package-name | 557 | <programlisting>$ docker build . |
594 | $ devtool sdk -install [-s] recipe-name | 558 | ..... |
595 | Ex: | 559 | Successfully built fb7d03c7cba1</programlisting> |
596 | $ devtool sdk-install meta-extsdk-toolchain</programlisting> | 560 | </listitem> |
561 | |||
562 | <listitem> | ||
563 | <para>Run the docker image:</para> | ||
597 | 564 | ||
598 | <para>The recipe build results can be seen here: | 565 | <programlisting>$ docker run --name helloworld fb7d03c7cba1 |
599 | <literal><SDK_dir>/tmp/work/<arch>-enea-linux/my-hello-recipe/1.0-r0/</literal></para> | 566 | Hello World run from host!!</programlisting> |
600 | </listitem> | 567 | </listitem> |
601 | </orderedlist> | ||
602 | </section> | ||
603 | 568 | ||
604 | <section id="deploy-artifacts-esdk"> | 569 | <listitem> |
605 | <title>Deploying your artifacts</title> | 570 | <para>Save:</para> |
606 | 571 | ||
607 | <para>You can use <literal>ssh</literal> to deploy your artifacts on the | 572 | <programlisting>$ docker save fb7d03c7cba1 | gzip > helloworld.tar.gz</programlisting> |
608 | host target. For this you will need a network connection to the target | 573 | </listitem> |
609 | device: </para> | ||
610 | 574 | ||
611 | <programlisting>$ devtool deploytarget myapp device</programlisting> | 575 | <listitem> |
612 | </section> | 576 | <para>Deploy to target:</para> |
577 | |||
578 | <programlisting>$ scp helloworld.tar.gz root@<target IP-address>:/home/root</programlisting> | ||
579 | </listitem> | ||
580 | |||
581 | <listitem> | ||
582 | <para>Load the docker image on target:</para> | ||
583 | |||
584 | <programlisting>root@xeon-d:~# docker load -i helloworld.tar.gz</programlisting> | ||
585 | </listitem> | ||
586 | |||
587 | <listitem> | ||
588 | <para>List docker images:</para> | ||
613 | 589 | ||
614 | <section id="create_docker_image"> | 590 | <programlisting>root@xeon-d:~# docker images |
615 | <title>Creating and Deploying a Docker image </title> | 591 | REPOSITORY TAG IMAGE ID CREATED SIZE |
592 | <none> <none> fb7d03c7cba1 3 hours ago 79.6MB</programlisting> | ||
593 | </listitem> | ||
594 | |||
595 | <listitem> | ||
596 | <para>Run the docker image:</para> | ||
616 | 597 | ||
617 | <para>You can build a docker image ....</para> | 598 | <programlisting>root@xeon-d:~# docker run fb7d03c7cba1 |
599 | Hello World run from inside docker target!!</programlisting> | ||
600 | </listitem> | ||
601 | </orderedlist> | ||
618 | </section> | 602 | </section> |
619 | </section> | 603 | </section> |
620 | </chapter> \ No newline at end of file | 604 | </chapter> \ No newline at end of file |