diff options
| -rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 249 |
1 files changed, 129 insertions, 120 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index cd2808dfcf..02e77e8dd6 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
| @@ -887,105 +887,68 @@ | |||
| 887 | This section describes several methods and provides guidelines for each. | 887 | This section describes several methods and provides guidelines for each. |
| 888 | </para> | 888 | </para> |
| 889 | 889 | ||
| 890 | <section id='usingpoky-extend-customimage-custombb'> | 890 | <section id='usingpoky-extend-customimage-localconf'> |
| 891 | <title>Customizing Images Using Custom .bb Files</title> | 891 | <title>Customizing Images Using <filename>local.conf</filename></title> |
| 892 | 892 | ||
| 893 | <para> | 893 | <para> |
| 894 | One way to customize an image is to create a custom recipe | 894 | Probably the easiest way to customize an image is to add a |
| 895 | that defines additional software as part of the image. | 895 | package by way of the <filename>local.conf</filename> |
| 896 | The following example shows the form for the two lines you need: | 896 | configuration file. |
| 897 | <literallayout class='monospaced'> | 897 | Because it is limited to local use, this method generally only |
| 898 | IMAGE_INSTALL = "packagegroup-core-x11-base package1 package2" | 898 | allows you to add packages and is not as flexible as creating |
| 899 | 899 | your own customized image. | |
| 900 | inherit core-image | 900 | When you add packages using local variables this way, you need |
| 901 | </literallayout> | 901 | to realize that these variable changes affect all images at |
| 902 | the same time and might not be what you require. | ||
| 902 | </para> | 903 | </para> |
| 903 | 904 | ||
| 904 | <para> | 905 | <para> |
| 905 | Defining the software using a custom recipe gives you total | 906 | To add a package to your image using the local configuration |
| 906 | control over the contents of the image. | 907 | file, use the |
| 907 | It is important to use the correct names of packages in the | ||
| 908 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'>IMAGE_INSTALL</ulink></filename> | 908 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'>IMAGE_INSTALL</ulink></filename> |
| 909 | variable. | 909 | variable with the <filename>_append</filename> operator: |
| 910 | You must use the OpenEmbedded notation and not the Debian notation for the names | ||
| 911 | (e.g. <filename>eglibc-dev</filename> instead of <filename>libc6-dev</filename>). | ||
| 912 | </para> | ||
| 913 | |||
| 914 | <para> | ||
| 915 | The other method for creating a custom image is to base it on an existing image. | ||
| 916 | For example, if you want to create an image based on <filename>core-image-sato</filename> | ||
| 917 | but add the additional package <filename>strace</filename> to the image, | ||
| 918 | copy the <filename>meta/recipes-sato/images/core-image-sato.bb</filename> to a | ||
| 919 | new <filename>.bb</filename> and add the following line to the end of the copy: | ||
| 920 | <literallayout class='monospaced'> | 910 | <literallayout class='monospaced'> |
| 921 | IMAGE_INSTALL += "strace" | 911 | IMAGE_INSTALL_append = " strace" |
| 922 | </literallayout> | 912 | </literallayout> |
| 913 | Use of the syntax is important - specifically, the space between | ||
| 914 | the quote and the package name, which is | ||
| 915 | <filename>strace</filename> in this example. | ||
| 916 | This space is required since the <filename>_append</filename> | ||
| 917 | operator does not add the space. | ||
| 923 | </para> | 918 | </para> |
| 924 | </section> | ||
| 925 | 919 | ||
| 926 | <section id='usingpoky-extend-customimage-customtasks'> | 920 | <para> |
| 927 | <title>Customizing Images Using Custom Package Groups</title> | 921 | Furthermore, you must use <filename>_append</filename> instead |
| 922 | of the <filename>+=</filename> operator if you want to avoid | ||
| 923 | ordering issues. | ||
| 924 | The reason for this is because doing so unconditionally appends | ||
| 925 | to the variable and avoids ordering problems due to the | ||
| 926 | variable being set in image recipes and | ||
| 927 | <filename>.bbclass</filename> files with operators like | ||
| 928 | <filename>?=</filename>. | ||
| 929 | Using <filename>_append</filename> ensures the operation takes | ||
| 930 | affect. | ||
| 931 | </para> | ||
| 928 | 932 | ||
| 929 | <para> | 933 | <para> |
| 930 | For complex custom images, the best approach is to create a | 934 | As shown in its simplest use, |
| 931 | custom package group recipe that is used to build the image or | 935 | <filename>IMAGE_INSTALL_append</filename> affects all images. |
| 932 | images. | 936 | It is possible to extend the syntax so that the variable |
| 933 | A good example of a package group recipe is | 937 | applies to a specific image only. |
| 934 | <filename>meta/recipes-core/packagegroups/packagegroup-core-boot.bb</filename>. | 938 | Here is an example: |
| 935 | The | ||
| 936 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGES'>PACKAGES</ulink></filename> | ||
| 937 | variable lists the package group packages you wish to produce. | ||
| 938 | <filename>inherit packagegroup</filename> sets appropriate | ||
| 939 | default values and automatically adds <filename>-dev</filename>, | ||
| 940 | <filename>-dbg</filename>, and <filename>-ptest</filename> | ||
| 941 | complementary packages for every package specified in | ||
| 942 | <filename>PACKAGES</filename>. | ||
| 943 | Note that the inherit line should be towards | ||
| 944 | the top of the recipe, certainly before you set | ||
| 945 | <filename>PACKAGES</filename>. | ||
| 946 | For each package you specify in <filename>PACKAGES</filename>, | ||
| 947 | you can use | ||
| 948 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-RDEPENDS'>RDEPENDS</ulink></filename> | ||
| 949 | and | ||
| 950 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-RRECOMMENDS'>RRECOMMENDS</ulink></filename> | ||
| 951 | entries to provide a list of packages the parent task package | ||
| 952 | should contain. | ||
| 953 | Following is an example: | ||
| 954 | <literallayout class='monospaced'> | 939 | <literallayout class='monospaced'> |
| 955 | DESCRIPTION = "My Custom Package Groups" | 940 | IMAGE_INSTALL_append_pn-core-image-minimal = " strace" |
| 956 | |||
| 957 | inherit packagegroup | ||
| 958 | |||
| 959 | PACKAGES = "\ | ||
| 960 | packagegroup-custom-apps \ | ||
| 961 | packagegroup-custom-tools \ | ||
| 962 | " | ||
| 963 | |||
| 964 | RDEPENDS_packagegroup-custom-apps = "\ | ||
| 965 | dropbear \ | ||
| 966 | portmap \ | ||
| 967 | psplash" | ||
| 968 | |||
| 969 | RDEPENDS_packagegroup-custom-tools = "\ | ||
| 970 | oprofile \ | ||
| 971 | oprofileui-server \ | ||
| 972 | lttng-control \ | ||
| 973 | lttng-viewer" | ||
| 974 | |||
| 975 | RRECOMMENDS_packagegroup-custom-tools = "\ | ||
| 976 | kernel-module-oprofile" | ||
| 977 | </literallayout> | 941 | </literallayout> |
| 942 | This example adds <filename>strace</filename> to | ||
| 943 | <filename>core-image-minimal</filename> only. | ||
| 978 | </para> | 944 | </para> |
| 979 | 945 | ||
| 980 | <para> | 946 | <para> |
| 981 | In the previous example, two package group packages are created with their dependencies and their | 947 | You can add packages using a similar approach through the |
| 982 | recommended package dependencies listed: <filename>packagegroup-custom-apps</filename>, and | 948 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-CORE_IMAGE_EXTRA_INSTALL'>CORE_IMAGE_EXTRA_INSTALL</ulink></filename> |
| 983 | <filename>packagegroup-custom-tools</filename>. | 949 | variable. |
| 984 | To build an image using these package group packages, you need to add | 950 | If you use this variable, only |
| 985 | <filename>packagegroup-custom-apps</filename> and/or | 951 | <filename>core-image-*</filename> images are affected. |
| 986 | <filename>packagegroup-custom-tools</filename> to | ||
| 987 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'>IMAGE_INSTALL</ulink></filename>. | ||
| 988 | For other forms of image dependencies see the other areas of this section. | ||
| 989 | </para> | 952 | </para> |
| 990 | </section> | 953 | </section> |
| 991 | 954 | ||
| @@ -994,8 +957,8 @@ | |||
| 994 | <filename>EXTRA_IMAGE_FEATURES</filename></title> | 957 | <filename>EXTRA_IMAGE_FEATURES</filename></title> |
| 995 | 958 | ||
| 996 | <para> | 959 | <para> |
| 997 | You might want to customize your image by enabling or | 960 | Another method for customizing your image is to enable or |
| 998 | disabling high-level image features by using the | 961 | disable high-level image features by using the |
| 999 | <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_FEATURES'><filename>IMAGE_FEATURES</filename></ulink> | 962 | <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_FEATURES'><filename>IMAGE_FEATURES</filename></ulink> |
| 1000 | and <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGE_FEATURES'><filename>EXTRA_IMAGE_FEATURES</filename></ulink> | 963 | and <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGE_FEATURES'><filename>EXTRA_IMAGE_FEATURES</filename></ulink> |
| 1001 | variables. | 964 | variables. |
| @@ -1070,59 +1033,105 @@ | |||
| 1070 | </note> | 1033 | </note> |
| 1071 | </section> | 1034 | </section> |
| 1072 | 1035 | ||
| 1073 | <section id='usingpoky-extend-customimage-localconf'> | 1036 | <section id='usingpoky-extend-customimage-custombb'> |
| 1074 | <title>Customizing Images Using <filename>local.conf</filename></title> | 1037 | <title>Customizing Images Using Custom .bb Files</title> |
| 1075 | 1038 | ||
| 1076 | <para> | 1039 | <para> |
| 1077 | It is possible to customize image contents by using variables from your | 1040 | You can also customize an image by creating a custom recipe |
| 1078 | local configuration in your <filename>conf/local.conf</filename> file. | 1041 | that defines additional software as part of the image. |
| 1079 | Because it is limited to local use, this method generally only allows you to | 1042 | The following example shows the form for the two lines you need: |
| 1080 | add packages and is not as flexible as creating your own customized image. | 1043 | <literallayout class='monospaced'> |
| 1081 | When you add packages using local variables this way, you need to realize that | 1044 | IMAGE_INSTALL = "packagegroup-core-x11-base package1 package2" |
| 1082 | these variable changes affect all images at the same time and might not be | 1045 | |
| 1083 | what you require. | 1046 | inherit core-image |
| 1047 | </literallayout> | ||
| 1084 | </para> | 1048 | </para> |
| 1085 | 1049 | ||
| 1086 | <para> | 1050 | <para> |
| 1087 | The simplest way to add extra packages to all images is by using the | 1051 | Defining the software using a custom recipe gives you total |
| 1052 | control over the contents of the image. | ||
| 1053 | It is important to use the correct names of packages in the | ||
| 1088 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'>IMAGE_INSTALL</ulink></filename> | 1054 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'>IMAGE_INSTALL</ulink></filename> |
| 1089 | variable with the <filename>_append</filename> operator: | 1055 | variable. |
| 1090 | <literallayout class='monospaced'> | 1056 | You must use the OpenEmbedded notation and not the Debian notation for the names |
| 1091 | IMAGE_INSTALL_append = " strace" | 1057 | (e.g. <filename>eglibc-dev</filename> instead of <filename>libc6-dev</filename>). |
| 1092 | </literallayout> | ||
| 1093 | Use of the syntax is important - specifically, the space between | ||
| 1094 | the quote and the package name, which is | ||
| 1095 | <filename>strace</filename> in this example. | ||
| 1096 | This space is required since the <filename>_append</filename> | ||
| 1097 | operator does not add the space. | ||
| 1098 | </para> | 1058 | </para> |
| 1099 | 1059 | ||
| 1100 | <para> | 1060 | <para> |
| 1101 | Furthermore, you must use <filename>_append</filename> instead of the <filename>+=</filename> | 1061 | The other method for creating a custom image is to base it on an existing image. |
| 1102 | operator if you want to avoid ordering issues. | 1062 | For example, if you want to create an image based on <filename>core-image-sato</filename> |
| 1103 | The reason for this is because doing so unconditionally appends to the variable and | 1063 | but add the additional package <filename>strace</filename> to the image, |
| 1104 | avoids ordering problems due to the variable being set in image recipes and | 1064 | copy the <filename>meta/recipes-sato/images/core-image-sato.bb</filename> to a |
| 1105 | <filename>.bbclass</filename> files with operators like <filename>?=</filename>. | 1065 | new <filename>.bb</filename> and add the following line to the end of the copy: |
| 1106 | Using <filename>_append</filename> ensures the operation takes affect. | 1066 | <literallayout class='monospaced'> |
| 1067 | IMAGE_INSTALL += "strace" | ||
| 1068 | </literallayout> | ||
| 1107 | </para> | 1069 | </para> |
| 1070 | </section> | ||
| 1071 | |||
| 1072 | <section id='usingpoky-extend-customimage-customtasks'> | ||
| 1073 | <title>Customizing Images Using Custom Package Groups</title> | ||
| 1108 | 1074 | ||
| 1109 | <para> | 1075 | <para> |
| 1110 | As shown in its simplest use, <filename>IMAGE_INSTALL_append</filename> affects | 1076 | For complex custom images, the best approach for customizing |
| 1111 | all images. | 1077 | an image is to create a custom package group recipe that is |
| 1112 | It is possible to extend the syntax so that the variable applies to a specific image only. | 1078 | used to build the image or images. |
| 1113 | Here is an example: | 1079 | A good example of a package group recipe is |
| 1080 | <filename>meta/recipes-core/packagegroups/packagegroup-core-boot.bb</filename>. | ||
| 1081 | The | ||
| 1082 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGES'>PACKAGES</ulink></filename> | ||
| 1083 | variable lists the package group packages you wish to produce. | ||
| 1084 | <filename>inherit packagegroup</filename> sets appropriate | ||
| 1085 | default values and automatically adds <filename>-dev</filename>, | ||
| 1086 | <filename>-dbg</filename>, and <filename>-ptest</filename> | ||
| 1087 | complementary packages for every package specified in | ||
| 1088 | <filename>PACKAGES</filename>. | ||
| 1089 | Note that the inherit line should be towards | ||
| 1090 | the top of the recipe, certainly before you set | ||
| 1091 | <filename>PACKAGES</filename>. | ||
| 1092 | For each package you specify in <filename>PACKAGES</filename>, | ||
| 1093 | you can use | ||
| 1094 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-RDEPENDS'>RDEPENDS</ulink></filename> | ||
| 1095 | and | ||
| 1096 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-RRECOMMENDS'>RRECOMMENDS</ulink></filename> | ||
| 1097 | entries to provide a list of packages the parent task package | ||
| 1098 | should contain. | ||
| 1099 | Following is an example: | ||
| 1114 | <literallayout class='monospaced'> | 1100 | <literallayout class='monospaced'> |
| 1115 | IMAGE_INSTALL_append_pn-core-image-minimal = " strace" | 1101 | DESCRIPTION = "My Custom Package Groups" |
| 1102 | |||
| 1103 | inherit packagegroup | ||
| 1104 | |||
| 1105 | PACKAGES = "\ | ||
| 1106 | packagegroup-custom-apps \ | ||
| 1107 | packagegroup-custom-tools \ | ||
| 1108 | " | ||
| 1109 | |||
| 1110 | RDEPENDS_packagegroup-custom-apps = "\ | ||
| 1111 | dropbear \ | ||
| 1112 | portmap \ | ||
| 1113 | psplash" | ||
| 1114 | |||
| 1115 | RDEPENDS_packagegroup-custom-tools = "\ | ||
| 1116 | oprofile \ | ||
| 1117 | oprofileui-server \ | ||
| 1118 | lttng-control \ | ||
| 1119 | lttng-viewer" | ||
| 1120 | |||
| 1121 | RRECOMMENDS_packagegroup-custom-tools = "\ | ||
| 1122 | kernel-module-oprofile" | ||
| 1116 | </literallayout> | 1123 | </literallayout> |
| 1117 | This example adds <filename>strace</filename> to <filename>core-image-minimal</filename> | ||
| 1118 | only. | ||
| 1119 | </para> | 1124 | </para> |
| 1120 | 1125 | ||
| 1121 | <para> | 1126 | <para> |
| 1122 | You can add packages using a similar approach through the | 1127 | In the previous example, two package group packages are created with their dependencies and their |
| 1123 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-CORE_IMAGE_EXTRA_INSTALL'>CORE_IMAGE_EXTRA_INSTALL</ulink></filename> | 1128 | recommended package dependencies listed: <filename>packagegroup-custom-apps</filename>, and |
| 1124 | variable. | 1129 | <filename>packagegroup-custom-tools</filename>. |
| 1125 | If you use this variable, only <filename>core-image-*</filename> images are affected. | 1130 | To build an image using these package group packages, you need to add |
| 1131 | <filename>packagegroup-custom-apps</filename> and/or | ||
| 1132 | <filename>packagegroup-custom-tools</filename> to | ||
| 1133 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'>IMAGE_INSTALL</ulink></filename>. | ||
| 1134 | For other forms of image dependencies see the other areas of this section. | ||
| 1126 | </para> | 1135 | </para> |
| 1127 | </section> | 1136 | </section> |
| 1128 | </section> | 1137 | </section> |
