Boot Options

SBL supports boot options configuration for different boot targets. This feature is designed to provide flexibility and configurability, including:

  • Partition layout options (RAW, MBR, or GPT)
  • File system support (FAT and Ext2/3)
  • Multiple boot devices (eMMC, UFS, NVMe, SATA, USB, SPI flash etc)
  • Redundant and fallback options

Boot option flow is shown in the following flow chart:

digraph bootoption {
   bgcolor="transparent";
     compound=true;
     node [fontsize=10, shape=rectangle];
     edge [fontsize=10];

     subgraph cluster_stages {
       label="Boot Option Processing Flow"; fontsize=11;
       style="filled,rounded"; color="#F0F0F0";

       "PayloadMain()" -> "Enter Shell if Requested"
       "Enter Shell if Requested" -> "Boot OS Image From \nCurrent Option Entry"
       "Boot OS Image From \nCurrent Option Entry" -> "Start Booting" [ label = "Okay" ]
       "Boot OS Image From \nCurrent Option Entry" -> "PayloadMain()" [ label = "Failed" ]

     }
}

A boot option entry contains the following data structure to boot OS (OsBootOptionGuid.h):

typedef struct {
  ///
  /// For PCI device, its value is 0x00BBDDFF
  /// For other device, its value is MMIO address (The highest bytes is not zero).
  ///
  UINT32               DevAddr;

  ///
  /// Image type for Image[0]. Refer BOOT_IMAGE_TYPE
  ///
  UINT8                ImageType;

  ///
  /// Zero means normal boot.
  ///
  UINT8                BootFlags;

  UINT8                Reserved[2];

  ///
  /// Boot medium type, Refer OS_BOOT_MEDIUM_TYPE
  ///
  UINT8                DevType;

  ///
  /// Zero-based hardware partition number
  ///
  UINT8                HwPart;

  ///
  /// Zero-based software partition number for boot image
  /// Used for file system only.
  ///
  UINT8                SwPart;

  ///
  /// For File system support only, Refer OS_FILE_SYSTEM_TYPE
  ///
  UINT8                FsType;

  // Image[0] is for normal boot OS
  // Image[1] is for trusty OS
  // Image[2] is for misc image
  // Image[3-6] is for extra Images
  BOOT_IMAGE           Image[7];
} OS_BOOT_OPTION;

Depending on booting scenarios, a list of boot options can be customized at prebuild time or post build time (See Change Boot Options).