diff options
| -rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 193 | ||||
| -rw-r--r-- | documentation/dev-manual/figures/recipe-workflow.png | bin | 33081 -> 38483 bytes |
2 files changed, 157 insertions, 36 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index 2e011724c3..9fb2b1c550 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
| @@ -1155,7 +1155,7 @@ | |||
| 1155 | The following figure shows the basic process for creating a | 1155 | The following figure shows the basic process for creating a |
| 1156 | new recipe. | 1156 | new recipe. |
| 1157 | Subsequent sections provide details for each step. | 1157 | Subsequent sections provide details for each step. |
| 1158 | <imagedata fileref="figures/recipe-workflow.png" width="4in" depth="7in" align="center" scalefit="1" /> | 1158 | <imagedata fileref="figures/recipe-workflow.png" width="6in" depth="7in" align="center" scalefit="1" /> |
| 1159 | </para> | 1159 | </para> |
| 1160 | </section> | 1160 | </section> |
| 1161 | 1161 | ||
| @@ -1180,14 +1180,17 @@ | |||
| 1180 | have to add from scratch, and so forth. | 1180 | have to add from scratch, and so forth. |
| 1181 | All these risks stem from unfamiliarity with the | 1181 | All these risks stem from unfamiliarity with the |
| 1182 | existing recipe space.</para></listitem> | 1182 | existing recipe space.</para></listitem> |
| 1183 | <listitem><para><emphasis>Use and modify a skeleton | 1183 | <listitem><para><emphasis>Use and modify the following |
| 1184 | recipe:</emphasis> | 1184 | skeleton recipe:</emphasis> |
| 1185 | Using the skeleton recipe located at | 1185 | <literallayout class='monospaced'> |
| 1186 | <Need some path for a good recipe to use> is the | 1186 | I need a simple |
| 1187 | recommended method for creating a new recipe. | 1187 | skeleton recipe |
| 1188 | The skeleton recipe provides the fundamental areas | 1188 | here |
| 1189 | that you need to include, exclude, or alter to fit | 1189 | </literallayout> |
| 1190 | your needs. | 1190 | Modifying this recipe is the recommended method for |
| 1191 | creating a new recipe. | ||
| 1192 | The recipe provides the fundamental areas that you need | ||
| 1193 | to include, exclude, or alter to fit your needs. | ||
| 1191 | </para></listitem> | 1194 | </para></listitem> |
| 1192 | </itemizedlist> | 1195 | </itemizedlist> |
| 1193 | </para> | 1196 | </para> |
| @@ -1197,40 +1200,140 @@ | |||
| 1197 | <title>Fetching Code</title> | 1200 | <title>Fetching Code</title> |
| 1198 | 1201 | ||
| 1199 | <para> | 1202 | <para> |
| 1200 | The first thing your recipe must do is fetch the source files. | 1203 | The first thing your recipe must do is specify how to fetch |
| 1204 | the source files. | ||
| 1201 | Fetching is controlled mainly through the | 1205 | Fetching is controlled mainly through the |
| 1202 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> | 1206 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> |
| 1203 | variable. | 1207 | variable. |
| 1204 | Your recipe must have a <filename>SRC_URI</filename> variable | 1208 | Your recipe must have a <filename>SRC_URI</filename> variable |
| 1205 | that points to where the source is located. | 1209 | that points to where the source is located. |
| 1210 | For a graphical representation of source locations, see the | ||
| 1211 | "<ulink url='&YOCTO_DOCS_REF_URL;#sources-dev-environment'>Sources</ulink>" | ||
| 1212 | section in the Yocto Project Reference Manual. | ||
| 1213 | </para> | ||
| 1214 | |||
| 1215 | <para> | ||
| 1206 | The <filename>do_fetch</filename> task uses the | 1216 | The <filename>do_fetch</filename> task uses the |
| 1207 | variable and its prefix to determine what fetcher to use to | 1217 | <filename>SRC_URI</filename> variable and its prefix to |
| 1208 | get your source files. | 1218 | determine what fetcher to use to get your source files. |
| 1209 | It is the <filename>SRC_URI</filename> variable that triggers | 1219 | It is the <filename>SRC_URI</filename> variable that triggers |
| 1210 | the fetcher. | 1220 | the fetcher. |
| 1211 | The <filename>do_patch</filename> task uses the variable after | 1221 | The <filename>do_patch</filename> task uses the variable after |
| 1212 | source is fetched to apply patches. | 1222 | source is fetched to apply patches. |
| 1213 | The OpenEmbedded build system uses | 1223 | The OpenEmbedded build system uses |
| 1214 | <ulink url='&YOCOT_DOCS_REF_URL;#var-FILESOVERRIDES'><filename>FILESOVERRIDES</filename></ulink> | 1224 | <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESOVERRIDES'><filename>FILESOVERRIDES</filename></ulink> |
| 1215 | when scanning directory names for files in | 1225 | when scanning directory names for files in |
| 1216 | <filename>SRC_URI</filename>. | 1226 | <filename>SRC_URI</filename>. |
| 1217 | </para> | 1227 | </para> |
| 1218 | 1228 | ||
| 1219 | <para> | 1229 | <para> |
| 1220 | The instance (or instances) of the <filename>SRC_URI</filename> | 1230 | The instance of the <filename>SRC_URI</filename> |
| 1221 | variable in your recipe must define each unique location | 1231 | variable in your recipe must define each unique location |
| 1222 | for your source files. | 1232 | for your source files. |
| 1223 | For example, if you need a tarball, and two patches, then your | 1233 | Here is a simple example from the |
| 1224 | <filename>SRC_URI</filename> statement(s) must point to the | 1234 | <filename>meta/recipes-devtools/cdrtools/cdrtools-native_3.01a17.bb</filename> |
| 1225 | tarball and the patches. | 1235 | recipe where the source comes from a single tarball: |
| 1236 | <literallayout class='monospaced'> | ||
| 1237 | SRC_URI = "ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-${PV}.tar.bz2" | ||
| 1238 | </literallayout> | ||
| 1226 | </para> | 1239 | </para> |
| 1227 | 1240 | ||
| 1228 | <para> | 1241 | <para> |
| 1229 | I need some good examples here. | 1242 | This next example is more complicated and is from the |
| 1230 | I also need some sample error messages you get when you don't | 1243 | <filename>meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.19.bb</filename> |
| 1231 | have the correct <filename>SRC_URI</filename> locations. | 1244 | recipe. |
| 1232 | We can describe how you can copy and past the lines from the | 1245 | The example uses a <filename>SRC_URI</filename> statement |
| 1233 | error message and use the correct values. | 1246 | that identifies a tarball, a patch file, a desktop file, and a |
| 1247 | figure all as source code. | ||
| 1248 | <literallayout class='monospaced'> | ||
| 1249 | SRC_URI = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${PV}.tar.bz2 \ | ||
| 1250 | file://xwc.patch \ | ||
| 1251 | file://rxvt.desktop \ | ||
| 1252 | file://rxvt.png" | ||
| 1253 | </literallayout> | ||
| 1254 | </para> | ||
| 1255 | |||
| 1256 | <para> | ||
| 1257 | The following list discusses some information worth noting when | ||
| 1258 | you provide the <filename>SRC_URI</filename> variable in your | ||
| 1259 | recipe: | ||
| 1260 | <itemizedlist> | ||
| 1261 | <listitem><para> | ||
| 1262 | Rather than hard-coding the version in an URL, it is | ||
| 1263 | good practice to use | ||
| 1264 | <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PV'><filename>PV</filename></ulink><filename>}</filename>, | ||
| 1265 | which causes the fetch process to use the version | ||
| 1266 | specified in the recipe filename. | ||
| 1267 | Specifying the version in this manner means that | ||
| 1268 | upgrading the recipe to a future version is as simple | ||
| 1269 | as renaming the recipe to match the new version. | ||
| 1270 | Notice that the two examples in the previous paragraph | ||
| 1271 | both use <filename>${PV}</filename>.</para></listitem> | ||
| 1272 | <listitem><para> | ||
| 1273 | When you specify local files using the | ||
| 1274 | <filename>file://</filename> URI protocol, the build | ||
| 1275 | system fetches files from the local machine. | ||
| 1276 | The path is relative to the | ||
| 1277 | <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESPATH'><filename>FILESPATH</filename></ulink> | ||
| 1278 | variable and searches specific directories in a | ||
| 1279 | certain order: | ||
| 1280 | <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-BPN'><filename>BPN</filename></ulink><filename>}</filename>, | ||
| 1281 | <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-BP'><filename>BP</filename></ulink><filename>}</filename>, | ||
| 1282 | and | ||
| 1283 | <filename>files</filename>. | ||
| 1284 | The directories are assumed to be subdirectories of | ||
| 1285 | the directory in which the recipe or append file | ||
| 1286 | resides. | ||
| 1287 | For more information, see the | ||
| 1288 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> | ||
| 1289 | variable.</para></listitem> | ||
| 1290 | <listitem><para> | ||
| 1291 | Files mentioned in <filename>SRC_URI</filename> whose | ||
| 1292 | names end in a typical archive extension | ||
| 1293 | (e.g. <filename>.tar</filename>, | ||
| 1294 | <filename>.tar.gz</filename>, | ||
| 1295 | <filename>.tar.bz2</filename>, | ||
| 1296 | <filename>.zip</filename>, and so forth), | ||
| 1297 | are automatically extracted during | ||
| 1298 | the <filename>do_unpack</filename> task. | ||
| 1299 | </para></listitem> | ||
| 1300 | <listitem><para> | ||
| 1301 | Files mentioned in <filename>SRC_URI</filename> whose | ||
| 1302 | names end in <filename>.patch</filename> or | ||
| 1303 | <filename>.diff</filename> are treated as patches and | ||
| 1304 | are automatically applied during the | ||
| 1305 | <filename>do_patch</filename> task.</para></listitem> | ||
| 1306 | <listitem><para> | ||
| 1307 | Patches should be applicable with the "-p1" option to | ||
| 1308 | patch (i.e. one directory level in the path will be | ||
| 1309 | stripped off.) | ||
| 1310 | If your patch needs to have more directory levels | ||
| 1311 | stripped off, specify the number of levels using the | ||
| 1312 | "striplevel" option in the <filename>SRC_URI</filename> | ||
| 1313 | entry for the patch. | ||
| 1314 | Alternatively, if your patch needs to be applied in a | ||
| 1315 | specific subdirectory that is not specified in the patch | ||
| 1316 | file, use the "patchdir" option in the entry. | ||
| 1317 | </para></listitem> | ||
| 1318 | <listitem><para> | ||
| 1319 | For Git repositories, you must specify | ||
| 1320 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRCREV'><filename>SRCREV</filename></ulink> | ||
| 1321 | and you should specify | ||
| 1322 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PV'><filename>PV</filename></ulink> | ||
| 1323 | to include the revision with | ||
| 1324 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRCPV'><filename>SRCPV</filename></ulink>. | ||
| 1325 | Here is an example from the recipe | ||
| 1326 | <filename>meta/recipes-kernel/blktrace/blktrace_git.bb</filename>: | ||
| 1327 | <literallayout class='monospaced'> | ||
| 1328 | SRCREV = "d6918c8832793b4205ed3bfede78c2f915c23385" | ||
| 1329 | |||
| 1330 | PR = "r6" | ||
| 1331 | PV = "1.0.5+git${SRCPV}" | ||
| 1332 | |||
| 1333 | SRC_URI = "git://git.kernel.dk/blktrace.git \ | ||
| 1334 | file://ldflags.patch" | ||
| 1335 | </literallayout></para></listitem> | ||
| 1336 | </itemizedlist> | ||
| 1234 | </para> | 1337 | </para> |
| 1235 | </section> | 1338 | </section> |
| 1236 | 1339 | ||
| @@ -1263,18 +1366,6 @@ license shipped with the source. | |||
| 1263 | </para> | 1366 | </para> |
| 1264 | </section> | 1367 | </section> |
| 1265 | 1368 | ||
| 1266 | <section id='new-recipe-optionally-supporting-services'> | ||
| 1267 | <title>Supporting Services</title> | ||
| 1268 | |||
| 1269 | <para> | ||
| 1270 | We'll probably also need some subsections on specific extra functions needed in | ||
| 1271 | some recipes e.g. how to add support for services (sysvinit and systemd), | ||
| 1272 | adding PACKAGECONFIG options, dealing with alternatives, etc. There's a | ||
| 1273 | question in my mind on how some of these will overlap with the class reference | ||
| 1274 | section though. | ||
| 1275 | </para> | ||
| 1276 | </section> | ||
| 1277 | |||
| 1278 | <section id='new-recipe-configuring-the-recipe'> | 1369 | <section id='new-recipe-configuring-the-recipe'> |
| 1279 | <title>Configuring the Recipe</title> | 1370 | <title>Configuring the Recipe</title> |
| 1280 | 1371 | ||
| @@ -1302,8 +1393,8 @@ the target, etc. | |||
| 1302 | </para> | 1393 | </para> |
| 1303 | </section> | 1394 | </section> |
| 1304 | 1395 | ||
| 1305 | <section id='new-recipe-optionally-installing'> | 1396 | <section id='new-recipe-installing'> |
| 1306 | <title>Optionally Installing</title> | 1397 | <title>Installing</title> |
| 1307 | 1398 | ||
| 1308 | <para> | 1399 | <para> |
| 1309 | install: for autotools/cmake recipes, if the recipe passes through do_install | 1400 | install: for autotools/cmake recipes, if the recipe passes through do_install |
| @@ -1313,6 +1404,36 @@ failure. For non-autotools recipes you need to define your own do_install | |||
| 1313 | </para> | 1404 | </para> |
| 1314 | </section> | 1405 | </section> |
| 1315 | 1406 | ||
| 1407 | <section id='new-recipe-optionally-supporting-services'> | ||
| 1408 | <title>Supporting Services</title> | ||
| 1409 | |||
| 1410 | <para> | ||
| 1411 | We'll probably also need some subsections on specific extra functions needed in | ||
| 1412 | some recipes e.g. how to add support for services (sysvinit and systemd), | ||
| 1413 | adding PACKAGECONFIG options, dealing with alternatives, etc. There's a | ||
| 1414 | question in my mind on how some of these will overlap with the class reference | ||
| 1415 | section though. | ||
| 1416 | </para> | ||
| 1417 | |||
| 1418 | <para> | ||
| 1419 | If you are adding services and the service initialization | ||
| 1420 | script or the service file itself is not installed, you must | ||
| 1421 | provide for that installation in your recipe. | ||
| 1422 | If your recipe already has a <filename>do_install</filename> | ||
| 1423 | function, you will need to create a | ||
| 1424 | <filename>do_install_append</filename> function to handle the | ||
| 1425 | installation of your services. | ||
| 1426 | </para> | ||
| 1427 | |||
| 1428 | <para> | ||
| 1429 | When you create the installation for your services, you need | ||
| 1430 | to accomplish what is normally done by "make install". | ||
| 1431 | In other words, make sure your installation puts the output | ||
| 1432 | in a layout that is similar to how they will be laid out on the | ||
| 1433 | target system. | ||
| 1434 | </para> | ||
| 1435 | </section> | ||
| 1436 | |||
| 1316 | <section id='new-recipe-packaging'> | 1437 | <section id='new-recipe-packaging'> |
| 1317 | <title>Packaging</title> | 1438 | <title>Packaging</title> |
| 1318 | 1439 | ||
diff --git a/documentation/dev-manual/figures/recipe-workflow.png b/documentation/dev-manual/figures/recipe-workflow.png index 2c05e94745..96c14bbcbf 100644 --- a/documentation/dev-manual/figures/recipe-workflow.png +++ b/documentation/dev-manual/figures/recipe-workflow.png | |||
| Binary files differ | |||
