Optimization

This is very important factor of every vendor to reduce device boot time. There are following optimization will be discussed in this article

  • Boot time optimization

Device boot as soon as possible for user interaction (display and camera)

  • Image size optimization

Reduce the size of files so we can maintain in cloud or local storage with less space as well as booting time also will reduced

  • Build time optimization

Reduce the time of image building by removing the unwanted services and applications

Before start optimization we should follow one factor needs to enable time stamp and measure every stage boot time for bootloader, kernel and file system.

uboot:

  • Needs to remove boot delay for the final products
  • Needs to remove uboot console
  • Configure the kernel loading address and size
  • Configure the file system type
  • Remove/ disabled the debug logs
  • Remove/disable debug UART related configuration as the production level
  • Remove unwanted configurations from board header file

kernel:

  • Remove/ disabled the debug logs.
  • Make low priority driver as dynamic loading
  • Memory configuration optimization (Contiguous Memory Allocation (CMA) )
  • Remove the unwanted driver from build and load.
  • Removed unwanted Serial Peripheral Interface (SPI) module
  • Removed unwanted Library routines from the build
  • Removed unwanted crypto methods from the build
  • Removed unwanted processor support from build
  • Removed unwanted filesystems format support from the build
  • Removed unwanted sound driver/module from build
  • Removed unused kernel config from defconfig
  • Disable the kernel log by removing the loglevel parameter from device configuration
  • Remove/disable debug uart related configuration as the production level
  • Minimizing the driver size
    • Example WIFI chip used SDIO connection as per hardware but UART related code also present in the same driver, needs to remove/disable the code from compile
    • Example BT chip used UART connection as per hardware but SDIO related code also present in the same driver, needs to remove/disable the code from compile
  • Increase the CPU frequency as max level.

For available frequency

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

Set maximum frequency

# echo max_freq > sys/devices/system/cpu/cpu0/cpufre/scaling_setspeed

File System:

  • Remove the unwanted services
  • From init.rc remove or avoid starting unnecessary service and daemons
  • Start zygote early
  • Tunning the cpuset parameter
  • Disable all unwanted services
  • Remove the unwanted application by using following flag

PRODUCT_PACKAGES_REMOVE

  • Remove the unwanted modules.

Build time:

  • Ignore unwanted application to rebuild.
  • Ignore unwanted module to rebuild.
  • Ignore the unwanted service to rebuild by using following flag

PRODUCT_PACKAGES_REMOVE

Over The Air (OTA) package:

  • Instead of adding all software package just to add the following partitions in OTA build.

Boot, Vbmeta, System and Vendor

Enable tools and method to verify booting time in target properly

  • Bootchart
  • Systrace

Leave a Comment