Difference between revisions of "Boot-up Time Reduction Howto"

From eLinux.org
Jump to: navigation, search
m (Table of Reduction Techniques)
(Fixing broken links.)
 
(15 intermediate revisions by 5 users not shown)
Line 38: Line 38:
 
Here ase some techniques for speeding up the Firmware phase of the boot sequence:
 
Here ase some techniques for speeding up the Firmware phase of the boot sequence:
  
*[Kernel XIP] - Kernel Execute-In-Place
+
*[[Kernel XIP]] - Kernel Execute-In-Place
*SkipFirmware - Disable firmware features to eliminate diagnostics, memory counts, etc.
+
*SkipFirmware - Disable [[firmware]] features to eliminate diagnostics, memory counts, etc.
*[Parallel HD SpinUp] - Parallelize Hard Disk spinup with Kernel load
+
*[[Parallel HDSpin Up]] - Parallelize Hard Disk spinup with Kernel load
*[Dma Copy Of Kernel On Startup] - Use DMA to copy kernel from flash to RAM
+
*[[DMA Copy Of Kernel On Startup]] - Use DMA to copy kernel from flash to RAM
  
 
== Kernel Phase ==
 
== Kernel Phase ==
Line 47: Line 47:
  
 
*DisableConsole - Turn off serial console output during boot  
 
*DisableConsole - Turn off serial console output during boot  
*[Preset LPJ] - Use pre-set loops_per_jiffy (avoid calibrate_delay())
+
*[[Preset LPJ]] - Use pre-set loops_per_jiffy (avoid calibrate_delay())
*[Preconfigure PCI] -  Preconfigure some PCI bus slots
+
*Preconfigure PCI -  Preconfigure some PCI bus slots
*[IDE No Probe] - Don't probe some IDE devices -  
+
*[[IDE No Probe]] - Don't probe some IDE devices -  
*[No Probe Missing Devices] - Disable probes for non-existent devices (including keyboards, etc.)
+
*No Probe Missing Devices - Disable probes for non-existent devices (including keyboards, etc.)
*[Small Kernel Config] - Use smallest kernel configuration possible  
+
*Small Kernel Config - Use smallest kernel configuration possible  
*[Reduce Driver Busy Waits] - Shorten device probes by reducing the amount of time the driver busywaits
+
*Reduce Driver Busy Waits - Shorten device probes by reducing the amount of time the driver busywaits
**A special case of this is [Short IDE Delays], with IDE driver delays
+
**A special case of this is [[Short IDE Delays]], with IDE driver delays
*[Threaded Init] - Perform threaded initialization - replace driver busywaits with yields
+
*Threaded Init - Perform threaded initialization - replace driver busywaits with yields
**A special case of this is [IDE Preempt], with IDE driver busywaits
+
**A special case of this is [[IDE Preempt]], with IDE driver busywaits
*[Load Drivers Later] - Use modules where possible to move driver initialization later in the boot sequence  
+
*Load Drivers Later - Use modules where possible to move driver initialization later in the boot sequence
  
 
== User Space Phase ==
 
== User Space Phase ==
 
The following are techniques for reducing the bootup time for user-space programs:  
 
The following are techniques for reducing the bootup time for user-space programs:  
  
