Embedding Linux

751 views
703 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
751
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
32
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Embedding Linux

  1. 1. Embedding Linux David Woodhouse Red Hat, Inc OLS 2002
  2. 2. Introduction <ul><li>Linux for embedded system area </li></ul><ul><ul><li>Overview of application currently being used </li></ul></ul><ul><ul><li>New application for which development is in progress </li></ul></ul><ul><ul><li>Requirement & problems unique to such embedded applications </li></ul></ul><ul><li>Table of contents </li></ul><ul><ul><li>Current situation of Linux </li></ul></ul><ul><ul><li>Scaling down Linux kernel </li></ul></ul><ul><ul><li>uClinux </li></ul></ul><ul><ul><li>Low fat libraries & Utilities </li></ul></ul><ul><ul><li>Power management </li></ul></ul><ul><ul><li>Hot plug capabilities </li></ul></ul><ul><ul><li>Storage </li></ul></ul>
  3. 3. Current Situation of Linux <ul><li>Characteristics of Embedded Systems </li></ul><ul><ul><li>Limited battery capacity </li></ul></ul><ul><ul><li>Limited Storage – small flash memory </li></ul></ul><ul><ul><li>Small display of touch screen </li></ul></ul><ul><li>Why Linux? </li></ul><ul><ul><li>Cost per unit ! </li></ul></ul><ul><li>Motivate new research area </li></ul><ul><ul><li>power management </li></ul></ul><ul><ul><li>flash storage </li></ul></ul><ul><ul><li>code size reduction </li></ul></ul><ul><ul><li>new user interface </li></ul></ul>PC Embedded System Enterprise System
  4. 4. Scaling down Linux kernel <ul><li>Linux kernel size </li></ul><ul><ul><li>gzipped tarball size increased from 7301B(v0.01) to 32MB(v2.5.12) </li></ul></ul><ul><ul><ul><li>largely for new architecture, subsystem, device driver that is conditional part </li></ul></ul></ul><ul><ul><li>Pure kernel size nearly doubled v2.0->v2.4 </li></ul></ul><ul><ul><ul><li>Not conditional code </li></ul></ul></ul><ul><ul><li>No visible work for scaling down!!! </li></ul></ul><ul><li>Candidates for further kernel size reduction </li></ul><ul><ul><li>networking part </li></ul></ul><ul><ul><li>code part for block device support </li></ul></ul><ul><ul><ul><li>significant size saving is possible </li></ul></ul></ul><ul><ul><ul><li>But complicated task : VFS, VM system, etc. </li></ul></ul></ul>
  5. 5. uClinux <ul><li>port of Linux to microcontroller without MMU </li></ul><ul><ul><li>MMU is prime candidate for removal : Single user mode is sufficient for most embedded systems </li></ul></ul><ul><li>“ flat” format binary </li></ul><ul><ul><li>new binary format of uClinux </li></ul></ul><ul><ul><li>enables drastic rearrangement for loading user space programs </li></ul></ul><ul><ul><ul><li>all user process shared single address space </li></ul></ul></ul><ul><ul><ul><li>PIC for data & text segment </li></ul></ul></ul><ul><li>Supported Platforms </li></ul><ul><ul><li>Motorola m68k-based CPUS, ARM, Axis’ ETRAX, Intel i960, etc. </li></ul></ul>
  6. 6. Low fat library & Utilities <ul><li>Libraries for small footprint </li></ul><ul><ul><li>Linux libc5 : maintained version of old GNU libc 1.07.4 branch </li></ul></ul><ul><ul><li>uClibc : uClinux version of libc with MMU support </li></ul></ul><ul><ul><ul><li>http://www.uclibc.org </li></ul></ul></ul><ul><ul><ul><li>supprots ARM, MIPS, PowerPC, Hitachi Super-H, etc. </li></ul></ul></ul><ul><ul><li>diet libc : even better code size reduction then uClibc </li></ul></ul><ul><ul><ul><li>far more routines are rewritten </li></ul></ul></ul><ul><ul><ul><li>http://www.fefe.de/dietlibc </li></ul></ul></ul><ul><li>Multifunction binaries </li></ul><ul><ul><li>Binaries which can replace a large number of standard utils (cat, mv, cp, ln, …) </li></ul></ul><ul><ul><li>BusyBox for uClibc & glibc : http://www.busybox.net </li></ul></ul><ul><ul><li>embutils for diet libc : http://www.fefe.de/embutils </li></ul></ul>
  7. 7. Power Managements <ul><li>Suspended Mode </li></ul><ul><ul><li>all circuit except the RAM can be disabled </li></ul></ul><ul><ul><li>CPU can be placed into a low-power state or evenly can be shutdown </li></ul></ul><ul><ul><ul><li>when shutdown, single 32 bit address is still alive that contains return address </li></ul></ul></ul><ul><ul><ul><li>special interrupt can wake up CPU </li></ul></ul></ul>
  8. 8. Power Management <ul><li>Frequency Scaling </li></ul><ul><ul><li>CPU consume less power at slower speed </li></ul></ul><ul><ul><li>Basic support is present in the 2.4 version for ARM architecture </li></ul></ul><ul><ul><ul><li>ARM Integrator, SA1100, SA1110 </li></ul></ul></ul><ul><ul><ul><li>Various Intel IA32 clone architecture </li></ul></ul></ul><ul><ul><ul><li>CPUFreq supports for AMD PowerNow & VIA Cyrix Longhaul Tech. </li></ul></ul></ul><ul><ul><ul><li>Intel SpeedStep support is lagging far behind the rest </li></ul></ul></ul><ul><ul><li>Not Yet Implemented but planned </li></ul></ul><ul><ul><ul><li>on-shot timer to set up a wake-up time instead of fixed-frequency timer interrupt </li></ul></ul></ul>
  9. 9. Hotplug capabilities <ul><li>PCMCIA code rewriting is in progress </li></ul><ul><li>Basic support for dynamic addtion & removal of PCI device is in Linux kernel </li></ul><ul><ul><li>support physical insertion, removal, probing, & notification of driver </li></ul></ul><ul><ul><li>device driver must be upgraded to the New PCI driver API </li></ul></ul>
  10. 10. Hotplug capabilities <ul><li>One severe problem of PCI Hotplug code </li></ul><ul><ul><li>address space assignment problem for newly-inserted cards </li></ul></ul><ul><ul><ul><li>physical address space for PCI device is limited </li></ul></ul></ul><ul><ul><ul><li>currently system reserve some address space for each PCI bus </li></ul></ul></ul><ul><ul><ul><li>If multiple PCI busses are present, repeated insertion & removal of PCI device on different bus will cause resource range fragmentation </li></ul></ul></ul><ul><ul><li>expected solution </li></ul></ul><ul><ul><ul><li>New PCI driver API for moving BARs of device </li></ul></ul></ul><ul><ul><ul><li>Interrupt disabling or stopping HW itself during relocation </li></ul></ul></ul>
  11. 11. Storage <ul><li>Distinguishing feature of embedded storage </li></ul><ul><ul><li>Storage requirement in embedded system area is much different from conventional one </li></ul></ul><ul><ul><ul><li>persistent storage, low power consumption, relatively low cost, etc. </li></ul></ul></ul><ul><ul><ul><li>In most cases, flash memory is the only solution </li></ul></ul></ul><ul><li>NOR flash </li></ul><ul><ul><li>can be connected directly to the CPU’s address & data buses </li></ul></ul><ul><ul><li>reading is treated as ROM </li></ul></ul><ul><ul><li>writing is done in block units </li></ul></ul><ul><ul><ul><li>large erase block(64KB-128KB) </li></ul></ul></ul>
  12. 12. Storage <ul><li>NAND flash </li></ul><ul><ul><li>cannot access directly </li></ul></ul><ul><ul><li>data, address, commands are exchanged over a single 8-bit bus </li></ul></ul><ul><ul><ul><li>reading, writing is performed in command mode </li></ul></ul></ul><ul><ul><li>smaller erase block (around 8KB) & each block is subdivided into pages of typically 512B </li></ul></ul><ul><ul><li>cheaper, higher production tolerance than NOR flash </li></ul></ul><ul><ul><ul><li>low bit error & bad erase block rate </li></ul></ul></ul>
  13. 13. Storage <ul><li>Difficulties in using flash </li></ul><ul><ul><li>Need “wear leveling” </li></ul></ul><ul><ul><ul><li>to ensure that the block erases are evenly distributed over the entire range of the chips </li></ul></ul></ul><ul><ul><ul><li>use of traditional filesystem is not appropriate </li></ul></ul></ul><ul><ul><li>Larger block size than traditional block device </li></ul></ul><ul><ul><ul><li>Needs a form of “pseudo filesystem” layer that emulate device with small block size </li></ul></ul></ul><ul><li>Need New Approach!!! </li></ul><ul><ul><li>JFFS : operate directly on flash memory itself </li></ul></ul>
  14. 14. Storage <ul><li>XIP : Execute in place </li></ul><ul><ul><li>Using data directly from the flash medium by entering pages of the flash chip directly into the page tables </li></ul></ul><ul><ul><li>Can only use NOR flash & currently is not implemented in Linux </li></ul></ul><ul><ul><li>XIP and compression are mutually exclusive </li></ul></ul><ul><ul><li>effective option in situations where low power consumption is extremely important </li></ul></ul>
  15. 15. Storage <ul><li>Problems in using XIP </li></ul><ul><ul><li>Driver must ensure that flash is in read mode </li></ul></ul><ul><ul><ul><li>When using MMU, it is not possible!!! </li></ul></ul></ul><ul><ul><li>Solution? </li></ul></ul><ul><ul><ul><li>scheduling must be disabled when chip is not in read mode - Not feasible </li></ul></ul></ul><ul><ul><ul><li>every mapping of a flash page to user space must be found - Feasible but needs reverse mappings of physical addresses to virtual addresses </li></ul></ul></ul><ul><ul><li>Need new filesystem that support XIP effectively </li></ul></ul>
  16. 16. Conclusion <ul><li>There’s a lot more work to be done in these area </li></ul>

×