EN | IT | DE

Cart

Close

No products in the shopping cart.

DESK-MX9-L-AN-0001: Boot time optimization

Dieses Dokument bietet eine praxisorientierte Anleitung zur Reduzierung der Boot‑Zeit auf DESK‑MX9‑L‑basierten Plattformen von DAVE Embedded Systems. Ein schneller Systemstart ist für viele Embedded‑Anwendungen entscheidend. Das Dokument beschreibt die wichtigsten Systemparameter und Optimierungstechniken, die die Startzeit beeinflussen, darunter die Wahl des Speichermediums, die U‑Boot‑Konfiguration, Kernel‑Parameter und der Aufbau des Root‑Dateisystems.

Es wird erläutert, wie U‑Boot‑Umgebungsvariablen — wie bootdelay, quiet, bootcmd und mmcargs — angepasst werden können, um frühe Verzögerungen zu minimieren, die Konsolenausgabe zu reduzieren und die Auswahl der Boot‑Quelle zu vereinfachen, was zu schnelleren Kernel‑Ladezeiten führt.

Die Optimierung des Root‑Dateisystems umfasst das Entfernen unnötiger Komponenten und Dienste sowie die Nutzung des Falcon‑Modus, bei dem der SPL den Kernel direkt lädt und den vollständigen U‑Boot‑Prozess überspringt. Dies verkürzt den Übergang zum Linux‑System erheblich.

Abschließend beschreibt das Dokument die verwendete Testkonfiguration und präsentiert die Messergebnisse, die zeigen, wie sich verschiedene Optimierungen — insbesondere eine Verringerung des Root‑Dateisystem‑Footprints — positiv auf die Boot‑Zeit auswirken.

Insgesamt bietet die Seite eine strukturierte Methodik für Embedded‑Entwickler, die die Startzeit ihres Systems durch gezielte Anpassungen im Bootloader, Kernel und Initialisierungssystem verbessern möchten.

Core contents

Introduction

A very fast boot time it's an important feature of Embedded devices. Read the steps listed in this application Note allows to optimize the major boot stages for reducing the boot time.

The Application Note describes some typical optimizations that can be done on DAVE Embedded Systems's products to shorten the boot time.

Boot parameters

It should be taken into account that boot time results strongly depend on the overall system configuration and involves - mainly - the following parameters:

  • U-Boot storage device, i.e. from which device the internal bootrom fetches the u-boot code
  • Linux binaries storage device: i.e. where the kernel and dtb binaries are loaded from for copying them on DDR memory
  • u-boot startup configuration
    • boot parameters
    • loading binaries optimization
  • root file system storage device: i.e. where the rfs is stored
  • root file system init process optimization: i.e. which daemons are loaded at the beginning

In this AN we will use the eMMC storage device, mounted in the SOM - using an SDIO bus to communicate with the SoC. It is the fastest device for booting from the complete embedded Linux BSP.

U-boot hacking

U-Boot allows the modification of some environment variables to reduce the timer elapsed in the initial stages:

  • bootdelay: this var, used for waiting an interaction from the user to the console, can be reduced to 0 seconds (it is still possible to stop U-Boot)
  • quiet: this var, added to the kernel command line, avoids displaying the information messages in the serial console. This reduces a lot the kernel boot time
  • bootcmd: this string allows to try and select from different boot sources (USB, SD, eMMC, etc.)
    • once the final storage device has been selected, it is possible to force the boot directly from the selected source
    • mmcargs: in our example, we boot from the internal eMMC loading the kernel and device tree from the /boot directory where the binaries are stored in

root file system optimization

A minimal root file system size allows to reduce the loading and starting time for the system services. Yocto provides a standard recipe for this kind of image: core-image-base.

Starting from this image, it is possible to add your application and services for starting - as soon as possible - the final application.

Falcon mode

This mode allows SPL to boot directly the kernel avoiding the use of U-Boot second stage and reducing a lot this step. NXP provides the AN14093 application note which describes the hacking steps for properly modifying the U-Boot sources.

Test configuration

System configuration

  • AURA Evaluation Kit
  • SOC: NXP i.MX9352 1.7GHz
  • Flash storage: 8GB internal eMMC
  • U-Boot SPL 2023.04
  • Linux desk-mx93 6.1.55
  • root file system: core-image-base

