Skip to content

U Boot Configuration Guide

Vincent Stehlé edited this page Jun 17, 2024 · 12 revisions

Note

This page is obsolete and kept for convenience.

This page documents how to enable the SystemReady IR requirements on a U-Boot based system.

This guide assumes the platform is already running a recent version of TF-A and U-Boot.

Details on this page may be out of date. If you are working on SystemReady IR compliance, Arm has published a SystemReady IR guide at the following link

https://developer.arm.com/documentation/ARMDUI1101/latest/

Update to U-Boot v2021.04 or newer

EBBR requires a UEFI implementation. U-Boot support for UEFI is under active development and only recent versions of U-Boot have sufficiently mature implementations of the UEFI ABI.

Enable EFI Configuration Options

Make sure the following config options are enabled in the U-Boot .config or .defconfig Core UEFI features

CONFIG_BOOTM_EFI=y                         # enable bootm command to launch FIT image with UEFI binary
CONFIG_CMD_BOOTEFI=y                       # command bootefi to lauch UEFI binaries
CONFIG_CMD_NVEDIT_EFI=y                    # commands to display and edit UEFI variables
CONFIG_HEXDUMP=y                           # required for display of UEFI variable content; CONFIG_SPL_HEXDUMP is not needed
CONFIG_CMD_EFIDEBUG=y                      # command to edit boot options
CONFIG_CMD_GPT=y                           # command to display and alter GUID partition table
CONFIG_EFI_PARTITION=y                     # partition table support
CONFIG_EFI_LOADER=y                        # enable UEFI sub-system
CONFIG_EFI_DEVICE_PATH_TO_TEXT=y           # provide EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2=y   # provide FI_UNICODE_COLLATION_PROTOCOL2
CONFIG_EFI_UNICODE_CAPITALIZATION=y        # support lower/upper conversion for non-ANSI characters
CONFIG_EFI_HAVE_RUNTIME_RESET=y            # enable reset runtime service at runtime
CONFIG_CMD_EFI_VARIABLE_FILE_STORE=Y       # store UEFI variables in file, if OP-TEE StandAloneMM is available choose EFI_MM_COMM_TEE instead
CONFIG_EFI_SECURE_BOOT=y                   # enable secure boot

Enable RTC support

CONFIG_DM_RTC=y                             # Enable RTC support using the driver model
CONFIG_EFI_GET_TIME=y                       # Enable the GetTime() runtime service
CONFIG_EFI_SET_TIME=y                       # Enable the SetTime() runtime service
CONFIG_RTC_EMULATION=y                      # If the board has no hardware RTC, you can emulate one and use NTP for setting it.

Enable UpdateCapsule

CONFIG_CMD_DFU=y
CONFIG_FLASH_CFI_MTD=y
CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT=y
CONFIG_EFI_CAPSULE_FIRMWARE=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
CONFIG_EFI_CAPSULE_FMP_HEADER=y

Firmware images must be provided as a capsule image. Use the U-Boot mkeficapsule utility to create a suitable image: ./tools/mkeficapsule --raw flash.bin --index 1 capsule1.bin

U-Boot must be able to update itself by applying the capsule image using either the capsule on disk feature, or by using the CapsuleApp.efi utility. By default U-Boot device firmware update (DFU) feature is used by Update Capsule to write images to flash. Setting the dfu_alt_info variable to tell U-Boot where to write the firmware image as described in the DFU Documentation

fatwrite mmc <dev>:<part> ${loadaddr} /EFI/UpdateCapsule/capsule1.bin 0x${filesize}setenv -e -nv -bs -rt -v OsIndications = 0x04efidebug capsule disk-update

(Because CapsuleApp.efi has not been fully verified yet, capsules can also be applied using the U-Boot efidebug command)

efidebug capsule update -v ${loadaddr}

Useful debug options

U-Boot has some UEFI test applications included in the source tree. It is useful to enable them for testing purposes.

CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y
CONFIG_CMD_BOOTEFI_HELLO=y
CONFIG_CMD_BOOTEFI_SELFTEST=y

With those configuration options enabled, the tests can be run from the U-Boot command prompt:

=> bootefi hello
=> bootefi selftest

Some of the unit tests have to be chosen manually. A list of all available tests can be displayed with:

=> setenv efi_selftest list
=> bootefi selftest

A single test can be selected by setting environment variable efi_selftest:

=> setenv efi_selftest block image transfer
=> bootefi selftest
Clone this wiki locally