Boot time optimization

Boot time Optimization

Often the first OS worked out, has lacks in performance optimizations. The Boot time is one of the most annoying itch in a mobile device: a mobile user wants its device up and running in seconds, not minutes!
As an example now we would like to talk about one JZ4760 based tablet which went from KORIDY. The first OS worked out was delivered with a boot time from turn-on to user space of 35s.
This was acceptable looking it as a part of the development process because our customer was already having a complete development platform to work on the application layer. But looking at the product finalizing phase, that boot time was considered unacceptable.
We taken the challenge to lower the boot time to at least 7s and we got it even better, we achieved a boot time of 4 seconds!

Boot phases

The boot process, from turning on the device to having the User Interface active, can be divided in three phases:
1. Bootloader: In this phase all the bootloaders run in sequence to initialize critical hardware interfaces such as Main Memory, and OS provisioning devices. The last bootloader load the OS kernel in memory and execute it.
2. Kernel: Here the OS kernel initialize its services and all needed peripherals before executing some user space code.
3. Userland: Constituted by all the user space programs which runs before having the device active.
While in a debug version these phases must be developer friendly, in a deployment version of the software, these phases have to be optimized in execution speed. Let’s see in depth what differs between the two cases:

Original state

Original state

Optimized state

Optimized state

Bootloader

Debug
• Should initialize main interfaces in the way external debuggers can work
• Must expose a realtime debug logs through some device
• The provisioning device should be changeable in developer’s need
• Should provide a console to let the developer check what is happening
• Should be easily upgradeable

Deployment
• Should initialize main interfaces for performance
• Should load straight the OS kernel image
• May perform some disaster recovery tasks

Kernel

Debug
• Should give extensive logging
• Can be delivered with a kernel debugger module
• It’s free in size

Deployment
• Its image should be as small as possible to lower the bootloader time
• Any unnecessary delays should be eliminated

Userland

Debug
• Should be as customizable as possible
• Should give extensive logging
• Should expose more than one access doors

Deployment
• Should be static: all decisions have to be chosen.
• Should give logs only in case of problems
• Have to be optimized for performance

Optimization

The optimization task is done following the previous written criteria and applying strategies derived from a constantly updated developers team.
In this way we reached the result for the JZ4760 based tablet from KORIDY: A boot time of 4s.