Measuring boot Time in U-Boot and EDK2/UEFI

  • The first step when optimizing boot time is to accurately measure it. Both u-boot and EDK II provide tools to achive this.

    Note: These steps were performed on an armstoneMX8MP running F&S u-boot 2020.04-fsimx8mp-Y2023.03, F&S UEFI based on NXPs i.MX Windows 10 IoT v1.5.0 release

    Measuring boot time in U-Boot

    A simple way to measure boot time in U-Boot is by using BOOTSTAGE mechanism.

    To enable it, U-Boot needs to be built with BOOTSTAGE enabled.

    When building enable these options:

    Code: .config
    1. BOOTSTAGE=y
    4. # To get BOOTSTAGE information from SPL and TPL:
    8. # pick a free memory address, where BOOTSTAGE_STASH can be placed:
    9. BOOTSTAGE_STASH_ADDR=0x65500000

    Flash BOOSTAGE-enabled u-boot to the board and reboot/reset.

    To see the BOOSTAGE-report enter u-boot command prompt. Type

    bootstage report and hit enter.

    You should be presented with a report like this one:

    Tip: utilise fakegocmd to automatically output the bootstage report

    1. In the u-boot prompt enter editenv fakegocmd
    2. add ; bootstage report to the end of the line
    3. hit enter to apply
    4. enter saveenv to save your changes

    For further information refer to the U-Boot TRACE documentation.

    Measuring boot time in EDK II/UEFI

    EDK II provides some mechanisms to measure and read out boot time

    To enable Performance Recording, add or change theses PCDs in the .dsc file of your platform:

    Code: armstoneMX8MP.dsc
    1. gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x01
    2. gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|0x01
    3. #Enable DpApp to visualize UEFI Performance
    4. ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf
    5. #Enable ReportStatusCodeRouterRuntimeDxe & FirmwarePerformanceDxe for UEFI Performance reporting
    6. MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
    7. MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf

    DpApp, ReportStatusCodeRouterRuntimeDxe and FirmwarePerformanceDxe also need to be included in your platforms .fdf file.

    Code: armstoneMX8MP.fdf
    1. #Enable ReportStatusCodeRouterRuntimeDxe & FirmwarePerformanceDxe for UEFI Performance reporting
    2. INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
    3. INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf
    4. # DP shell command Support
    5. #Enable DpApp to visualize UEFI Performance
    6. INF ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf

    Rebuild and flash EDK II to your board.

    The simplest way to view the Performance Record is to boot into UEFI-Shell and entering the command dp to get a report like this one:

    For more information refer to the official EDK II "Performance Infrastructure" wiki entry.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.