*[Application XIP] - Execute-In-Place for applications and librarys  
+
*[[Application XIP]] - Execute-In-Place for applications and librarys  
*[Reduce RC Scripts] - Eliminate unneeded RC scripts  
+
*Reduce RC Scripts - Eliminate unneeded RC scripts  
*[Custom Init Program] - Use a custom initialization program
+
*Custom Init Program - Use a custom initialization program
(This is a special case of eliminating unneeded RC scripts)
+
**(This is a special case of eliminating unneeded RC scripts)
*[Optimize RC Scripts] - Optimize RC script execution
+
*[[Optimize RC Scripts]] - Optimize RC script execution
*[Parallel RC Scripts"] - Execute RC scripts in parallel, instead of in sequence
+
*[[Parallel RC Scripts]] - Execute RC scripts in parallel, instead of in sequence
*[Pre Linking] - Avoid overhead of runtime link fixups during first program/library load
+
*[[Pre Linking]] - Avoid overhead of runtime link fixups during first program/library load
*[Reduce Flash Writes] - Reduce writes to flash
+
*Reduce Flash Writes - Reduce writes to flash. (In particular, perhaps you want to "disable the date of last access" with noatime [http://forums.techarena.in/tips-tweaks/1053888.htm][http://stackoverflow.com/questions/81158/files-on-xp-is-turning-off-last-access-time-safe][http://beta.ivancover.com/wiki/index.php/Eee_PC_Linux#Less_Disk_Writes][http://home.x-pec.com/~ivc/sites/ivc/ibook/linux/][http://danweinreb.org/blog/using-solid-state-disks-on-linux][http://24.97.150.195/nstwiki/index.php/HowTo_Disable_The_%22relatime%22_Method_For_%22atime%22_Updates_For_A_File])
*[Disable Logging Turn] - off logging to stable storage  
+
*Disable Logging - Turn off logging to stable storage  
*[Faster File System - Use faster file system  
+
*Faster File System - Use faster file system  
*[Ramdisk During Boot] - Use RAMDISK during boot
+
*Ramdisk During Boot - Use RAMDISK during boot
*[Segmented File System] - Use a segmented file system to avoid interference between reads and writes
+
*Segmented File System - Use a segmented file system to avoid interference between reads and writes
  
 
== General Reduction Techniques ==
 
== General Reduction Techniques ==
 
Some reduction techniques don't apply to a specific boot phase, but are general methods to reduce bootup time.  These are listed here.
 
Some reduction techniques don't apply to a specific boot phase, but are general methods to reduce bootup time.  These are listed here.
  
*SmallerPrograms - Use smaller kernel and programs for faster load times
+
*Smaller Programs - Use smaller kernel and programs for faster load times
*FasterMemory - Use faster system memory to increase load and initialization performance
+
*Faster Memory - Use faster system memory to increase load and initialization performance
  
 
== Table of Reduction Techniques ==
 
== Table of Reduction Techniques ==
Line 93: Line 93:
 
|[[Kernel XIP]]||Firmware||Kernel Execute-In-Place - avoids kernel copy and decompression time          ||250 ms||causes runtime performance loss
 
|[[Kernel XIP]]||Firmware||Kernel Execute-In-Place - avoids kernel copy and decompression time          ||250 ms||causes runtime performance loss
 
|-
 
|-
|[[Skip Firmware]]||Firmware||Skip firmware probing features,  like memory check, bus probing, and device detection, etc.||??|| Linux re-probes busses and devices anyway, so this is usually waste of time
+
|Skip Firmware||Firmware||Skip firmware probing features,  like memory check, bus probing, and device detection, etc.||??|| Linux re-probes busses and devices anyway, so this is usually waste of time
 
|-
 
|-
|[[Parallel HD SpinUp]] ||Firwmare||Start hard drive spin up before loading kernel                              ||??    ||Not possible if the kernel is loaded from  hard drive.
+
|[[Parallel HDSpin Up]] ||Firwmare||Start hard drive spin up before loading kernel                              ||??    ||Not possible if the kernel is loaded from  hard drive.
 
|-
 
|-
|[[Dma Copy Of Kernel On Startup]]||Firmware||Use DMA to copy kernel from flash to RAM                                    ||180 ms||.
+
|[[DMA Copy Of Kernel On Startup]]||Firmware||Use DMA to copy kernel from flash to RAM                                    ||180 ms||.
 
|-
 
|-
 
|[[Preset LPJ]]||Kernel||Use a hardcoded loops_per_jiffy value to avoid cost of calibration.          ||250 ms||.
 
|[[Preset LPJ]]||Kernel||Use a hardcoded loops_per_jiffy value to avoid cost of calibration.          ||250 ms||.
 
|-
 
|-
|[[No Probe Missing Devices]]||Kernel||Avoid probing for non-existent keyboards and other devices                  ||??    ||.
+
|No Probe Missing Devices||Kernel||Avoid probing for non-existent keyboards and other devices                  ||??    ||.
 
|-
 
|-
|[[Small Kernel Config]]||Kernel||Reduce kernel size and length of code paths, thereby reducing execution overhead||??||.
+
|Small Kernel Config||Kernel||Reduce kernel size and length of code paths, thereby reducing execution overhead||??||.
 
|-
 
|-
 
|[[Disable Console]]||Kernel||Turn off output to serial console during boot                                ||250 ms||.
 
|[[Disable Console]]||Kernel||Turn off output to serial console during boot                                ||250 ms||.
 
|-
 
|-
|[[Preconfigure PCI]]||Kernel||Preconfigure PCI bus slots on kernel command line                            ||??||Is this even possible?
+
|Preconfigure PCI||Kernel||Preconfigure PCI bus slots on kernel command line                            ||??||Is this even possible?
 
|-
 
|-
|[[Load Drivers Later]]||Drivers||Move drivers to modules and load them later in boot sequence.)              ||??||Only works for drivers that can be loaded as modules late in the boot cycle.
+
|Load Drivers Later||Drivers||Move drivers to modules and load them later in boot sequence.)              ||??||Only works for drivers that can be loaded as modules late in the boot cycle.
 
|-
 
|-
 
|[[IDE No Probe]]||Drivers||Use "noprobe" on kernel command line for IDE driver                          ||3 sec.||Depends on hardware present
 
|[[IDE No Probe]]||Drivers||Use "noprobe" on kernel command line for IDE driver                          ||3 sec.||Depends on hardware present
 
|-
 
|-
|[[Reduce Driver Busy Waits]]||Drivers||Reduce the length of driver busy waits                                      ||??||.
+
|Reduce Driver Busy Waits||Drivers||Reduce the length of driver busy waits                                      ||??||.
 
|-
 
|-
 
|[[Short IDE Delays]]||Drivers||Reduce length of IDE initialization delays                                  ||5 sec.||May be dangerous, depends on hardware
 
|[[Short IDE Delays]]||Drivers||Reduce length of IDE initialization delays                                  ||5 sec.||May be dangerous, depends on hardware
 
|-
 
|-
|[[Threaded Init]]||Drivers||Replace busywaits in drivers with yields                                    ||??||Only adds value if driver can be parallelized with some other init activity.
+
|Threaded Init||Drivers||Replace busywaits in drivers with yields                                    ||??||Only adds value if driver can be parallelized with some other init activity.
 
|-
 
|-
 
|[[IDE Preempt]]||Drivers||Replace busywaits in IDE drivers with yields                                ||250 ms (decreased non-preemptibility)||Already fixed in 2.6
 
|[[IDE Preempt]]||Drivers||Replace busywaits in IDE drivers with yields                                ||250 ms (decreased non-preemptibility)||Already fixed in 2.6
 
|-
 
|-
|[[Reduce RC Scripts]]||RC scripts||Eliminate unneeded init scripts                                              ||3 sec.||Depends on required scripts
+
|Reduce RC Scripts||RC scripts||Eliminate unneeded init scripts                                              ||3 sec.||Depends on required scripts
 
|-
 
|-
 
|[[Parallel RC Scripts]]||RC scripts||Start init scripts in parallel                                              ||??||.
 
|[[Parallel RC Scripts]]||RC scripts||Start init scripts in parallel                                              ||??||.
 
|-
 
|-
|[[Defer RC Scripts]]||RC scripts||Defer some init scripts to later in boot cycle                              ||??||.
+
|Defer RC Scripts||RC scripts||Defer some init scripts to later in boot cycle                              ||??||.
 
|-
 
|-
 
|[[Optimize RC Scripts]]||RC scripts||Use busybox, smaller shell, builtins, adjusted scripts                      ||3 sec.||Depends on required scripts
 
|[[Optimize RC Scripts]]||RC scripts||Use busybox, smaller shell, builtins, adjusted scripts                      ||3 sec.||Depends on required scripts
 
|-
 
|-
|[[Custom Init Program]]||RC scripts|| Use custom initialization program (eliminating RC scripts altogether)      ||10 sec.||requires long-term maintenance of the program
+
|Custom Init Program||RC scripts|| Use custom initialization program (eliminating RC scripts altogether)      ||10 sec.||requires long-term maintenance of the program
 
|-
 
|-
 
|[[Application XIP]]||User Space||Use Execute-In-Place for applications and libraries.                        ||??||Requires uncompressed file system. Application performance may be reduced.
 
|[[Application XIP]]||User Space||Use Execute-In-Place for applications and libraries.                        ||??||Requires uncompressed file system. Application performance may be reduced.
 
|-
 
|-
|[[Segmented File System]]||User Space||Keep read-only data separate from writable data in flash storage            ||??||.
+
|Segmented File System||User Space||Keep read-only data separate from writable data in flash storage            ||??||.
 
|-
 
|-
|[[Reduce Flash Writes]]||User Space||Avoid writes to flash memory                                                ||??||.
+
|Reduce Flash Writes||User Space||Avoid writes to flash memory                                                ||??||.
 
|-
 
|-
|[[Ramdisk During Boot]]||User Space||Keep writable files in RAM, and write them to flash after boot              ||??||.
+
|Ramdisk During Boot||User Space||Keep writable files in RAM, and write them to flash after boot              ||??||.
 
|-
 
|-
|[[Smaller Programs]]||User Space||Use smallest programs and configurations possible                            ||??||Reduces program load time. It may increase cache hits.
+
|Smaller Programs||User Space||Use smallest programs and configurations possible                            ||??||Reduces program load time. It may increase cache hits.
 
|-
 
|-
|[[Faster Memory]]||General||Use faster memory                                                            ||??||.
+
|Faster Memory||General||Use faster memory                                                            ||??||.
 
|}
 
|}
  

