diff options
-rw-r--r-- | doc/book-enea-nfv-access-guide/doc/using_nfv_access_sdks.xml | 95 |
1 files changed, 47 insertions, 48 deletions
diff --git a/doc/book-enea-nfv-access-guide/doc/using_nfv_access_sdks.xml b/doc/book-enea-nfv-access-guide/doc/using_nfv_access_sdks.xml index 4b10d2a..13ae3b7 100644 --- a/doc/book-enea-nfv-access-guide/doc/using_nfv_access_sdks.xml +++ b/doc/book-enea-nfv-access-guide/doc/using_nfv_access_sdks.xml | |||
@@ -1,4 +1,4 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | 2 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
4 | <chapter id="workflow"> | 4 | <chapter id="workflow"> |
@@ -32,17 +32,16 @@ | |||
32 | 32 | ||
33 | <itemizedlist> | 33 | <itemizedlist> |
34 | <listitem> | 34 | <listitem> |
35 | <para>x86_64/install/install-sdk.sh</para> | 35 | <para>aarch/install/install-sdk.sh</para> |
36 | </listitem> | 36 | </listitem> |
37 | </itemizedlist> | 37 | </itemizedlist> |
38 | 38 | ||
39 | <para>After installing the SDK, a developer will be able to compile and | 39 | <para>After installing the SDK, a developer will be able to compile and |
40 | generate executables for the preferred target machine. Cross-gdb | 40 | generate executables for the preferred target machine. Cross-gdb |
41 | (<filename>x86_64-enea-linux-gdb</filename>) is created by the | 41 | (<filename>enea-linux-gdb</filename>) is created by the Cross-Development |
42 | Cross-Development toolchain. It can be used to debug applications on the | 42 | toolchain. It can be used to debug applications on the target platform from |
43 | target platform from the development workstation. For kernel debugging, | 43 | the development workstation. For kernel debugging, <command>ftrace</command> |
44 | <command>ftrace</command> and <command>kgdb</command> are enabled on the | 44 | and <command>kgdb</command> are enabled on the host sdk image.</para> |
45 | host sdk image.</para> | ||
46 | 45 | ||
47 | <para>Various user-space tools helpful in the development process, are also | 46 | <para>Various user-space tools helpful in the development process, are also |
48 | provided. The tools include <emphasis role="bold">LatencyTop</emphasis>, | 47 | provided. The tools include <emphasis role="bold">LatencyTop</emphasis>, |
@@ -79,7 +78,7 @@ | |||
79 | 78 | ||
80 | <listitem> | 79 | <listitem> |
81 | <para>Setup the toolchain environment for your target by sourcing the | 80 | <para>Setup the toolchain environment for your target by sourcing the |
82 | environment-setup script. Example: <programlisting>$ source sdkdir/environment-setup-corei7-64-enea-linux</programlisting></para> | 81 | environment-setup script. Example: <programlisting>$ source sdkdir/environment-setup-aarch64-enea-linux</programlisting></para> |
83 | </listitem> | 82 | </listitem> |
84 | </orderedlist> | 83 | </orderedlist> |
85 | </section> | 84 | </section> |
@@ -100,7 +99,7 @@ | |||
100 | $(CC) -o helloworld helloworld.o | 99 | $(CC) -o helloworld helloworld.o |
101 | clean: | 100 | clean: |
102 | rm -f *.o helloworld | 101 | rm -f *.o helloworld |
103 | #include stdio.h; | 102 | #include <stdio.h> |
104 | int main(void) { | 103 | int main(void) { |
105 | printf("Hello World\n"); | 104 | printf("Hello World\n"); |
106 | return 0; | 105 | return 0; |
@@ -117,7 +116,7 @@ int main(void) { | |||
117 | <listitem> | 116 | <listitem> |
118 | <para>Deploy the helloworld program to your target and run it:</para> | 117 | <para>Deploy the helloworld program to your target and run it:</para> |
119 | 118 | ||
120 | <programlisting># ./helloworld | 119 | <programlisting>root@cn8304:~# ./helloworld |
121 | hello world</programlisting> | 120 | hello world</programlisting> |
122 | </listitem> | 121 | </listitem> |
123 | </orderedlist> | 122 | </orderedlist> |
@@ -151,9 +150,9 @@ scripts: | |||
151 | $(MAKE) -C $(KERNEL_SRC) scripts | 150 | $(MAKE) -C $(KERNEL_SRC) scripts |
152 | clean: | 151 | clean: |
153 | $(MAKE) -C $(KERNEL_SRC) M=$(PWD) LDFLAGS="" clean | 152 | $(MAKE) -C $(KERNEL_SRC) M=$(PWD) LDFLAGS="" clean |
154 | #include linux/module.h /* Needed by all modules */ | 153 | #include <linux/module.h> /* Needed by all modules */ |
155 | #include linux/kernel.h /* Needed for KERN_INFO */ | 154 | #include <linux/kernel.h> /* Needed for KERN_INFO */ |
156 | #include linux/init.h /* Needed for the macros */ | 155 | #include <linux/init.h> /* Needed for the macros */ |
157 | 156 | ||
158 | static int __init hello_start(void) | 157 | static int __init hello_start(void) |
159 | { | 158 | { |
@@ -184,9 +183,9 @@ MODULE_LICENSE("GPL");</programlisting> | |||
184 | <para>Deploy the kernel module <literal>hello.ko</literal> to your | 183 | <para>Deploy the kernel module <literal>hello.ko</literal> to your |
185 | target and install/remove it:</para> | 184 | target and install/remove it:</para> |
186 | 185 | ||
187 | <programlisting># insmod hello.ko | 186 | <programlisting>root@cn8304:~# insmod hello.ko |
188 | # rmmod hello.ko | 187 | root@cn8304:~# rmmod hello.ko |
189 | # dmesg | 188 | root@cn8304:~# dmesg |
190 | [...] Loading hello module... | 189 | [...] Loading hello module... |
191 | [...] Hello, world | 190 | [...] Hello, world |
192 | [...] Goodbye, world</programlisting> | 191 | [...] Goodbye, world</programlisting> |
@@ -204,7 +203,7 @@ MODULE_LICENSE("GPL");</programlisting> | |||
204 | host target. For this you will need a network connection to the target, | 203 | host target. For this you will need a network connection to the target, |
205 | to use <literal>scp</literal> to copy to the desired location.</para> | 204 | to use <literal>scp</literal> to copy to the desired location.</para> |
206 | 205 | ||
207 | <para><programlisting># scp helloworld root@<target_ip_address>:/tmp</programlisting></para> | 206 | <para><programlisting>$ scp helloworld root@<target_ip_address>:/tmp</programlisting></para> |
208 | </section> | 207 | </section> |
209 | 208 | ||
210 | <section id="deploy_onguest"> | 209 | <section id="deploy_onguest"> |
@@ -228,7 +227,7 @@ MODULE_LICENSE("GPL");</programlisting> | |||
228 | <para>On the host, run the <literal>qemu-ifup</literal> script | 227 | <para>On the host, run the <literal>qemu-ifup</literal> script |
229 | located in <literal>/etc</literal> directory:</para> | 228 | located in <literal>/etc</literal> directory:</para> |
230 | 229 | ||
231 | <para><programlisting># /etc/qemu-ifup –t tap0 –a 192.168.122.10 –p 1050 –g 22</programlisting></para> | 230 | <para><programlisting>root@cn8304:~# /etc/qemu-ifup –t tap0 –a 192.168.122.10 –p 1050 –g 22</programlisting></para> |
232 | 231 | ||
233 | <itemizedlist> | 232 | <itemizedlist> |
234 | <listitem> | 233 | <listitem> |
@@ -269,15 +268,15 @@ MODULE_LICENSE("GPL");</programlisting> | |||
269 | device and set the default gateway as the <literal>virbr0</literal> | 268 | device and set the default gateway as the <literal>virbr0</literal> |
270 | ip address:</para> | 269 | ip address:</para> |
271 | 270 | ||
272 | <para><programlisting>ip addr add 192.168.122.10/24 dev enp0s2 | 271 | <para><programlisting>root@qemuarm64:~# ip addr add 192.168.122.10/24 dev enp0s2 |
273 | ip link set enp0s2 up | 272 | root@qemuarm64:~# ip link set enp0s2 up |
274 | ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | 273 | root@qemuarm64:~# ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> |
275 | </listitem> | 274 | </listitem> |
276 | 275 | ||
277 | <listitem> | 276 | <listitem> |
278 | <para>Now you can use <literal>scp</literal> from your development | 277 | <para>Now you can use <literal>scp</literal> from your development |
279 | machine to deploy your artifacts on the guest, by giving the host | 278 | machine to deploy your artifacts on the guest, by giving the host |
280 | port for forwarding as a command parameter: <programlisting>scp -P 1050 helloworld root@target_ip_address:/tmp</programlisting></para> | 279 | port for forwarding as a command parameter: <programlisting>$ scp -P 1050 helloworld root@target_ip_address:/tmp</programlisting></para> |
281 | </listitem> | 280 | </listitem> |
282 | 281 | ||
283 | <listitem> | 282 | <listitem> |
@@ -285,9 +284,9 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
285 | stopping the virtual machine, you can use the | 284 | stopping the virtual machine, you can use the |
286 | <literal>qemu-ifdown</literal> script to clean up the configuration | 285 | <literal>qemu-ifdown</literal> script to clean up the configuration |
287 | on host. The following command will remove the tap interface and all | 286 | on host. The following command will remove the tap interface and all |
288 | the iptables rules for the specific ip address: <programlisting># /etc/qemu-ifdown –t tap0 –a 192.168.122.10</programlisting>If | 287 | the iptables rules for the specific ip address: <programlisting>root@qemuarm64:~# /etc/qemu-ifdown –t tap0 –a 192.168.122.10</programlisting>If |
289 | we need to remove only a particular port forwarding rule from | 288 | we need to remove only a particular port forwarding rule from |
290 | iptables, this should be run: <programlisting># /etc/qemu-ifdown –t tap0 –a 192.168.122.10 –p 1050 –g 22</programlisting></para> | 289 | iptables, this should be run: <programlisting>root@qemuarm64:~# /etc/qemu-ifdown –t tap0 –a 192.168.122.10 –p 1050 –g 22</programlisting></para> |
291 | </listitem> | 290 | </listitem> |
292 | </orderedlist> | 291 | </orderedlist> |
293 | </section> | 292 | </section> |
@@ -296,19 +295,19 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
296 | <section id="crossdebugging"> | 295 | <section id="crossdebugging"> |
297 | <title>Cross-Debugging on Enea NFV Access</title> | 296 | <title>Cross-Debugging on Enea NFV Access</title> |
298 | 297 | ||
299 | <para>The cross-debugger (<literal>x86_64-enea-linux-gdb</literal>) is | 298 | <para>The cross-debugger (<literal>enea-linux-gdb</literal>) is created |
300 | created when installing the SDK on the development machine. It is helpful | 299 | when installing the SDK on the development machine. It is helpful for |
301 | for debugging both the kernel and user-applications. In order to perform | 300 | debugging both the kernel and user-applications. In order to perform this |
302 | this task, we need the following tools to be available on the target | 301 | task, we need the following tools to be available on the target |
303 | machine:</para> | 302 | machine:</para> |
304 | 303 | ||
305 | <itemizedlist> | 304 | <itemizedlist> |
306 | <listitem> | 305 | <listitem> |
307 | <para>Kgdb – for kernel cross-debugging</para> | 306 | <para>Kgdb – for kernel cross-debugging</para> |
308 | </listitem> | 307 | </listitem> |
309 | 308 | ||
310 | <listitem> | 309 | <listitem> |
311 | <para>GDBServer – for application cross-debugging</para> | 310 | <para>GDBServer – for application cross-debugging</para> |
312 | </listitem> | 311 | </listitem> |
313 | </itemizedlist> | 312 | </itemizedlist> |
314 | 313 | ||
@@ -326,10 +325,10 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
326 | GDBServer and cross-gdb.</para> | 325 | GDBServer and cross-gdb.</para> |
327 | 326 | ||
328 | <para>On target, launch the GDBServer, specifying how to communicate | 327 | <para>On target, launch the GDBServer, specifying how to communicate |
329 | with GDB and the name of your program:<programlisting># gdbserver :<port_no> /tmp/helloworld</programlisting>The | 328 | with GDB and the name of your program:<programlisting>root@cn8304:~# gdbserver :<port_no> /tmp/helloworld</programlisting>The |
330 | target will now be listening on the port given as a parameter to the | 329 | target will now be listening on the port given as a parameter to the |
331 | gdbserver. On the development machine, from the | 330 | gdbserver. On the development machine, from the |
332 | <literal><sdkdir></literal>, start the cross-gdb:<programlisting># x86_64-enea-linux-gdb <path_to_the_program>/helloworld</programlisting>Connect | 331 | <literal><sdkdir></literal>, start the cross-gdb:<programlisting>$ enea-linux-gdb <path_to_the_program>/helloworld</programlisting>Connect |
333 | the GDB to the target: <programlisting>(gdb) target remote <target_ip_address>:<port_no></programlisting>Now | 332 | the GDB to the target: <programlisting>(gdb) target remote <target_ip_address>:<port_no></programlisting>Now |
334 | remote debugging is started and the GDB commands are available to debug | 333 | remote debugging is started and the GDB commands are available to debug |
335 | your program from the target machine.</para> | 334 | your program from the target machine.</para> |
@@ -351,7 +350,7 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
351 | <orderedlist> | 350 | <orderedlist> |
352 | <listitem> | 351 | <listitem> |
353 | <para>On the host, run the script <literal>qemu-ifup</literal> | 352 | <para>On the host, run the script <literal>qemu-ifup</literal> |
354 | located in <literal>/etc</literal> directory: <programlisting># /etc/qemu-ifup –t tap0 –a 192.168.122.10 –p 1051 –g 1025</programlisting></para> | 353 | located in <literal>/etc</literal> directory: <programlisting>root@cn8304:~# /etc/qemu-ifup –t tap0 –a 192.168.122.10 –p 1051 –g 1025</programlisting></para> |
355 | 354 | ||
356 | <itemizedlist> | 355 | <itemizedlist> |
357 | <listitem> | 356 | <listitem> |
@@ -367,14 +366,14 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
367 | </listitem> | 366 | </listitem> |
368 | 367 | ||
369 | <listitem> | 368 | <listitem> |
370 | <para><emphasis role="bold">1051</emphasis> – the host | 369 | <para><emphasis role="bold">1051</emphasis> – the host port |
371 | port which is set to forward traffic from the host to the guest | 370 | which is set to forward traffic from the host to the guest and |
372 | and is used by gdb target remote command.</para> | 371 | is used by gdb target remote command.</para> |
373 | </listitem> | 372 | </listitem> |
374 | 373 | ||
375 | <listitem> | 374 | <listitem> |
376 | <para><emphasis role="bold">1025</emphasis>– the port used | 375 | <para><emphasis role="bold">1025</emphasis>– the port used by |
377 | by GDBServer on guest for listening.</para> | 376 | GDBServer on guest for listening.</para> |
378 | </listitem> | 377 | </listitem> |
379 | </itemizedlist> | 378 | </itemizedlist> |
380 | </listitem> | 379 | </listitem> |
@@ -388,23 +387,23 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
388 | <listitem> | 387 | <listitem> |
389 | <para>On the guest, after logging, configure the virtual network | 388 | <para>On the guest, after logging, configure the virtual network |
390 | device and set the default gateway to virbr0 ip | 389 | device and set the default gateway to virbr0 ip |
391 | address:<programlisting>ip addr add 192.168.122.10/24 dev enp0s2 | 390 | address:<programlisting>root@qemuarm64:~# ip addr add 192.168.122.10/24 dev enp0s2 |
392 | ip link set enp0s2 up | 391 | root@qemuarm64:~# ip link set enp0s2 up |
393 | ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | 392 | root@qemuarm64:~# ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> |
394 | </listitem> | 393 | </listitem> |
395 | 394 | ||
396 | <listitem> | 395 | <listitem> |
397 | <para>GDBserver is the program which runs on the guest VM and allows | 396 | <para>GDBserver is the program which runs on the guest VM and allows |
398 | you to run GDB on your workstation. On the guest, launch GBDserver | 397 | you to run GDB on your workstation. On the guest, launch GBDserver |
399 | specifying how to communicate with GDB and the name of your program: | 398 | specifying how to communicate with GDB and the name of your program: |
400 | <programlisting># gdbserver :1025 /tmp/helloworld</programlisting>The | 399 | <programlisting>root@qemuarm64:~# gdbserver :1025 /tmp/helloworld</programlisting>The |
401 | guest is now listening on port 1025, given as a parameter to the | 400 | guest is now listening on port 1025, given as a parameter to the |
402 | gdbserver.</para> | 401 | gdbserver.</para> |
403 | </listitem> | 402 | </listitem> |
404 | 403 | ||
405 | <listitem> | 404 | <listitem> |
406 | <para>On the development machine, from the<filename> | 405 | <para>On the development machine, from the<filename> |
407 | <sdkdir></filename>, start the cross-gdb:<programlisting># x86_64-enea-linux-gdb <path_to_the_program>/helloworld</programlisting></para> | 406 | <sdkdir></filename>, start the cross-gdb:<programlisting>$ enea-linux-gdb <path_to_the_program>/helloworld</programlisting></para> |
408 | </listitem> | 407 | </listitem> |
409 | 408 | ||
410 | <listitem> | 409 | <listitem> |
@@ -417,7 +416,7 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
417 | <para>On the host, after finishing the cross-debugging session and | 416 | <para>On the host, after finishing the cross-debugging session and |
418 | stopping the virtual machine, you can use the | 417 | stopping the virtual machine, you can use the |
419 | <filename>qemu-ifdown</filename> script to clean up the | 418 | <filename>qemu-ifdown</filename> script to clean up the |
420 | configuration on host:<programlisting># /etc/qemu-ifdown -t tap0 -a 192.168.122.10</programlisting></para> | 419 | configuration on host:<programlisting>root@cn8304:~# /etc/qemu-ifdown -t tap0 -a 192.168.122.10</programlisting></para> |
421 | </listitem> | 420 | </listitem> |
422 | </orderedlist> | 421 | </orderedlist> |
423 | </section> | 422 | </section> |
@@ -436,12 +435,12 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
436 | <itemizedlist> | 435 | <itemizedlist> |
437 | <listitem> | 436 | <listitem> |
438 | <para>On target, once serial communication is established, configure | 437 | <para>On target, once serial communication is established, configure |
439 | <literal>kgdboc</literal> after the kernel boots:<programlisting># echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc</programlisting></para> | 438 | <literal>kgdboc</literal> after the kernel boots:<programlisting>root@cn8304:~# echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc</programlisting></para> |
440 | </listitem> | 439 | </listitem> |
441 | 440 | ||
442 | <listitem> | 441 | <listitem> |
443 | <para>In order to connect to gdb via kgdboc, the kernel must first | 442 | <para>In order to connect to gdb via kgdboc, the kernel must first |
444 | be stopped:<programlisting># echo g > /proc/sysrq-trigger</programlisting></para> | 443 | be stopped:<programlisting>root@cn8304:~# echo g > /proc/sysrq-trigger</programlisting></para> |
445 | </listitem> | 444 | </listitem> |
446 | 445 | ||
447 | <listitem> | 446 | <listitem> |
@@ -454,8 +453,8 @@ ip route add default via 192.168.122.1 dev enp0s2</programlisting></para> | |||
454 | kernel image as a parameter. The image is located in | 453 | kernel image as a parameter. The image is located in |
455 | <filename><sdkdir>/sysroots/corei7-64-enea-linux/boot/</filename> | 454 | <filename><sdkdir>/sysroots/corei7-64-enea-linux/boot/</filename> |
456 | and should be the same as the image found in the | 455 | and should be the same as the image found in the |
457 | <literal>/boot</literal> directory from the target.<programlisting># x86_64-enea-linux-gdb / | 456 | <literal>/boot</literal> directory from the target.<programlisting>$ enea-linux-gdb / |
458 | ./sysroots/corei7-64-enea-linux/boot/vmlinux-4.9.30-intel-pk-standard</programlisting></para> | 457 | ./sysroots/aarch64-enea-linux/boot/vmlinux-4.9.0-octeontx.sdk.6.1.0.p3.build.22-cavium-tiny</programlisting></para> |
459 | </listitem> | 458 | </listitem> |
460 | 459 | ||
461 | <listitem> | 460 | <listitem> |