Course contentsShow
← Embedded Systems & Computer Architecture
Lesson 780 of 93611. Introduction to Embedded LinuxFree lesson

Optimizing Embedded Boot Time Performance

Apply techniques to identify and reduce bottlenecks in the boot sequence to meet strict power-on to application-ready time requirements.

In this lesson, you will learn how to systematically identify and eliminate latency in the Embedded Linux boot sequence to achieve near-instantaneous application availability.

To optimize boot time, you must stop viewing the transition from power-on to user space as a monolith and instead treat it as a series of measurable, serial stages. The boot process follows a predictable path: Bootloader (e.g., U-Boot) → Kernel Initialization → Root Filesystem (RootFS) Mounting → System Initialization (Init system). Bottlenecks typically hide in the transitions between these stages.

Measuring the Latency

Before optimizing, you must quantify the duration of every step. Use the initcall_debug kernel parameter to timestamp each driver initialization during boot, or use bootgraph.pl (a tool provided in the Linux kernel source) to visualize the exact duration of each kernel process. By correlating these logs with the bootloader’s serial console timestamps, you can identify if your delay is caused by slow storage initialization, unnecessary peripheral probing, or bloated initialization scripts.

Core Optimization Techniques

Once you identify the "slow" stages, apply these three surgical techniques:

  1. Kernel Pruning: If your kernel is loading unnecessary drivers (e.g., sound support for a headless sensor node), it wastes cycles. Recompile the kernel as a monolithic image rather than loading modules dynamically, as module loading introduces significant I/O latency.
  2. Filesystem Speed: Filesystem mounting is often the biggest bottleneck. Switch from a generic filesystem to a streamlined, read-only compressed filesystem like SquashFS or ubifs, which minimizes metadata overhead.
  3. Init Parallelization: Standard Systemd or SysVinit scripts often run sequentially. Audit your initialization chain and move non-critical services (like networking or display drivers) to start in the background or only when requested by the application.

Consider this snippet for a stripped-down bootcmd in your bootloader:

# Disable verbose logging and reduce timeout
setenv bootargs "console=null quiet loglevel=0 root=/dev/mtdblock3 rootfstype=squashfs"
setenv bootcmd "nand read ${kernel_addr} kernel; bootm ${kernel_addr}"

By silencing the kernel console (loglevel=0) and using a compressed SquashFS, you shave milliseconds off the I/O bottleneck, which is critical for systems with strict timing requirements.

Key Takeaway: Boot time optimization is the iterative process of profiling each stage, pruning kernel bloat, and minimizing I/O overhead to eliminate idle wait times during system bring-up.