Latest revision as of 18:45, 27 January 2010

The items on this page constitute a list of existing techniques for reducing bootup times for embedded systems. Some of these items may also be applicable to desktop or enterprise systems, but that is not the focus.

For each individual item below, a separate page should exist. If it doesn't already exist, a new page should be created using the !HowtoTemplate. Links listed in red below are pages that are not created yet. To sign up for a task related to this HOWTO, please see the Bootup Time Howto Task List.

Introduction

Bootup Phases

This document divides the bootup process into 3 main phases:

  • Firmware initialization phase
  • Kernel initialization phase
  • User Space initialization phase

User Space usually consists of a few distinct phases also:

  • Initialization scripts (RC scripts, for desktop systems)
    • This is where most daemons and services are loaded.
  • Graphics system initialization
  • Graphical environment start
  • Application initialization

Main Technique Types

Techniques presented here can be organized according to the way they try to achieve their effect. The technique can consist of:

  1. speeding up the activity
  2. doing the activity in parallel with other initialization tasks
  3. doingthe activity later (possibly after booting is completed)
  4. avoiding doing the activity at all.

In summary, each technique describes how to take an existing bootup activity and do one of:

  • Do it faster
  • Do it in parallel
  • Do it later
  • Don't do it at all

Some techniques will consist of multiple methods (such as both speeding up and doing it in parallel).

