Category:How to - Fast Boot

From Gumstix User Wiki
Revision as of 16:24, 23 March 2011 by Maroc (Talk | contribs) (Initial info outlining boot optimization process.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

The Gumstix boot process is far from optimized and several steps must be taken to reduce boot time. Since the boot process is comprised of 3 different boot stages, changes must be made in each stage to get the quickest boot time possible. The steps here outline the various techniques to reduce boot time.

Boot Process

The OMAP boot process is outlined in detail at the omapedia page.

The first boot stage attempts to load the x-loader from different sources such as the serial port, mmc card, nand, etc. Once loaded, the x-load will run u-boot. U-boot then loads the kernel into memory and executes it. Once the kernel has initialized all core components and drivers, control is transferred to init which executes startup scripts to activate the various system services.

Boot Optimization

In order to optimize the boot process, each step of the boot process can potentially be reduced through various means. The areas which we look at in this how to include

  • Modify x-load
  • Modify u-boot
  • Reduce kernel size
  • Remove kernel modules
  • Remove unnecessary execution of init scripts
  • Modify kernel

Init Scripts

The first and easiest step to reduce boot time is to turn off any unnecessary init scripts. After the kernel is loaded and ready for operation, the "init" process is started. Init is the father of all processes and is responsible for starting terminals, executing init scripts, etc. The innitab file in /etc/ specifies the run level, number of terminals, and other options for init. In the Angstrom distribution, init is configured to run scripts in /etc/rcS.d as well as scripts in /etc/rc#.d where # is the run level.

Look in /etc/rcS.d to see what scripts are run at start. You should see symbolic links in the form S##name where ## is a two digit number and name is the name of the script linked in /etc/init.d/. Each script prefixed with an "S" is started at boot time. The two digit number specifies the order each script is started. Higher numbers are started after lower numbers. Also in this directory may be scripts that start with a "K". Scripts starting with a "K" are "killed" or stopped. That is they are executed with a "stop" parameter that tells the script to shutdown the service.

There will also be the same type of scripts in each /etc/rc#.d run level directory. By default, Angstrom is set to start at run level "5" which typically in linux systems is the run level for a graphical environment. You may want to change inittab to run level "3" to for a console run level.

So how do you turn these services off? You can either rename the S##name script to K##name or remove the S##name symlink altogether. Removing the symlink is the easiest path and should not cause any side effects unless you are switching between run levels. Most users won't be changing the run level (except to halt and reboot) so you should be safe by simply removing the symlinks.

Todo: Offer suggestions on which services to turn off.

Kernel

Kernel Size

Reducing kernel size has several benefits for reducing boot time:

  • Kernel is loaded faster from NAND/SD
  • Unnecessary components are not executed
  • Less output from nonessential systems

Reducing kernel size requires you to reconfigure and recompile the kernel.

Todo: Details on kernel recompile.

Kernel Modules

Any unneeded kernel drivers compiled as modules and loaded at boot time should be removed. Any modules needed at boot time should be compiled into the kernel. This will increase the kernel size but the additional size should be offset by the reduced overhead of loading the module.

Kernel drivers that are currently compiled into the kernel and not needed at boot time, should be compiled as modules and only loaded when needed. This will reduce the kernel size and prevent the kernel from executing the driver until needed.

Todo: Details...

U-Boot

U-boot needs heavy modification in order to reduce its total time before loading and executing the kernel.

  • Remove most or all output
  • Disable kernel CRC check
  • Disable unnecessary drivers
  • Reduce memory usage
  • Add compile flags for optimization

X-Load

X-load can be modified similar to u-boot.

This category currently contains no pages or media.