11ab07743SBernard Iremonger.. BSD LICENSE 2b932ebcbSQian Xu Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 31ab07743SBernard Iremonger All rights reserved. 41ab07743SBernard Iremonger 51ab07743SBernard Iremonger Redistribution and use in source and binary forms, with or without 61ab07743SBernard Iremonger modification, are permitted provided that the following conditions 71ab07743SBernard Iremonger are met: 81ab07743SBernard Iremonger 91ab07743SBernard Iremonger * Redistributions of source code must retain the above copyright 101ab07743SBernard Iremonger notice, this list of conditions and the following disclaimer. 111ab07743SBernard Iremonger * Redistributions in binary form must reproduce the above copyright 121ab07743SBernard Iremonger notice, this list of conditions and the following disclaimer in 131ab07743SBernard Iremonger the documentation and/or other materials provided with the 141ab07743SBernard Iremonger distribution. 151ab07743SBernard Iremonger * Neither the name of Intel Corporation nor the names of its 161ab07743SBernard Iremonger contributors may be used to endorse or promote products derived 171ab07743SBernard Iremonger from this software without specific prior written permission. 181ab07743SBernard Iremonger 191ab07743SBernard Iremonger THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 201ab07743SBernard Iremonger "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 211ab07743SBernard Iremonger LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 221ab07743SBernard Iremonger A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 231ab07743SBernard Iremonger OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 241ab07743SBernard Iremonger SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 251ab07743SBernard Iremonger LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 261ab07743SBernard Iremonger DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 271ab07743SBernard Iremonger THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 281ab07743SBernard Iremonger (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 291ab07743SBernard Iremonger OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 301ab07743SBernard Iremonger 313b60ce8cSJohn McNamara.. _linux_gsg_compiling_dpdk: 323b60ce8cSJohn McNamara 332e486e26SSiobhan ButlerCompiling the DPDK Target from Source 342e486e26SSiobhan Butler===================================== 351ab07743SBernard Iremonger 361ab07743SBernard Iremonger.. note:: 371ab07743SBernard Iremonger 3829c67340SJohn McNamara Parts of this process can also be done using the setup script described in 3929c67340SJohn McNamara the :ref:`linux_setup_script` section of this document. 401ab07743SBernard Iremonger 412e486e26SSiobhan ButlerInstall the DPDK and Browse Sources 422e486e26SSiobhan Butler----------------------------------- 431ab07743SBernard Iremonger 442e486e26SSiobhan ButlerFirst, uncompress the archive and move to the uncompressed DPDK source directory: 451ab07743SBernard Iremonger 461ab07743SBernard Iremonger.. code-block:: console 471ab07743SBernard Iremonger 48d1c34b5bSBaruch Siach tar xJf dpdk-<version>.tar.xz 49d1c34b5bSBaruch Siach cd dpdk-<version> 5029c67340SJohn McNamara 512e486e26SSiobhan ButlerThe DPDK is composed of several directories: 521ab07743SBernard Iremonger 532e486e26SSiobhan Butler* lib: Source code of DPDK libraries 541ab07743SBernard Iremonger 55980ed498SBruce Richardson* drivers: Source code of DPDK poll-mode drivers 56980ed498SBruce Richardson 572e486e26SSiobhan Butler* app: Source code of DPDK applications (automatic tests) 581ab07743SBernard Iremonger 592e486e26SSiobhan Butler* examples: Source code of DPDK application examples 601ab07743SBernard Iremonger 61c6dab2a8SThomas Monjalon* config, buildtools, mk: Framework-related makefiles, scripts and configuration 621ab07743SBernard Iremonger 632e486e26SSiobhan ButlerInstallation of DPDK Target Environments 642e486e26SSiobhan Butler---------------------------------------- 651ab07743SBernard Iremonger 6629c67340SJohn McNamaraThe format of a DPDK target is:: 671ab07743SBernard Iremonger 681ab07743SBernard Iremonger ARCH-MACHINE-EXECENV-TOOLCHAIN 691ab07743SBernard Iremonger 701ab07743SBernard Iremongerwhere: 711ab07743SBernard Iremonger 72*f8277965SBrian Brooks* ``ARCH`` can be: ``i686``, ``x86_64``, ``ppc_64``, ``arm64`` 731ab07743SBernard Iremonger 74*f8277965SBrian Brooks* ``MACHINE`` can be: ``native``, ``power8``, ``armv8a`` 751ab07743SBernard Iremonger 7629c67340SJohn McNamara* ``EXECENV`` can be: ``linuxapp``, ``bsdapp`` 771ab07743SBernard Iremonger 7829c67340SJohn McNamara* ``TOOLCHAIN`` can be: ``gcc``, ``icc`` 791ab07743SBernard Iremonger 801ab07743SBernard IremongerThe targets to be installed depend on the 32-bit and/or 64-bit packages and compilers installed on the host. 811ab07743SBernard IremongerAvailable targets can be found in the DPDK/config directory. 821ab07743SBernard IremongerThe defconfig\_ prefix should not be used. 831ab07743SBernard Iremonger 841ab07743SBernard Iremonger.. note:: 851ab07743SBernard Iremonger 8629c67340SJohn McNamara Configuration files are provided with the ``RTE_MACHINE`` optimization level set. 8729c67340SJohn McNamara Within the configuration files, the ``RTE_MACHINE`` configuration value is set to native, 881ab07743SBernard Iremonger which means that the compiled software is tuned for the platform on which it is built. 892e486e26SSiobhan Butler For more information on this setting, and its possible values, see the *DPDK Programmers Guide*. 901ab07743SBernard Iremonger 911ab07743SBernard IremongerWhen using the Intel® C++ Compiler (icc), one of the following commands should be invoked for 64-bit or 32-bit use respectively. 9229c67340SJohn McNamaraNotice that the shell scripts update the ``$PATH`` variable and therefore should not be performed in the same session. 931ab07743SBernard IremongerAlso, verify the compiler's installation directory since the path may be different: 941ab07743SBernard Iremonger 951ab07743SBernard Iremonger.. code-block:: console 961ab07743SBernard Iremonger 971ab07743SBernard Iremonger source /opt/intel/bin/iccvars.sh intel64 981ab07743SBernard Iremonger source /opt/intel/bin/iccvars.sh ia32 991ab07743SBernard Iremonger 10029c67340SJohn McNamaraTo install and make targets, use the ``make install T=<target>`` command in the top-level DPDK directory. 1011ab07743SBernard Iremonger 1021ab07743SBernard IremongerFor example, to compile a 64-bit target using icc, run: 1031ab07743SBernard Iremonger 1041ab07743SBernard Iremonger.. code-block:: console 1051ab07743SBernard Iremonger 1061ab07743SBernard Iremonger make install T=x86_64-native-linuxapp-icc 1071ab07743SBernard Iremonger 1081ab07743SBernard IremongerTo compile a 32-bit build using gcc, the make command should be: 1091ab07743SBernard Iremonger 1101ab07743SBernard Iremonger.. code-block:: console 1111ab07743SBernard Iremonger 1121ab07743SBernard Iremonger make install T=i686-native-linuxapp-gcc 1131ab07743SBernard Iremonger 1141ab07743SBernard IremongerTo prepare a target without building it, for example, if the configuration changes need to be made before compilation, 11529c67340SJohn McNamarause the ``make config T=<target>`` command: 1161ab07743SBernard Iremonger 1171ab07743SBernard Iremonger.. code-block:: console 1181ab07743SBernard Iremonger 1191ab07743SBernard Iremonger make config T=x86_64-native-linuxapp-gcc 1201ab07743SBernard Iremonger 1211ab07743SBernard Iremonger.. warning:: 1221ab07743SBernard Iremonger 12329c67340SJohn McNamara Any kernel modules to be used, e.g. ``igb_uio``, ``kni``, must be compiled with the 124974438fbSBruce Richardson same kernel as the one running on the target. 1252e486e26SSiobhan Butler If the DPDK is not being built on the target machine, 12629c67340SJohn McNamara the ``RTE_KERNELDIR`` environment variable should be used to point the compilation at a copy of the kernel version to be used on the target machine. 1271ab07743SBernard Iremonger 1281ab07743SBernard IremongerOnce the target environment is created, the user may move to the target environment directory and continue to make code changes and re-compile. 1292e486e26SSiobhan ButlerThe user may also make modifications to the compile-time DPDK configuration by editing the .config file in the build directory. 1301ab07743SBernard Iremonger(This is a build-local copy of the defconfig file from the top- level config directory). 1311ab07743SBernard Iremonger 1321ab07743SBernard Iremonger.. code-block:: console 1331ab07743SBernard Iremonger 1341ab07743SBernard Iremonger cd x86_64-native-linuxapp-gcc 1351ab07743SBernard Iremonger vi .config 1361ab07743SBernard Iremonger make 1371ab07743SBernard Iremonger 1381ab07743SBernard IremongerIn addition, the make clean command can be used to remove any existing compiled files for a subsequent full, clean rebuild of the code. 1391ab07743SBernard Iremonger 1402e486e26SSiobhan ButlerBrowsing the Installed DPDK Environment Target 1412e486e26SSiobhan Butler---------------------------------------------- 1421ab07743SBernard Iremonger 143980ed498SBruce RichardsonOnce a target is created it contains all libraries, including poll-mode drivers, and header files for the DPDK environment that are required to build customer applications. 1441ab07743SBernard IremongerIn addition, the test and testpmd applications are built under the build/app directory, which may be used for testing. 145980ed498SBruce RichardsonA kmod directory is also present that contains kernel modules which may be loaded if needed. 146