diff options
Diffstat (limited to 'poky/documentation/sdk-manual/extensible.rst')
-rw-r--r-- | poky/documentation/sdk-manual/extensible.rst | 195 |
1 files changed, 84 insertions, 111 deletions
diff --git a/poky/documentation/sdk-manual/extensible.rst b/poky/documentation/sdk-manual/extensible.rst index baa432ef3..5520a0718 100644 --- a/poky/documentation/sdk-manual/extensible.rst +++ b/poky/documentation/sdk-manual/extensible.rst @@ -15,9 +15,8 @@ hardware, and ease integration into the rest of the .. note:: For a side-by-side comparison of main features supported for an - extensible SDK as compared to a standard SDK, see the " - Introduction - " section. + extensible SDK as compared to a standard SDK, see the + :ref:`sdk-manual/intro:introduction` section. In addition to the functionality available through ``devtool``, you can alternatively make use of the toolchain directly, for example from @@ -59,8 +58,7 @@ The names of the tarball installer scripts are such that a string representing the host system appears first in the filename and then is immediately followed by a string representing the target architecture. An extensible SDK has the string "-ext" as part of the name. Following -is the general form: -:: +is the general form:: poky-glibc-host_system-image_type-arch-toolchain-ext-release_version.sh @@ -83,17 +81,16 @@ is the general form: For example, the following SDK installer is for a 64-bit development host system and a i586-tuned target architecture based off -the SDK for ``core-image-sato`` and using the current &DISTRO; snapshot: -:: +the SDK for ``core-image-sato`` and using the current &DISTRO; snapshot:: poky-glibc-x86_64-core-image-sato-i586-toolchain-ext-&DISTRO;.sh .. note:: As an alternative to downloading an SDK, you can build the SDK - installer. For information on building the installer, see the " - Building an SDK Installer - " section. + installer. For information on building the installer, see the + :ref:`sdk-manual/appendix-obtain:building an sdk installer` + section. The SDK and toolchains are self-contained and by default are installed into the ``poky_sdk`` folder in your home directory. You can choose to @@ -150,8 +147,7 @@ begin with the string "``environment-setup``" and include as part of their name the tuned target architecture. As an example, the following commands set the working directory to where the SDK was installed and then source the environment setup script. In this example, the setup -script is for an IA-based target machine using i586 tuning: -:: +script is for an IA-based target machine using i586 tuning:: $ cd /home/scottrif/poky_sdk $ source environment-setup-core2-64-poky-linux @@ -197,7 +193,7 @@ all the commands. devtool quick reference. -Three ``devtool`` subcommands exist that provide entry-points into +Three ``devtool`` subcommands provide entry-points into development: - *devtool add*: Assists in adding new software to be built. @@ -258,8 +254,7 @@ command: to be extracted. In this situation, the source code is extracted to the default workspace - you do not want the files in some specific location outside of the workspace. Thus, everything you - need will be located in the workspace: - :: + need will be located in the workspace:: $ devtool add recipe fetchuri @@ -280,28 +275,26 @@ command: devtool always creates a Git repository locally during the extraction. - Furthermore, the first positional argument srctree in this case + Furthermore, the first positional argument ``srctree`` in this case identifies where the ``devtool add`` command will locate the extracted code outside of the workspace. You need to specify an - empty directory: - :: + empty directory:: $ devtool add recipe srctree fetchuri In summary, the source code is pulled from fetchuri and extracted into the - location defined by srctree as a local Git repository. + location defined by ``srctree`` as a local Git repository. Within workspace, ``devtool`` creates a recipe named recipe along with an associated append file. - *Right*: The right scenario in the figure represents a situation - where the srctree has been previously prepared outside of the + where the ``srctree`` has been previously prepared outside of the ``devtool`` workspace. The following command provides a new recipe name and identifies - the existing source tree location: - :: + the existing source tree location:: $ devtool add recipe srctree @@ -317,8 +310,7 @@ command: 2. *Edit the Recipe*: You can use ``devtool edit-recipe`` to open up the editor as defined by the ``$EDITOR`` environment variable and modify - the file: - :: + the file:: $ devtool edit-recipe recipe @@ -338,8 +330,7 @@ command: On the other hand, if you want an image to contain the recipe's packages from the workspace for immediate deployment onto a device (e.g. for testing purposes), you can use the ``devtool build-image`` - command: - :: + command:: $ devtool build-image image @@ -435,8 +426,7 @@ command: outside the workspace (i.e. ``meta-``\ layername). The following command identifies the recipe and, by default, - extracts the source files: - :: + extracts the source files:: $ devtool modify recipe @@ -446,9 +436,9 @@ command: locate the source code and any local patch files from other developers. - With this scenario, no srctree argument exists. Consequently, the + With this scenario, there is no ``srctree`` argument. Consequently, the default behavior of the ``devtool modify`` command is to extract - the source files pointed to by the ``SRC_URI`` statements into a + the source files pointed to by the :term:`SRC_URI` statements into a local Git structure. Furthermore, the location for the extracted source is the default area within the ``devtool`` workspace. The result is that the command sets up both the source code and an @@ -456,7 +446,7 @@ command: original location. Additionally, if you have any non-patch local files (i.e. files - referred to with ``file://`` entries in ``SRC_URI`` statement + referred to with ``file://`` entries in :term:`SRC_URI` statement excluding ``*.patch/`` or ``*.diff``), these files are copied to an ``oe-local-files`` folder under the newly created source tree. Copying the files here gives you a convenient area from which you @@ -474,8 +464,7 @@ command: The following command tells ``devtool`` the recipe with which to work and, in this case, identifies a local area for the extracted source files that exists outside of the default ``devtool`` - workspace: - :: + workspace:: $ devtool modify recipe srctree @@ -487,29 +476,28 @@ command: devtool command. - As with all extractions, the command uses the recipe's ``SRC_URI`` + As with all extractions, the command uses the recipe's :term:`SRC_URI` statements to locate the source files and any associated patch files. Non-patch files are copied to an ``oe-local-files`` folder under the newly created source tree. Once the files are located, the command by default extracts them - into srctree. + into ``srctree``. Within workspace, ``devtool`` creates an append file for the recipe. The recipe remains in its original location but the source - files are extracted to the location you provide with srctree. + files are extracted to the location you provide with ``srctree``. - *Right*: The right scenario in the figure represents a situation - where the source tree (srctree) already exists locally as a + where the source tree (``srctree``) already exists locally as a previously extracted Git structure outside of the ``devtool`` workspace. In this example, the recipe also exists elsewhere locally in its own layer. The following command tells ``devtool`` the recipe with which to work, uses the "-n" option to indicate source does not need to be - extracted, and uses srctree to point to the previously extracted - source files: - :: + extracted, and uses ``srctree`` to point to the previously extracted + source files:: $ devtool modify -n recipe srctree @@ -532,8 +520,7 @@ command: depends on what you are going to do with the new code. If you need to eventually move the build output to the target - hardware, use the following ``devtool`` command: - :: + hardware, use the following ``devtool`` command:: $ devtool build recipe @@ -556,8 +543,7 @@ command: development machine. You can deploy your build output to that target hardware by using the - ``devtool deploy-target`` command: - :: + ``devtool deploy-target`` command:: $ devtool deploy-target recipe target @@ -617,11 +603,11 @@ counterparts. .. note:: Several methods exist by which you can upgrade recipes - - devtool upgrade + ``devtool upgrade`` happens to be one. You can read about all the methods by which you - can upgrade recipes in the " - Upgrading Recipes - " section of the Yocto Project Development Tasks Manual. + can upgrade recipes in the + :ref:`dev-manual/common-tasks:upgrading recipes` section + of the Yocto Project Development Tasks Manual. The ``devtool upgrade`` command is flexible enough to allow you to specify source code revision and versioning schemes, extract code into @@ -651,8 +637,7 @@ The following diagram shows the common development flow used with the A common situation is where third-party software has undergone a revision so that it has been upgraded. The recipe you have access to is likely in your own layer. Thus, you need to upgrade the recipe to - use the newer version of the software: - :: + use the newer version of the software:: $ devtool upgrade -V version recipe @@ -660,8 +645,9 @@ The following diagram shows the common development flow used with the code into the ``sources`` directory in the :ref:`devtool-the-workspace-layer-structure`. If you want the code extracted to any other location, you need to - provide the srctree positional argument with the command as follows: - $ devtool upgrade -V version recipe srctree + provide the ``srctree`` positional argument with the command as follows:: + + $ devtool upgrade -V version recipe srctree .. note:: @@ -669,18 +655,18 @@ The following diagram shows the common development flow used with the don't use "-V", the command upgrades the recipe to the latest version. - If the source files pointed to by the ``SRC_URI`` statement in the + If the source files pointed to by the :term:`SRC_URI` statement in the recipe are in a Git repository, you must provide the "-S" option and specify a revision for the software. - Once ``devtool`` locates the recipe, it uses the ``SRC_URI`` variable + Once ``devtool`` locates the recipe, it uses the :term:`SRC_URI` variable to locate the source code and any local patch files from other developers. The result is that the command sets up the source code, the new version of the recipe, and an append file all within the workspace. Additionally, if you have any non-patch local files (i.e. files - referred to with ``file://`` entries in ``SRC_URI`` statement + referred to with ``file://`` entries in :term:`SRC_URI` statement excluding ``*.patch/`` or ``*.diff``), these files are copied to an ``oe-local-files`` folder under the newly created source tree. Copying the files here gives you a convenient area from which you can @@ -688,9 +674,9 @@ The following diagram shows the common development flow used with the are incorporated into the build the next time you build the software just as are other changes you might have made to the source. -2. *Resolve any Conflicts created by the Upgrade*: Conflicts could exist - due to the software being upgraded to a new version. Conflicts occur - if your recipe specifies some patch files in ``SRC_URI`` that +2. *Resolve any Conflicts created by the Upgrade*: Conflicts could happen + after upgrading the software to a new version. Conflicts occur + if your recipe specifies some patch files in :term:`SRC_URI` that conflict with changes made in the new version of the software. For such cases, you need to resolve the conflicts by editing the source and following the normal ``git rebase`` conflict resolution process. @@ -703,16 +689,14 @@ The following diagram shows the common development flow used with the depends on what you are going to do with the new code. If you need to eventually move the build output to the target - hardware, use the following ``devtool`` command: - :: + hardware, use the following ``devtool`` command:: $ devtool build recipe On the other hand, if you want an image to contain the recipe's packages from the workspace for immediate deployment onto a device (e.g. for testing purposes), you can use the ``devtool build-image`` - command: - :: + command:: $ devtool build-image image @@ -828,8 +812,7 @@ name and version, just the name, or just the version as part of the command line. Sometimes the name or version determined from the source tree might be -incorrect. For such a case, you must reset the recipe: -:: +incorrect. For such a case, you must reset the recipe:: $ devtool reset -n recipename @@ -849,12 +832,11 @@ result from naming not being recognized or because the dependency simply is not available. For cases where the dependency is not available, you must use the ``devtool add`` command to add an additional recipe that satisfies the dependency. Once you add that recipe, you need to update -the ``DEPENDS`` variable in the original recipe to include the new +the :term:`DEPENDS` variable in the original recipe to include the new recipe. If you need to add runtime dependencies, you can do so by adding the -following to your recipe: -:: +following to your recipe:: RDEPENDS_${PN} += "dependency1 dependency2 ..." @@ -879,7 +861,7 @@ license. If so, the command sets the :term:`LICENSE` value accordingly. You should double-check the value added by the command against the documentation or source files for the software you are building and, if -necessary, update that ``LICENSE`` value. +necessary, update that :term:`LICENSE` value. The ``devtool add`` command also sets the :term:`LIC_FILES_CHKSUM` @@ -887,16 +869,16 @@ value to point to all files that appear to be license-related. Realize that license statements often appear in comments at the top of source files or within the documentation. In such cases, the command does not recognize those license statements. Consequently, you might need to -amend the ``LIC_FILES_CHKSUM`` variable to point to one or more of those -comments if present. Setting ``LIC_FILES_CHKSUM`` is particularly +amend the :term:`LIC_FILES_CHKSUM` variable to point to one or more of those +comments if present. Setting :term:`LIC_FILES_CHKSUM` is particularly important for third-party software. The mechanism attempts to ensure correct licensing should you upgrade the recipe to a newer upstream version in future. Any change in licensing is detected and you receive an error prompting you to check the license text again. If the ``devtool add`` command cannot determine licensing information, -``devtool`` sets the ``LICENSE`` value to "CLOSED" and leaves the -``LIC_FILES_CHKSUM`` value unset. This behavior allows you to continue +``devtool`` sets the :term:`LICENSE` value to "CLOSED" and leaves the +:term:`LIC_FILES_CHKSUM` value unset. This behavior allows you to continue with development even though the settings are unlikely to be correct in all cases. You should check the documentation or source files for the software you are building to determine the actual license. @@ -922,12 +904,12 @@ mind: hardcoding tools within the toolchain such as ``gcc`` and ``g++``. - The environment in which Make runs is set up with various standard - variables for compilation (e.g. ``CC``, ``CXX``, and so forth) in a + variables for compilation (e.g. :term:`CC`, :term:`CXX`, and so forth) in a similar manner to the environment set up by the SDK's environment setup script. One easy way to see these variables is to run the ``devtool build`` command on the recipe and then look in - ``oe-logs/run.do_compile``. Towards the top of this file, a list of - environment variables exists that are being set. You can take + ``oe-logs/run.do_compile``. Towards the top of this file, there is + a list of environment variables that are set. You can take advantage of these variables within the Makefile. - If the Makefile sets a default for a variable using "=", that default @@ -938,8 +920,7 @@ mind: the command line, add the variable setting to :term:`EXTRA_OEMAKE` or :term:`PACKAGECONFIG_CONFARGS` - within the recipe. Here is an example using ``EXTRA_OEMAKE``: - :: + within the recipe. Here is an example using :term:`EXTRA_OEMAKE`:: EXTRA_OEMAKE += "'CC=${CC}' 'CXX=${CXX}'" @@ -972,7 +953,7 @@ following methods when you run ``devtool add``: Specifying the name like this produces a recipe that only builds for the build host. -- Specify the "DASHDASHalso-native" option with the ``devtool add`` +- Specify the "--also-native" option with the ``devtool add`` command. Specifying this option creates a recipe file that still builds for the target but also creates a variant with a "-native" suffix that builds for the build host. @@ -983,7 +964,7 @@ following methods when you run ``devtool add``: that builds code for the target, you can typically accomplish this by building the native and target parts separately rather than within the same compilation process. Realize though that with the - "DASHDASHalso-native" option, you can add the tool using just one + "--also-native" option, you can add the tool using just one recipe file. Adding Node.js Modules @@ -993,8 +974,7 @@ You can use the ``devtool add`` command two different ways to add Node.js modules: 1) Through ``npm`` and, 2) from a repository or local source. -Use the following form to add Node.js modules through ``npm``: -:: +Use the following form to add Node.js modules through ``npm``:: $ devtool add "npm://registry.npmjs.org;name=forever;version=0.15.1" @@ -1018,8 +998,7 @@ these behaviors ensure the reproducibility and integrity of the build. As mentioned earlier, you can also add Node.js modules directly from a repository or local source tree. To add modules this way, use -``devtool add`` in the following form: -:: +``devtool add`` in the following form:: $ devtool add https://github.com/diversario/node-ssdp @@ -1058,8 +1037,8 @@ If you look at the contents of a recipe, you will see that the recipe does not include complete instructions for building the software. Instead, common functionality is encapsulated in classes inherited with the ``inherit`` directive. This technique leaves the recipe to describe -just the things that are specific to the software being built. A -:ref:`base <ref-classes-base>` class exists that +just the things that are specific to the software being built. There is +a :ref:`base <ref-classes-base>` class that is implicitly inherited by all recipes and provides the functionality that most recipes typically need. @@ -1107,21 +1086,21 @@ extras specified by :term:`EXTRA_OECONF` or :term:`PACKAGECONFIG_CONFARGS` set within the recipe. If you wish to pass additional options, add them -to ``EXTRA_OECONF`` or ``PACKAGECONFIG_CONFARGS``. Other supported build +to :term:`EXTRA_OECONF` or :term:`PACKAGECONFIG_CONFARGS`. Other supported build tools have similar variables (e.g. :term:`EXTRA_OECMAKE` for CMake, :term:`EXTRA_OESCONS` for Scons, and so forth). If you need to pass anything on the ``make`` -command line, you can use ``EXTRA_OEMAKE`` or the +command line, you can use :term:`EXTRA_OEMAKE` or the :term:`PACKAGECONFIG_CONFARGS` variables to do so. You can use the ``devtool configure-help`` command to help you set the arguments listed in the previous paragraph. The command determines the exact options being passed, and shows them to you along with any custom -arguments specified through ``EXTRA_OECONF`` or -``PACKAGECONFIG_CONFARGS``. If applicable, the command also shows you -the output of the configure script's "DASHDASHhelp" option as a +arguments specified through :term:`EXTRA_OECONF` or +:term:`PACKAGECONFIG_CONFARGS`. If applicable, the command also shows you +the output of the configure script's "--help" option as a reference. Sharing Files Between Recipes @@ -1131,9 +1110,9 @@ Recipes often need to use files provided by other recipes on the :term:`Build Host`. For example, an application linking to a common library needs access to the library itself and its associated headers. The way this access is accomplished -within the extensible SDK is through the sysroot. One sysroot exists per +within the extensible SDK is through the sysroot. There is one sysroot per "machine" for which the SDK is being built. In practical terms, this -means a sysroot exists for the target machine, and a sysroot exists for +means there is a sysroot for the target machine, and a sysroot for the build host. Recipes should never write files directly into the sysroot. Instead, @@ -1172,16 +1151,16 @@ the ``oe-workdir/packages-split`` directory, which contains a subdirectory for each package. Apart from some advanced cases, the :term:`PACKAGES` and :term:`FILES` variables controls -splitting. The ``PACKAGES`` variable lists all of the packages to be -produced, while the ``FILES`` variable specifies which files to include +splitting. The :term:`PACKAGES` variable lists all of the packages to be +produced, while the :term:`FILES` variable specifies which files to include in each package by using an override to specify the package. For example, ``FILES_${PN}`` specifies the files to go into the main package (i.e. the main package has the same name as the recipe and ``${``\ :term:`PN`\ ``}`` evaluates to the -recipe name). The order of the ``PACKAGES`` value is significant. For -each installed file, the first package whose ``FILES`` value matches the -file is the package into which the file goes. Defaults exist for both -the ``PACKAGES`` and ``FILES`` variables. Consequently, you might find +recipe name). The order of the :term:`PACKAGES` value is significant. For +each installed file, the first package whose :term:`FILES` value matches the +file is the package into which the file goes. Both the :term:`PACKAGES` and +:term:`FILES` variables have default values. Consequently, you might find you do not even need to set these variables in your recipe unless the software the recipe is building installs files into non-standard locations. @@ -1196,15 +1175,13 @@ need to restore the original files that existed prior to running the ``devtool deploy-target`` command. Because the ``devtool deploy-target`` command backs up any files it overwrites, you can use the ``devtool undeploy-target`` command to restore those files and remove -any other files the recipe deployed. Consider the following example: -:: +any other files the recipe deployed. Consider the following example:: $ devtool undeploy-target lighttpd root@192.168.7.2 If you have deployed multiple applications, you can remove them all using the "-a" option -thus restoring the target device to its original state: -:: +thus restoring the target device to its original state:: $ devtool undeploy-target -a root@192.168.7.2 @@ -1235,28 +1212,25 @@ populated on-demand. Sometimes you must explicitly install extra items into the SDK. If you need these extra items, you can first search for the items using the ``devtool search`` command. For example, suppose you need to link to libGL but you are not sure which recipe provides libGL. -You can use the following command to find out: -:: +You can use the following command to find out:: $ devtool search libGL mesa A free implementation of the OpenGL API Once you know the recipe -(i.e. ``mesa`` in this example), you can install it: -:: +(i.e. ``mesa`` in this example), you can install it:: $ devtool sdk-install mesa By default, the ``devtool sdk-install`` command assumes the item is available in pre-built form from your SDK provider. If the item is not available and it is acceptable to build the item from -source, you can add the "-s" option as follows: -:: +source, you can add the "-s" option as follows:: $ devtool sdk-install -s mesa It is important to remember that building the item from source takes significantly longer than installing the pre-built artifact. Also, -if no recipe exists for the item you want to add to the SDK, you must +if there is no recipe for the item you want to add to the SDK, you must instead add the item using the ``devtool add`` command. Applying Updates to an Installed Extensible SDK @@ -1266,8 +1240,7 @@ If you are working with an installed extensible SDK that gets occasionally updated (e.g. a third-party SDK), then you will need to manually "pull down" the updates into the installed SDK. -To update your installed SDK, use ``devtool`` as follows: -:: +To update your installed SDK, use ``devtool`` as follows:: $ devtool sdk-update |