summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2013-11-08 14:09:44 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-02 13:16:10 +0000
commit5a3296cf25399052774b7ddfbe5a70aa46bd28d4 (patch)
tree3140b7eb9c2a92b70a98638269c8ec591f220549 /documentation
parent1bd23c8679dd569b6efdbd33a37fbcc14b826f35 (diff)
downloadpoky-5a3296cf25399052774b7ddfbe5a70aa46bd28d4.tar.gz
dev-manual: Put into place a rough draft of the "Writing Recipe" section
This draft has the structure with text from Paul's email. It needs further work. (From yocto-docs rev: 08025edc34995f7436786e9ed3abdfa155db47af) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r--documentation/dev-manual/dev-manual-common-tasks.xml169
1 files changed, 169 insertions, 0 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml
index 3f4b446e01..707d1c3ceb 100644
--- a/documentation/dev-manual/dev-manual-common-tasks.xml
+++ b/documentation/dev-manual/dev-manual-common-tasks.xml
@@ -1136,6 +1136,175 @@
1136 </section> 1136 </section>
1137 </section> 1137 </section>
1138 1138
1139 <section id='usingpoky-writing-a-new-recipe'>
1140 <title>Writing a New Recipe</title>
1141
1142 <para>
1143 Recipes (<filename>.bb</filename> files) are fundamental components
1144 in the Yocto Project environment.
1145 The OpenEmbedded build system parses and compiles your recipes to
1146 create an image.
1147 Your project consists in part of the recipes that define it.
1148 This section describes how to create, write, and test a new
1149 recipe.
1150 </para>
1151
1152 <section id='new-recipe-overview'>
1153 <title>Overview</title>
1154
1155 <para>
1156 The following figure shows the basic process for creating a
1157 new recipe.
1158 Subsequent sections provide details for each step.
1159 <imagedata fileref="figures/recipe-workflow.png" width="4in" depth="7in" align="center" scalefit="1" />
1160 </para>
1161 </section>
1162
1163 <section id='new-recipe-locate-a-base-recipe'>
1164 <title>Locate a Base Recipe</title>
1165
1166 <para>
1167 Working from an existing recipe or a skeleton recipe is the
1168 best way to get started.
1169 Here are some points on both methods:
1170 <itemizedlist>
1171 <listitem><para><emphasis>Locate a recipe that is close
1172 to what you want to do and use it:</emphasis>
1173 This method works when you are familiar with the
1174 current recipe space.
1175 The method does not work so well for those new to
1176 the Yocto Project or writing recipes.</para>
1177 <para>Some risks associated with this method are
1178 using a recipe that has areas totally unrelated to
1179 what you are trying to accomplish with your recipe,
1180 not recognizing areas of the recipe that you might
1181 have to add from scratch, and so forth.
1182 All these risks stem from unfamiliarity with the
1183 existing recipe space.</para></listitem>
1184 <listitem><para><emphasis>Use a skeleton recipe:</emphasis>
1185 Using the skeleton recipe located at
1186 &lt;Need some path for a good recipe to use&gt; is the
1187 recommended method for creating a new recipe.
1188 The skeleton recipe provides the fundamental areas
1189 that you need to include, exclude, or alter to fit
1190 your needs.
1191 </para></listitem>
1192 </itemizedlist>
1193 </para>
1194 </section>
1195
1196 <section id='new-recipe-fetching-code'>
1197 <title>Fetching Code</title>
1198
1199 <para>
1200 fetching: basically a matter of ensuring SRC_URI is correct, and for archives
1201that SRC_URI checksums are specified and correct. We should show examples of
1202the error message you get when you don't, from which you can copy and paste
1203the lines with the correct values.
1204 </para>
1205 </section>
1206
1207 <section id='new-recipe-unpacking-code'>
1208 <title>Unpacking Code</title>
1209
1210 <para>
1211 unpacking: ensure S matches the directory that contains the source. Often the
1212default will work for a source archive, but it depends on how the upstream
1213project structures their archive. If SRC_URI specifies to fetch the source from
1214an SCM such as git or svn you'll definitely need to set S.
1215 </para>
1216 </section>
1217
1218 <section id='new-recipe-licensing'>
1219 <title>Licensing</title>
1220
1221 <para>
1222 licensing: set correct values for LICENSE and LIC_FILES_CHKSUM, i.e. look for
1223a license statement somewhere (COPYING, LICENSE, part of a README, top of a
1224source file etc.) and then set the two variables accordingly. You need to go
1225through this several steps, i.e. look in the directory containing the
1226extracted source, then set LIC_FILES_CHKSUM to point to the file without the
1227md5 value specified, and then run bitbake on the recipe again and it will error
1228out with the actual md5 value which you can then put into the recipe. I notice
1229we don't necessarily have a list anywhere of the common values for LICENSE
1230either, so maybe we need to add this to the variable reference entry for this
1231variable. We should also cover what to do if there is no file specifying the
1232license shipped with the source.
1233 </para>
1234 </section>
1235
1236 <section id='new-recipe-optionally-supporting-services'>
1237 <title>Supporting Services</title>
1238
1239 <para>
1240 We'll probably also need some subsections on specific extra functions needed in
1241some recipes e.g. how to add support for services (sysvinit and systemd),
1242adding PACKAGECONFIG options, dealing with alternatives, etc. There's a
1243question in my mind on how some of these will overlap with the class reference
1244section though.
1245 </para>
1246 </section>
1247
1248 <section id='new-recipe-configuring-the-recipe'>
1249 <title>Configuring the Recipe</title>
1250
1251 <para>
1252 configure: this depends on whether you're using autotools or not; if you are
1253then you should set EXTRA_OECONF to pass any needed configure options specific
1254to this recipe. If you are not using autotools, you need to define your own
1255do_configure function, assuming there is anything to configure. At this point
1256you may also need to tweak DEPENDS if the configure scripts complain about any
1257required dependencies being missing, assuming it's not just looking in the
1258wrong place for the dependency in which case it's usually a matter of
1259supplying the appropriate configure options to point to the correct location
1260within the sysroot.
1261 </para>
1262 </section>
1263
1264 <section id='new-recipe-compiling-the-recipe'>
1265 <title>Compiling the Recipe</title>
1266
1267 <para>
1268 compile: if the recipe passes through do_compile successfully, nothing needs
1269to be done. If not, diagnose the failure. We might be able to highlight common
1270issues here such as parallel build failures, host path usage when building for
1271the target, etc.
1272 </para>
1273 </section>
1274
1275 <section id='new-recipe-optionally-installing'>
1276 <title>Optionally Installing</title>
1277
1278 <para>
1279 install: for autotools/cmake recipes, if the recipe passes through do_install
1280successfully, nothing needs to be done (at this stage). If not, diagnose the
1281failure. For non-autotools recipes you need to define your own do_install
1282(which may well just run "oe_runmake install").
1283 </para>
1284 </section>
1285
1286 <section id='new-recipe-packaging'>
1287 <title>Packaging</title>
1288
1289 <para>
1290 packaging: ensure that the files are packaged correctly. Resolve any package QA
1291issues (we need to have more detailed docs on this, probably as its own
1292section). This can also involve looking at packages-split under the work
1293directory and checking if files are where they need to be; if not, set
1294PACKAGES, FILES, do_install(_append) etc. as needed.
1295 </para>
1296 </section>
1297
1298 <section id='new-recipe-testing'>
1299 <title>Testing</title>
1300
1301 <para>
1302 runtime testing: add the output package(s) to your image and ensure that they
1303work at runtime.
1304 </para>
1305 </section>
1306 </section>
1307
1139 <section id='usingpoky-extend-addpkg'> 1308 <section id='usingpoky-extend-addpkg'>
1140 <title>Writing a Recipe to Add a Package to Your Image</title> 1309 <title>Writing a Recipe to Add a Package to Your Image</title>
1141 1310