diff options
Diffstat (limited to 'documentation/getting-started/eclipse/html/getting-started/fakeroot-and-pseudo.html')
-rw-r--r-- | documentation/getting-started/eclipse/html/getting-started/fakeroot-and-pseudo.html | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/documentation/getting-started/eclipse/html/getting-started/fakeroot-and-pseudo.html b/documentation/getting-started/eclipse/html/getting-started/fakeroot-and-pseudo.html new file mode 100644 index 0000000000..8354ad6730 --- /dev/null +++ b/documentation/getting-started/eclipse/html/getting-started/fakeroot-and-pseudo.html | |||
@@ -0,0 +1,91 @@ | |||
1 | <html> | ||
2 | <head> | ||
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | ||
4 | <title>3.5. Fakeroot and Pseudo</title> | ||
5 | <link rel="stylesheet" type="text/css" href="../book.css"> | ||
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> | ||
7 | <link rel="home" href="index.html" title="Getting Started With Yocto Project"> | ||
8 | <link rel="up" href="overview-concepts.html" title="Chapter 3. Yocto Project Concepts"> | ||
9 | <link rel="prev" href="automatically-added-runtime-dependencies.html" title="3.4. Automatically Added Runtime Dependencies"> | ||
10 | <link rel="next" href="wayland.html" title="3.6. Wayland"> | ||
11 | </head> | ||
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" title="3.5. Fakeroot and Pseudo"> | ||
13 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> | ||
14 | <a name="fakeroot-and-pseudo"></a>3.5. Fakeroot and Pseudo</h2></div></div></div> | ||
15 | <p> | ||
16 | Some tasks are easier to implement when allowed to perform certain | ||
17 | operations that are normally reserved for the root user (e.g. | ||
18 | <a class="link" href="../ref-manual/ref-tasks-install.html" target="_self"><code class="filename">do_install</code></a>, | ||
19 | <a class="link" href="../ref-manual/ref-tasks-package_write_deb.html" target="_self"><code class="filename">do_package_write*</code></a>, | ||
20 | <a class="link" href="../ref-manual/ref-tasks-rootfs.html" target="_self"><code class="filename">do_rootfs</code></a>, | ||
21 | and | ||
22 | <a class="link" href="../ref-manual/ref-tasks-image.html" target="_self"><code class="filename">do_image*</code></a>). | ||
23 | For example, the <code class="filename">do_install</code> task benefits | ||
24 | from being able to set the UID and GID of installed files to | ||
25 | arbitrary values. | ||
26 | </p> | ||
27 | <p> | ||
28 | One approach to allowing tasks to perform root-only operations | ||
29 | would be to require BitBake to run as root. | ||
30 | However, this method is cumbersome and has security issues. | ||
31 | The approach that is actually used is to run tasks that benefit | ||
32 | from root privileges in a "fake" root environment. | ||
33 | Within this environment, the task and its child processes believe | ||
34 | that they are running as the root user, and see an internally | ||
35 | consistent view of the filesystem. | ||
36 | As long as generating the final output (e.g. a package or an image) | ||
37 | does not require root privileges, the fact that some earlier | ||
38 | steps ran in a fake root environment does not cause problems. | ||
39 | </p> | ||
40 | <p> | ||
41 | The capability to run tasks in a fake root environment is known as | ||
42 | "<a class="ulink" href="http://man.he.net/man1/fakeroot" target="_self">fakeroot</a>", | ||
43 | which is derived from the BitBake keyword/variable | ||
44 | flag that requests a fake root environment for a task. | ||
45 | </p> | ||
46 | <p> | ||
47 | In the OpenEmbedded build system, the program that implements | ||
48 | fakeroot is known as Pseudo. | ||
49 | Pseudo overrides system calls by using the environment variable | ||
50 | <code class="filename">LD_PRELOAD</code>, which results in the illusion | ||
51 | of running as root. | ||
52 | To keep track of "fake" file ownership and permissions resulting | ||
53 | from operations that require root permissions, Pseudo uses | ||
54 | an SQLite 3 database. | ||
55 | This database is stored in | ||
56 | <code class="filename">${</code><a class="link" href="../ref-manual/var-WORKDIR.html" target="_self"><code class="filename">WORKDIR</code></a><code class="filename">}/pseudo/files.db</code> | ||
57 | for individual recipes. | ||
58 | Storing the database in a file as opposed to in memory | ||
59 | gives persistence between tasks and builds, which is not | ||
60 | accomplished using fakeroot. | ||
61 | </p> | ||
62 | <div class="note" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;"> | ||
63 | <h3 class="title">Caution</h3> | ||
64 | If you add your own task that manipulates the same files or | ||
65 | directories as a fakeroot task, then that task also needs to | ||
66 | run under fakeroot. | ||
67 | Otherwise, the task cannot run root-only operations, and | ||
68 | cannot see the fake file ownership and permissions set by the | ||
69 | other task. | ||
70 | You need to also add a dependency on | ||
71 | <code class="filename">virtual/fakeroot-native:do_populate_sysroot</code>, | ||
72 | giving the following: | ||
73 | <pre class="literallayout"> | ||
74 | fakeroot do_mytask () { | ||
75 | ... | ||
76 | } | ||
77 | do_mytask[depends] += "virtual/fakeroot-native:do_populate_sysroot" | ||
78 | </pre> | ||
79 | </div> | ||
80 | <p> | ||
81 | For more information, see the | ||
82 | <a class="link" href="../bitbake-user-manual/var-FAKEROOT.html" target="_self"><code class="filename">FAKEROOT*</code></a> | ||
83 | variables in the BitBake User Manual. | ||
84 | You can also reference the | ||
85 | "<a class="ulink" href="http://www.ibm.com/developerworks/opensource/library/os-aapseudo1/index.html" target="_self">Pseudo</a>" | ||
86 | and | ||
87 | "<a class="ulink" href="https://github.com/wrpseudo/pseudo/wiki/WhyNotFakeroot" target="_self">Why Not Fakeroot?</a>" | ||
88 | articles for background information on Pseudo. | ||
89 | </p> | ||
90 | </div></body> | ||
91 | </html> | ||