summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2013-04-05 06:13:13 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-04-10 16:20:54 +0100
commit3ccd6fde214b4514cc5cf68f8020bbcb355581a4 (patch)
tree648ab573179bbdd6f4efe91f5c7b87b9281edf24 /documentation
parent46a05ed934e7b3bbb0c2093d72bdbe7e513ea8a5 (diff)
downloadpoky-3ccd6fde214b4514cc5cf68f8020bbcb355581a4.tar.gz
dev-manual: Changes to the read-only root filesystem section.
Applied the review comments from Paul Eggleton to augment this section with more information. Performed a spell check on the entire chapter. Made the term "postinstall" consistent by defining its first use in sections a "post-installation (postinstall) script". (From yocto-docs rev: 179f478777fd02e3fa56d80951ce3eab350fc189) 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.xml148
1 files changed, 118 insertions, 30 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml
index 70ecc2276a..f8b41bf54d 100644
--- a/documentation/dev-manual/dev-manual-common-tasks.xml
+++ b/documentation/dev-manual/dev-manual-common-tasks.xml
@@ -1022,10 +1022,11 @@
1022 </section> 1022 </section>
1023 1023
1024 <section id='usingpoky-extend-addpkg-postinstalls'> 1024 <section id='usingpoky-extend-addpkg-postinstalls'>
1025 <title>Post Install Scripts</title> 1025 <title>Post-Installation Scripts</title>
1026 1026
1027 <para> 1027 <para>
1028 To add a post-installation script to a package, add a <filename>pkg_postinst_PACKAGENAME() 1028 To add a post-installation (postinstall) script to a package,
1029 add a <filename>pkg_postinst_PACKAGENAME()
1029 </filename> function to the <filename>.bb</filename> file and use 1030 </filename> function to the <filename>.bb</filename> file and use
1030 <filename>PACKAGENAME</filename> as the name of the package you want to attach to the 1031 <filename>PACKAGENAME</filename> as the name of the package you want to attach to the
1031 <filename>postinst</filename> script. 1032 <filename>postinst</filename> script.
@@ -1488,7 +1489,7 @@
1488 These situations almost always exist when a library API 1489 These situations almost always exist when a library API
1489 changes and you have multiple pieces of software that 1490 changes and you have multiple pieces of software that
1490 depend on the separate versions of the library. 1491 depend on the separate versions of the library.
1491 To accomodate these situations, you can install multiple 1492 To accommodate these situations, you can install multiple
1492 versions of the same library in parallel on the same system. 1493 versions of the same library in parallel on the same system.
1493 </para> 1494 </para>
1494 1495
@@ -2297,7 +2298,7 @@
2297 your own distribution. 2298 your own distribution.
2298 You can use the Yocto Project out-of-the-box to create the 2299 You can use the Yocto Project out-of-the-box to create the
2299 <filename>poky-tiny</filename> distribution. 2300 <filename>poky-tiny</filename> distribution.
2300 Ulitmately, you will want to make changes in your own 2301 Ultimately, you will want to make changes in your own
2301 distribution that are likely modeled after 2302 distribution that are likely modeled after
2302 <filename>poky-tiny</filename>. 2303 <filename>poky-tiny</filename>.
2303 <note> 2304 <note>
@@ -2870,7 +2871,7 @@
2870 <para> 2871 <para>
2871 If you have more than one distribution alias, separate them with a space. 2872 If you have more than one distribution alias, separate them with a space.
2872 Note that the build system currently automatically checks the 2873 Note that the build system currently automatically checks the
2873 Fedora, OpenSuSE, Debian, Ubuntu, 2874 Fedora, OpenSUSE, Debian, Ubuntu,
2874 and Mandriva distributions for source package recipes without having to specify them 2875 and Mandriva distributions for source package recipes without having to specify them
2875 using the <filename>DISTRO_PN_ALIAS</filename> variable. 2876 using the <filename>DISTRO_PN_ALIAS</filename> variable.
2876 For example, the following command generates a report that lists the Linux distributions 2877 For example, the following command generates a report that lists the Linux distributions
@@ -3447,8 +3448,8 @@
3447 <title>Creating a Read-Only Root Filesystem</title> 3448 <title>Creating a Read-Only Root Filesystem</title>
3448 3449
3449 <para> 3450 <para>
3450 Suppose, for security reasons, you need to disable the 3451 Suppose, for security reasons, you need to disable
3451 your target device's root filesystem's write permisions 3452 your target device's root filesystem's write permissions
3452 (i.e. you need a read-only root filesystem). 3453 (i.e. you need a read-only root filesystem).
3453 Or, perhaps you are running the device's operating system 3454 Or, perhaps you are running the device's operating system
3454 from a read-only storage device. 3455 from a read-only storage device.
@@ -3456,34 +3457,121 @@
3456 that behavior. 3457 that behavior.
3457 </para> 3458 </para>
3458 3459
3459 <para> 3460 <note>
3460 To create a read-only root filesystem, simply add the 3461 Supporting a read-only root filesystem requires that the system and
3461 "read-only-rootfs" feature to your image. 3462 applications do not try to write to the root filesystem.
3462 Using either of the following statements in your 3463 If writes are attempted, they need to gracefully fail.
3463 image recipe or from within the 3464 </note>
3464 <filename>local.conf</filename> file found in the Build 3465
3465 Directory causes the build system to create a 3466 <section id='post-installation-scripts'>
3466 read-only root filesystem: 3467 <title>Post-Installation Scripts</title>
3467 <literallayout class='monospaced'> 3468
3469 <para>
3470 It is very important that you make sure all
3471 Post-Installation (postinstall) scripts
3472 for packages that are installed into the image can be run
3473 at the time when the root filesystem is created during the
3474 build on the host system.
3475 These scripts cannot attempt to run during first-boot on the
3476 target device.
3477 With the read-only root filesystem feature enabled,
3478 the build system checks during root filesystem creation to make
3479 sure all postinstall scripts succeed.
3480 If any of these scripts still need to be run after the root
3481 filesystem is created, the build immediately fails.
3482 These checks during build time ensure that the build fails
3483 rather than the target device fails later during its
3484 initial boot operation.
3485 </para>
3486
3487 <para>
3488 Most of the common postinstall scripts generated by the build
3489 system for the out-of-the-box Yocto Project are engineered
3490 so that they can run during root filesystem creation
3491 (e.g. postinstall scripts for caching fonts).
3492 However, if you create and add custom scripts, you need
3493 to be sure they can be run during file system creation.
3494 </para>
3495
3496 <para>
3497 Here are some common problems that prevent postinstall
3498 scripts from running during root filesystem creation:
3499 <itemizedlist>
3500 <listitem><para>Not using
3501 <filename>$</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-D'><filename>D</filename></ulink>
3502 in front of absolute paths.
3503 The build system defines <filename>$D</filename>, and
3504 it is blank when run on the target device.
3505 This implies two purposes for <filename>$D</filename>:
3506 ensuring paths are valid in both the host and target
3507 environments, and checking to determine which
3508 environment is being used as a method for taking
3509 appropriate actions.
3510 </para></listitem>
3511 <listitem><para>Attempting to run processes that are
3512 specific to or dependent on the target
3513 architecture.
3514 You can work around these attempts by using native
3515 tools to accomplish the same processes (tasks), or
3516 by alternatively running the processes under QEMU,
3517 which has the <filename>qemu_run_binary</filename>
3518 function.
3519 For more information, see the
3520 <filename>meta/classes/qemu.bbclass</filename>
3521 class in the
3522 <link linkend='source-directory'>Source Directory</link>.
3523 </para></listitem>
3524 <listitem><para>Using hardware features specific to the machine.
3525 </para></listitem>
3526 </itemizedlist>
3527 </para>
3528 </section>
3529
3530 <section id='areas-with-write-access'>
3531 <title>Areas With Write Access</title>
3532
3533 <para>
3534 With the read-only root filesystem feature enabled, any
3535 attempt by the target to write to the root filesystem at
3536 runtime fails.
3537 Consequently, you must make sure that you configure processes
3538 and applications that attempt these types of writes do so
3539 to directories with write access (i.e.
3540 <filename>/tmp</filename> or <filename>/var/run</filename>).
3541 </para>
3542 </section>
3543
3544 <section id='creating-the-root-filesystem'>
3545 <title>Creating the Root Filesystem</title>
3546
3547 <para>
3548 To create the read-only root filesystem, simply add the
3549 "read-only-rootfs" feature to your image.
3550 Using either of the following statements in your
3551 image recipe or from within the
3552 <filename>local.conf</filename> file found in the
3553 <link linkend='build-directory'>Build Directory</link>
3554 causes the build system to create a read-only root filesystem:
3555 <literallayout class='monospaced'>
3468 IMAGE_FEATURES = "read-only-rootfs" 3556 IMAGE_FEATURES = "read-only-rootfs"
3469 </literallayout> 3557 </literallayout>
3470 or 3558 or
3471 <literallayout class='monospaced'> 3559 <literallayout class='monospaced'>
3472 EXTRA_IMAGE_FEATURES = "read-only-rootfs" 3560 EXTRA_IMAGE_FEATURES = "read-only-rootfs"
3473 </literallayout> 3561 </literallayout>
3474 </para> 3562 </para>
3475 3563
3476 <para> 3564 <para>
3477 For more information on how to use these variables, see the 3565 For more information on how to use these variables, see the
3478 "<link linkend='usingpoky-extend-customimage-imagefeatures'>Customizing Images Using Custom <filename>IMAGE_FEATURES</filename> and <filename>EXTRA_IMAGE_FEATURES</filename></link>" 3566 "<link linkend='usingpoky-extend-customimage-imagefeatures'>Customizing Images Using Custom <filename>IMAGE_FEATURES</filename> and <filename>EXTRA_IMAGE_FEATURES</filename></link>"
3479 section. 3567 section.
3480 For information on the variables, see 3568 For information on the variables, see
3481 <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_FEATURES'><filename>IMAGE_FEATURES</filename></ulink> 3569 <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_FEATURES'><filename>IMAGE_FEATURES</filename></ulink>
3482 and <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGE_FEATURES'><filename>EXTRA_IMAGE_FEATURES</filename></ulink>. 3570 and <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGE_FEATURES'><filename>EXTRA_IMAGE_FEATURES</filename></ulink>.
3483 </para> 3571 </para>
3572 </section>
3484 </section> 3573 </section>
3485 3574
3486
3487 <section id="platdev-gdb-remotedebug"> 3575 <section id="platdev-gdb-remotedebug">
3488 <title>Debugging With the GNU Project Debugger (GDB) Remotely</title> 3576 <title>Debugging With the GNU Project Debugger (GDB) Remotely</title>
3489 3577