U-Boot

  • bootdelay
u-boot=> print bootdelay
bootdelay=0
u-boot=>
  • bootcmd
u-boot=> pri bootcmd
bootcmd=run emmcargs; run emmc_loadk emmc_loadfdt; run mmcboot
u-boot=>
  • emmcargs
u-boot=> print emmcargs
emmcargs=setenv bootargs root=${emmcroot} logo.nologo vt.global_cursor_default=0 quiet
u-boot=> print emmcroot
emmcroot=/dev/mmcblk0p1 rootwait rw
u-boot=> print emmc_loadk
emmc_loadk=ext4load mmc 0:1 ${loadaddr} boot/${image}
u-boot=> print emmc_loadfdt
emmc_loadfdt=ext4load mmc 0:1 ${fdtaddr} boot/${fdtfile}
u-boot=> print mmcboot
mmcboot=booti ${loadaddr} - ${fdtaddr}
u-boot=>

boot time results

To verify the boot time achieved, a serial port terminal with timestamping grabbing capabilities has been used: the grabserial Linux application is perfectly useful for this purposes.

The original boot time, using the standard dave-image-devel target image, is roughly 20 s (expand the section here below to see the bootlog)


 

After the optimizations introduced, here below the captured serial log:

[0.000001 0.000001] 
[0.364770 0.364769] U-Boot SPL 2023.04-desk-mx9-l-5.1.0 (Apr 05 2024 - 13:58:53 +0000)
[0.000514 0.000514] SOM ConfigID#: 00000002
[0.000667 0.000154] SOM UniqueID#: 614a038d:d8502f60
[0.000865 0.000198] SOC: 0xa1009300
[0.000956 0.000091] LC: 0x2040010
[0.001039 0.000083] PMIC: Over Drive Voltage Mode
[0.001206 0.000166] DDR: 3733MTS
[0.127625 0.126420] M33 prepare ok
[0.128218 0.000593] Normal Boot
[0.128575 0.000356] Trying to boot from BOOTROM
[0.128912 0.000337] Boot Stage: Primary boot
[0.129282 0.000370] image offset 0x8000, pagesize 0x200, ivt offset 0x0
[0.130088 0.000807] Load image from 0x57000 by ROM_API
[0.234750 0.104661] NOTICE:  BL31: v2.8(release):lf-6.1.55-2.2.0-0-g08e9d4eef
[0.235908 0.001158] NOTICE:  BL31: Built : 06:43:30, Nov 21 2023
[0.650614 0.414706] 
[0.651262 0.000648] 
[0.651376 0.000113] U-Boot 2023.04-desk-mx9-l-5.1.0 (Apr 05 2024 - 13:58:53 +0000)
[0.652690 0.001314] 
[0.652714 0.000025] CPU:   i.MX93(52) rev1.1 1700 MHz (running at 1692 MHz)
[0.653526 0.000812] CPU:   Industrial temperature grade (-40C to 105C) at 56C
[0.781333 0.127807] Reset cause: POR (0x1)
[0.782368 0.001035] Model: DAVE i.MX93 AURA Board SOC rev 1 on SBCX CB2001
[0.783148 0.000780] DRAM:  2 GiB
[0.854364 0.071215] Core:  201 devices, 27 uclasses, devicetree: separate
[0.854772 0.000408] MMC:   FSL_SDHC: 0, FSL_SDHC: 1
[0.854952 0.000180] Loading Environment from MMC... OK
[0.888310 0.033359] Fail to setup video link
[0.907659 0.019349] In:    serial
[0.907716 0.000057] Out:   serial
[0.907767 0.000051] Err:   serial
[0.907868 0.000102] 
[0.907874 0.000006] BuildInfo:
[0.907915 0.000041]   - ELE firmware version 0.1.0-44880904
[0.908054 0.000139] 
[0.946836 0.038782] switch to partitions #0, OK
[0.947203 0.000366] mmc1 is current device
[0.947383 0.000180] SOM ConfigID#: 00000002
[0.947617 0.000234] SOM UniqueID#: 614a038d:d8502f60
[1.025297 0.077680] CB ConfigID#: 00002001
[1.025669 0.000372] CB UniqueID#: 8e000035:c46cb62d
[1.026091 0.000422] flash target is MMC:1
[1.058120 0.032029] Net:   eth1: ethernet@428a0000 [PRIME]
[1.077589 0.019469] Fastboot: Normal
[1.077655 0.000067] Normal Boot
[1.077740 0.000085] Hit any key to stop autoboot:  0 
[1.799542 0.721802] 27759104 bytes read in 591 ms (44.8 MiB/s)
[1.853720 0.054178] 45449 bytes read in 6 ms (7.2 MiB/s)
[1.854125 0.000406] ## Flattened Device Tree blob at 83000000
[1.854316 0.000191]    Booting using the fdt blob at 0x83000000
[1.854614 0.000298] Working FDT set to 83000000
[1.854710 0.000096]    Using Device Tree in place at 0000000083000000, end 000000008300e188
[1.855242 0.000532] Working FDT set to 83000000
[1.855385 0.000143] 
[1.855424 0.000039] Starting kernel ...
[1.855674 0.000250] 
[2.047194 0.191519] [    0.109473] Error: Driver 'mxsfb' is already registered, aborting...
[2.047676 0.000482] [    0.122578] of_reserved_mem_lookup() returned NULL
[2.127196 0.079520] [    0.217490] imx93-ldb soc@0:ldb@4ac10020: Failed to create device link (0x180) with soc@0:phy@4ac10024
[5.869868 3.742672] 
[5.870280 0.000411] NXP i.MX Release Distro 6.1-mickledore desk-mx93-rev1 ttyLP0
[5.871666 0.001386] 
[5.871694 0.000028] desk-mx93-rev1 login: 