Bootup Time Reduction Technique Outline

Following is an outline of different bootup time reduction techniques, organized by the boot phase where they are applied.

Firmware Phase

Here ase some techniques for speeding up the Firmware phase of the boot sequence:

Kernel Phase

The following are techniques used to speed up the initialization of the kernel:

  • DisableConsole - Turn off serial console output during boot
  • Preset LPJ - Use pre-set loops_per_jiffy (avoid calibrate_delay())
  • Preconfigure PCI - Preconfigure some PCI bus slots
  • IDE No Probe - Don't probe some IDE devices -
  • No Probe Missing Devices - Disable probes for non-existent devices (including keyboards, etc.)
  • Small Kernel Config - Use smallest kernel configuration possible
  • Reduce Driver Busy Waits - Shorten device probes by reducing the amount of time the driver busywaits
  • Threaded Init - Perform threaded initialization - replace driver busywaits with yields
    • A special case of this is IDE Preempt, with IDE driver busywaits
  • Load Drivers Later - Use modules where possible to move driver initialization later in the boot sequence

User Space Phase

The following are techniques for reducing the bootup time for user-space programs:

  • Application XIP - Execute-In-Place for applications and librarys
  • Reduce RC Scripts - Eliminate unneeded RC scripts
  • Custom Init Program - Use a custom initialization program
    • (This is a special case of eliminating unneeded RC scripts)
  • Optimize RC Scripts - Optimize RC script execution
  • Parallel RC Scripts - Execute RC scripts in parallel, instead of in sequence
  • Pre Linking - Avoid overhead of runtime link fixups during first program/library load
  • Reduce Flash Writes - Reduce writes to flash. (In particular, perhaps you want to "disable the date of last access" with noatime [1][2][3][4][5][6])
  • Disable Logging - Turn off logging to stable storage
  • Faster File System - Use faster file system
  • Ramdisk During Boot - Use RAMDISK during boot
  • Segmented File System - Use a segmented file system to avoid interference between reads and writes

