diff options
| -rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 150 |
1 files changed, 149 insertions, 1 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index 69a42542da..39da63436f 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
| @@ -2013,7 +2013,7 @@ | |||
| 2013 | </para> | 2013 | </para> |
| 2014 | </section> | 2014 | </section> |
| 2015 | 2015 | ||
| 2016 | <section id="creating-your-own-distribution"> | 2016 | <section id='creating-your-own-distribution'> |
| 2017 | <title>Creating Your Own Distribution</title> | 2017 | <title>Creating Your Own Distribution</title> |
| 2018 | 2018 | ||
| 2019 | <para> | 2019 | <para> |
| @@ -2127,6 +2127,154 @@ | |||
| 2127 | </para> | 2127 | </para> |
| 2128 | </section> | 2128 | </section> |
| 2129 | 2129 | ||
| 2130 | <section id='building-a-tiny-system'> | ||
| 2131 | <title>Building a Tiny System</title> | ||
| 2132 | |||
| 2133 | <literallayout class='monospaced'> | ||
| 2134 | * Introduction that tells what, why, and benefits | ||
| 2135 | * Overview of the process | ||
| 2136 | * Cutting back on the kernel size | ||
| 2137 | * Cutting back on the filesystem (libc and busybox) | ||
| 2138 | </literallayout> | ||
| 2139 | |||
| 2140 | <para> | ||
| 2141 | Very small distributions have some significant advantages such | ||
| 2142 | requiring less on-die memory (cheaper), better performance through | ||
| 2143 | efficient cache usage, lower power requirements due to less | ||
| 2144 | memory, faster boot times, and reduced development overhead. | ||
| 2145 | Some real-world examples where a very small distribution gives | ||
| 2146 | you distinct advantages are digital cameras, medical devices, | ||
| 2147 | small headless systems, and partitioned flash. | ||
| 2148 | You can use the Yocto Project to create very small distribution. | ||
| 2149 | </para> | ||
| 2150 | |||
| 2151 | <para> | ||
| 2152 | This section presents information that shows you how you can | ||
| 2153 | trim your distribution to even smaller sizes than the | ||
| 2154 | 8 Mbytes <filename>poky-tiny</filename> distribution that | ||
| 2155 | can be built out-of-the-box using the Yocto Project. | ||
| 2156 | </para> | ||
| 2157 | |||
| 2158 | <section id='tiny-system-overview'> | ||
| 2159 | <title>Overview</title> | ||
| 2160 | |||
| 2161 | <para> | ||
| 2162 | The following list presents the overall steps you need to | ||
| 2163 | consider and perform to create very small systems that | ||
| 2164 | have a kernel and root filesystem under 4 Mbytes, boot to the | ||
| 2165 | shell in under two seconds, maintain <filename>ipv4</filename> | ||
| 2166 | functionality, and avoid an initial RAM disk: | ||
| 2167 | <itemizedlist> | ||
| 2168 | <listitem><para>Determine your goals and guiding | ||
| 2169 | principles.</para></listitem> | ||
| 2170 | <listitem><para>Know what you are starting with. | ||
| 2171 | </para></listitem> | ||
| 2172 | <listitem><para>Trim the root filesystem. | ||
| 2173 | </para></listitem> | ||
| 2174 | <listitem><para>Trim the kernel</para></listitem> | ||
| 2175 | </itemizedlist> | ||
| 2176 | </para> | ||
| 2177 | </section> | ||
| 2178 | |||
| 2179 | <section id='goals-and-guiding-principles'> | ||
| 2180 | <title>Goals and Guiding Principles</title> | ||
| 2181 | |||
| 2182 | <para> | ||
| 2183 | Before you can reach your destination, you need to know | ||
| 2184 | where you are going. | ||
| 2185 | Here is an example list that you can use as a guide when | ||
| 2186 | creating very small distributions: | ||
| 2187 | <itemizedlist> | ||
| 2188 | <listitem><para>Determine how much space you need | ||
| 2189 | (e.g. a kernel that is 1 Mbyte or less and | ||
| 2190 | a root filesystem that is 3 Mbytes or less). | ||
| 2191 | </para></listitem> | ||
| 2192 | <listitem><para>Find the areas that are currently | ||
| 2193 | taking 90% of the space and concentrate on that | ||
| 2194 | for trimming. | ||
| 2195 | </para></listitem> | ||
| 2196 | <listitem><para>Do not create any difficult "hacks" | ||
| 2197 | to achieve your goals.</para></listitem> | ||
| 2198 | <listitem><para>Leverage of the device-specific | ||
| 2199 | options.</para></listitem> | ||
| 2200 | <listitem><para>Do your work in a separate layer | ||
| 2201 | to keep changes isolated. | ||
| 2202 | For information on how to create layers, see | ||
| 2203 | the "<link linkend='understanding-and-creating-layers'>Understanding and Creating Layers</link>" section. | ||
| 2204 | </para></listitem> | ||
| 2205 | </itemizedlist> | ||
| 2206 | </para> | ||
| 2207 | </section> | ||
| 2208 | |||
| 2209 | <section id='know-what-you-are-starting-with'> | ||
| 2210 | <title>Know What You Are Starting With</title> | ||
| 2211 | |||
| 2212 | <para> | ||
| 2213 | You will need to have an image from which you can | ||
| 2214 | work. | ||
| 2215 | The Yocto Project ships with the ability to create a | ||
| 2216 | <filename>poky-tiny</filename> distribution. | ||
| 2217 | This distribution consists of a small, sub-8 Mbyte kernel | ||
| 2218 | that works with two shipped Board Support Packages (BSPs): | ||
| 2219 | Fish River Island 2 and QEMU. | ||
| 2220 | You can use this distribution as a starting point and trim | ||
| 2221 | down from there. | ||
| 2222 | If you need to build out the <filename>poky-tiny</filename> | ||
| 2223 | distribution, see the | ||
| 2224 | "<link linkend='creating-your-own-distribution'>Creating Your Own Distribution</link>" | ||
| 2225 | section. | ||
| 2226 | </para> | ||
| 2227 | |||
| 2228 | <para> | ||
| 2229 | Understanding some memory concepts will help you reduce the | ||
| 2230 | system size. | ||
| 2231 | Memory consists of static, dynamic, and temporary memory. | ||
| 2232 | Static memory is the TEXT, DATA, and BSS sections. | ||
| 2233 | Dynamic memory contains memory that is allocate at runtime, | ||
| 2234 | stacks, hashtables, and so forth. | ||
| 2235 | Temporary memory is decompression and | ||
| 2236 | <filename>__init__</filename> | ||
| 2237 | </para> | ||
| 2238 | |||
| 2239 | <para> | ||
| 2240 | To help you see where you currently are with kernel and root | ||
| 2241 | filesystem sizes, you can use some tools found in the | ||
| 2242 | <link linkend='source-directory'>Source Directory</link> in | ||
| 2243 | the <filename>scripts</filename> directory: | ||
| 2244 | <itemizedlist> | ||
| 2245 | <listitem><para><filename>ksize.py</filename>: Reports | ||
| 2246 | the size of the kernel files.</para></listitem> | ||
| 2247 | <listitem><para><filename>dirsize.py</filename>: Reports | ||
| 2248 | the size of the root filesystem.</para></listitem> | ||
| 2249 | </itemizedlist> | ||
| 2250 | This next tool and command helps you organized configuration | ||
| 2251 | fragments and view file dependencies in a human-readable form: | ||
| 2252 | <itemizedlist> | ||
| 2253 | <listitem><para><filename>merge_config.sh</filename>: | ||
| 2254 | Merges individual configuration fragments. | ||
| 2255 | For more information on configuration fragments, see | ||
| 2256 | the | ||
| 2257 | "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#generating-configuration-files'>Generating Configuration Files</ulink>" | ||
| 2258 | section of the Yocto Project Linux Kernel Development | ||
| 2259 | Manual and the "<link linkend='creating-config-fragments'>Creating Configuration Fragments</link>" | ||
| 2260 | section in this manual.</para></listitem> | ||
| 2261 | <listitem><para><filename>bitbake -u depexp -g core-image-*</filename>: | ||
| 2262 | Using the BitBake command with these options brings up | ||
| 2263 | a Dependency Explorer from which you can view file | ||
| 2264 | dependencies. | ||
| 2265 | Understanding these dependencies allows you to make | ||
| 2266 | sane decisions when cutting out various pieces of the | ||
| 2267 | kernel and root filesystem.</para></listitem> | ||
| 2268 | </itemizedlist> | ||
| 2269 | </para> | ||
| 2270 | </section> | ||
| 2271 | |||
| 2272 | <section id='trim-the-root-filesystem'> | ||
| 2273 | <title>Trim the Root Filesystem</title> | ||
| 2274 | |||
| 2275 | </section> | ||
| 2276 | </section> | ||
| 2277 | |||
| 2130 | <section id='working-with-packages'> | 2278 | <section id='working-with-packages'> |
| 2131 | <title>Working with Packages</title> | 2279 | <title>Working with Packages</title> |
| 2132 | 2280 | ||