It is worth to pointout:

  • SPL start at 0.36s after reset
[0.364770 0.364769] U-Boot SPL 2023.04-desk-mx9-l-5.1.0 (Apr 05 2024 - 13:58:53 +0000)
  • U-Boot loads the kernel after 1s
[1.077740 0.000085] Hit any key to stop autoboot:  0 
  • kernel read from eMMC took 0.6s
[1.799542 0.721802] 27759104 bytes read in 591 ms (44.8 MiB/s)
  • kernel starts after 1.8s
[1.855424 0.000039] Starting kernel ...
  • login prompt (systems completely active) after roughly total of 6s
[5.871694 0.000028] desk-mx93-rev1 login: 

Implementing the #Falcon mode may reduce 1-1.5s the boot time so less then 5s can be achieved

rfs footprint

The root file system used in this AN - even if built as a minimal image - has as many packages as needed by a standard embedded application:

  • file system usage: roughly 325MB
root@desk-mx93-rev1:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root              7416728    328708   6689848   5% /
devtmpfs                751264         0    751264   0% /dev
tmpfs                  1014880         0   1014880   0% /dev/shm
tmpfs                   405956      8952    397004   2% /run
tmpfs                     4096         0      4096   0% /sys/fs/cgroup
tmpfs                  1014884         0   1014884   0% /tmp
tmpfs                  1014880        12   1014868   0% /var/volatile
tmpfs                   202976         0    202976   0% /run/user/0
root@desk-mx93-rev1:~#
  • apt-get (package manager)
root@desk-mx93-rev1:~# apt-get
apt 2.4.5 ()
  • python3
root@desk-mx93-rev1:~# python3 --version
Python 3.11.5
  • wireless tools: iw, rfkill
Link to the wiki version

Conclusions

Diese Application Note zeigt, dass sich die Boot‑Zeit deutlich verkürzen lässt, wenn jede Phase des Startvorgangs gezielt optimiert wird. Durch das Anpassen der U‑Boot‑Parameter, das Reduzieren der Konsolenausgabe, die Auswahl schnellerer Speichermedien und die Verringerung des Root‑Dateisystem‑Footprints wird die Systeminitialisierung schneller und zuverlässiger. Mit diesen Optimierungen können Entwickler, die mit Plattformen von DAVE Embedded Systems arbeiten, die Systemreaktionszeit verbessern und anspruchsvolle Leistungsanforderungen in Embedded‑Anwendungen erfüllen.

Download

Informationsanfrage

Willkommen auf dem Portal zum Einreichen des technischen Informationsformulars von DAVE Embedded Systems!
Bitte füllen Sie die Felder unten aus. Das Support-Team kümmert sich in maximal 24 Stunden um Sie!