General Reduction Techniques

Some reduction techniques don't apply to a specific boot phase, but are general methods to reduce bootup time. These are listed here.

  • Smaller Programs - Use smaller kernel and programs for faster load times
  • Faster Memory - Use faster system memory to increase load and initialization performance

Table of Reduction Techniques

The following table summarizes the various techniques listed in this document.

Acronyms and Terms
Technique Boot Phase Description Observed reduction Notes
Kernel XIP Firmware Kernel Execute-In-Place - avoids kernel copy and decompression time 250 ms causes runtime performance loss
Skip Firmware Firmware Skip firmware probing features, like memory check, bus probing, and device detection, etc. ?? Linux re-probes busses and devices anyway, so this is usually waste of time
Parallel HDSpin Up Firwmare Start hard drive spin up before loading kernel ?? Not possible if the kernel is loaded from hard drive.
DMA Copy Of Kernel On Startup Firmware Use DMA to copy kernel from flash to RAM 180 ms .
Preset LPJ Kernel Use a hardcoded loops_per_jiffy value to avoid cost of calibration. 250 ms .
No Probe Missing Devices Kernel Avoid probing for non-existent keyboards and other devices ?? .
Small Kernel Config Kernel Reduce kernel size and length of code paths, thereby reducing execution overhead ?? .
Disable Console Kernel Turn off output to serial console during boot 250 ms .
Preconfigure PCI Kernel Preconfigure PCI bus slots on kernel command line ?? Is this even possible?
Load Drivers Later Drivers Move drivers to modules and load them later in boot sequence.) ?? Only works for drivers that can be loaded as modules late in the boot cycle.
IDE No Probe Drivers Use "noprobe" on kernel command line for IDE driver 3 sec. Depends on hardware present
Reduce Driver Busy Waits Drivers Reduce the length of driver busy waits ?? .
Short IDE Delays Drivers Reduce length of IDE initialization delays 5 sec. May be dangerous, depends on hardware
Threaded Init Drivers Replace busywaits in drivers with yields ?? Only adds value if driver can be parallelized with some other init activity.
IDE Preempt Drivers Replace busywaits in IDE drivers with yields 250 ms (decreased non-preemptibility) Already fixed in 2.6
Reduce RC Scripts RC scripts Eliminate unneeded init scripts 3 sec. Depends on required scripts
Parallel RC Scripts RC scripts Start init scripts in parallel ?? .
Defer RC Scripts RC scripts Defer some init scripts to later in boot cycle ?? .
Optimize RC Scripts RC scripts Use busybox, smaller shell, builtins, adjusted scripts 3 sec. Depends on required scripts
Custom Init Program RC scripts Use custom initialization program (eliminating RC scripts altogether) 10 sec. requires long-term maintenance of the program
Application XIP User Space Use Execute-In-Place for applications and libraries. ?? Requires uncompressed file system. Application performance may be reduced.
Segmented File System User Space Keep read-only data separate from writable data in flash storage ?? .
Reduce Flash Writes User Space Avoid writes to flash memory ?? .
Ramdisk During Boot User Space Keep writable files in RAM, and write them to flash after boot ?? .
Smaller Programs User Space Use smallest programs and configurations possible ?? Reduces program load time. It may increase cache hits.
Faster Memory General Use faster memory ?? .

Potential Techniques

Here is a list of potential techniques that have not been tried yet, to our knowledge:

  • Use different, faster, firmware
  • Cache results of find and grep during RC scripts
  • Partial XIP (this is a current project of the WG)