Skip to content

EDK Boot Loader (EBL) WiKi

Laurie Jarlstrom edited this page Nov 21, 2016 · 1 revision

The EDK Boot Loader (EBL) is a small EFI application that produces a small command line shell.

EBL Devices

The EBL supports the following device types for use with any of its commands: Filesystem, Firmware Volume, Block IO, Load File, Memory Buffer, and TFTP. A device name has the following form:
<device></device><device></device>:<device></device>

<device></device> is the prefix for the command. The command is matched via a case insensitive check for the smallest number of leading characters to make sure the device name is unique. Example: fs for a file system.
<device></device> is a decimal number the differentiates between multiple devices of the same type. The number is usually associated with the order in which the devices are discovered from the protocol database. The device number is not needed for the Memory Buffer form and can be omitted.
<device></device> varies by device type .
EBL Device Types

Type Syntax Device Specific Info
Filesystem fs0: \Dir\FileName
Block IO blk0: [starting]:[number]
Load File l0: None
Firmware Volume fv1: FileName or GUID
Memory Buffer a:0:20 Address_In_Hex:Byte_Size_In_Hex
TFTP 10.0.0.1:FileName FileName for TFTP


Filesystem (fs)
A Filesystem device represents an UEFI Simple File System Protocol API. The device number is zero based and represents the location of the protocol API in the handle database. The EBL does not contain file system support and depends on the platform to contain an UEFI driver that produces the Simple File System Protocol. A UEFI system can create a Simple File System Protocol for any block device that contains a FAT12, FAT16, or FAT32 file system. It is possible to have more than one Simple File System Protocol driver in the system, as it is legal to use the Simple File System protocol to abstract other file system types. When issuing filesystem commands it is legal to use "fs" or the Volume name of the device. The device specific portion of this device is a Simple File System compatible file name that is a NULL terminated string of the file to be opened, that can also contain "\", ".". and ".." path modifiers.

Block IO (blk)
A Block IO device represents an UEFI Block IO protocol API. The device number is zero based and represents the location of the protocol API in the handle database. The EBL does not contain Block IO support and depends on the platform to contain an UEFI drivers that produces the block IO protocol. A UEFI system caries a logical Block IO driver that creates logical Block IO protocol instances for GUID Partition Table (GPT), MBR, and El Torito (CD-ROM) on top of the Block IO protocol that abstracts a hardware device, such as a disk. The device specific part for a Block IO device is optional and it is the Logical Block Address (LBA) in the form of a hexadecimal number followed by a semi-colon and a hexadecimal number representing the number of blocks. If no device specific information is present the entire block device is implied.

Load File (load)
A Load File device represents an UEFI Load File Protocol API. The device number is zero based and represents the location of the protocol API in the handle database. A Load File protocol is used to boot from devices that are not capable of being modeled as a file system. The most common example of a Load File protocol is a PXE based network boot. In the network boot process an EFI client handshakes with a server and the service returns a boot image based on information sent by the client. The Load file device does not support device specific extensions.
TFTP (IPv4 address)
A TFTP device represents an IPv4 IP address and the device specific extension if the filename on the server that is the target of the TFTP read or write.

Firmware Volume (fv)
A Firmware Volume represents an UEFI PI Firmware Volume protocol API. The device number is zero based and represents the location of the protocol API in the handle database. Firmware Volumes (FVs) are described in the UEFI PI specification and they contain UEFI and PI drivers that can be discovered and dispatched. The EBL for example is a file in an FV. FVs are simple NVRAM file system, that are commonly read only. The file system does not support directories and the file names are GUIDs. Each file can have any number of nested sections or encapsulated sections. The device specific portion of a Firmware Volume device can optionally be the name of a file in the FV. The name can be in the form of a GUID or it can match the name of the UI Section associated with that file, if it exists.
Memory Buffer (a)
An a: followed by a hexadecimal memory address, then another : and a hexadecimal size of the memory buffer. This enables any command that works on a device to also work on a memory buffer.

Here is an example of the device types that are visible, via the device command on the Beagle Board:

 BeagleEdk2 >dev
 Firmware Volume Devices:
   fv0: 0x80008208 - 0x80087FC7 : 0x0007FDC0
   fv1: 0x87F47000 - 0x87FC773F : 0x00080740
 File System Devices:
   fs0: SemihostFs:
   fs1: ANDREW'S_SD:
 Block IO Devices:
   blk0: Size = 0x10000000
   blk1: Removable Size = 0x1E0000000
   blk2: fs1: Removable Partition Size = 0x1DFFF8200


Beagle Board Devices

Device Description
fv0: FV copied to memory by Beagle Board mask ROM. Contains reset vector code, SEC, and a compressed copy of fv1:
fv1: Decompressed FV that contains the UEFI and DXE drivers for the BeagleBoard
fs0: File System that represents a JTAG semihosting connection. The file names and paths are part of the system running the debugger.
fs1: FAT file system on an SD Card that has a volume name "ANDREW'S SD".
blk0: Block IO device representing the NAND FLASH
blk1: Block IO device representing the SD Card plugged into the Beagle Board
blk2: Block IO device produced by the partition driver after parsing the MBR on the SD Card. This block device contains the FAT file system fs1:



The following commands are examples of interacting with an Firmware Volume device. The page off command tells the EBL to not prompt the user when the current screen fill up. The default is to prompt so data will not scroll by. You can cd to fv0: and execute a dir command. Fv0: contains the SEC (Code that runs out of reset and a compressed copy of fv1:. The SEC decompressed fv1:, loads and relocates the DxeCore into memory and jumps to it. The DxeCore produces the systems EFI services and dispatches DXE and UEFI drivers. dir fv1: shows the contents of the decompressed firmware volume. hex fv1:\DxeCore 0 20 shows the FV Section header and the start of the PE/COFF image (contents of the section). The PE/COFF image starts with 'MZ' and a lot of the header information not needed by EFI has been zeroed out to make the image compress better. hex fv1:\DxeCore:10 0 20 shows only the contents of PE32 section of the DxeCore file in fv1:, not including its section header. 0x10 is defined as EFI_SECTION_PE32

 BeagleEdk2 >page off
 BeagleEdk2 >cd fv0:
 BeagleEdk2 fv0:\>dir
    19,544     SEC D959E387-7B91-452C-90E0-A1DBAC90DDB8
   103,060      FV 9E21FD93-9C72-4C15-8C4B-E77F1DB2D792
              122,604 bytes in files 401,036 bytes free
 BeagleEdk2 fv0:\>dir fv1:
    51,032 DxeCore D6A2CB7F-6A18-4E2F-B43B-9920A733700A DxeCore
    21,908  Driver B8D9777E-D72A-451F-9BDB-BAFB52A68415 ArmCpuDxe
     4,678  Driver B601F8C4-43B7-4784-95B1-F4226CB40CEE RuntimeDxe
     2,480  Driver F80697E9-7FD6-4665-8646-88E33EF71DFC SecurityStubDxe
     1,788  Driver F099D67F-71AE-4C36-B2A3-DCEB0EB2B7D8 WatchdogTimer
     2,020  Driver 42857F0A-13F2-4B21-8A23-53D3F714B840 CapsuleRuntimeDxe
     6,396  Driver 02B01AD5-7E59-43E8-A6D8-238180613A5A EmuVariableRuntimeDxe
     1,378  Driver FCABE6A7-7953-4A84-B7EC-D29E89B62E87 EmbeddedMonotonicCounter
     2,396  Driver 6696936D-3637-467C-87CB-14EA8248948C SimpleTextInOutSerial
     2,076  Driver 16036A73-E8EF-46D0-953C-9B8E96527D13 Reset
     1,260  Driver B336F62D-4135-4A55-AE4E-4971BBF0885D RealTimeClock
     1,834  Driver 4C6E0267-C77D-410D-8100-1495911A989D MetronomeDxe
     3,102  Driver C5B9C74A-6D72-4719-99AB-C59F199091EB SemihostFs
     4,452  Driver 4D00EF14-C4E0-426B-81B7-30A00A14AAD6 NandFlash
     4,364  Driver 100C2CFA-B586-4198-9B4C-1683D195B1DA MMCHS
     1,724  Driver D5125E0F-1226-444F-A218-0085996ED5DA Smbus
     1,402  Driver E7D9CAE1-6930-46E3-BDF9-0027446E7DF2 Gpio
     2,144  Driver 23EED05D-1B93-4A1A-8E1B-931D69E37952 BeagleBoardInterruptDxe
     2,728  Driver 6DDBF08B-CFC9-43CC-9E81-0784BA312CA0 BeagleBoardTimerDxe
     1,490  Driver 71FE861A-5450-48B6-BFB0-B93522616F99 TPS65950
     4,156  Driver 6B38F7B4-AD98-40E9-9093-ACA2B5A253C4 DiskIoDxe
     8,898  Driver 1FA1F39E-FEFF-4AAE-BD7B-38A070A3B609 PartitionDxe
    14,992  Driver 961578FE-B6B7-44C3-AF35-6BC705CD2B1F Fat
     2,686  Driver CD3BAFB6-50FB-4FE8-8E4E-AB74D2C1A600 EnglishDxe
     3,892  Driver FEAA2E2B-53AC-4D5E-AE10-1EFD5DA4A2BA BeagleBoardPciEmulation
    12,056  Driver BDFE430E-8F2A-4DB0-9991-6F856594777E EhciDxe
    11,484  Driver 240612B7-A063-11D4-9A3A-0090273FC14D UsbBusDxe
     8,268  Driver 9FB4B4A7-42C0-4BCD-8540-9BCC6711F83E UsbMassStorageDxe
    43,472     App 3CEF354A-3B7A-4519-AD70-72A134698311 Ebl
     7,246  Driver 934431FE-5745-402E-913D-17B4434EB0F3 BeagleBoardBds
              237,802 bytes in files 846 bytes free
 BeagleEdk2 fv0:\>
 BeagleEdk2 fv0:\>hex fv1:\DxeCore 0 20
 00000000: 44 C7 00 10 4D 5A 00 00 00 00 00 00 00 00 00 00 |D...MZ..........|
 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 BeagleEdk2 fv0:\>hex fv1:\DxeCore:10 0 20
 00000000: 4D 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |MZ..............|
 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 



The fs0: device represents a semihosting connection to the JTAG debugger. It lets you read and write files back to you PC that is running the JTAG debugger. The following example is hex dumping a file from the PC, then coping that file to the SD card on the Beagle Board, and then hex dumping that copied file from the SD card. The semihosting file system driver does not currently support the dir command, but in practice this is not a big issue as you can look at the files directly on the PC.

 BeagleEdk2 >hex fs0:C:\t.txt
 00000000: 54 68 69 73 20 66 69 6C 65 20 69 73 20 66 72 6F |This file is fro|
 00000010: 6D 20 6D 79 20 50 43 20 72 75 6E 6E 69 6E 67 20 |m my PC running |
 00000020: 74 68 65 20 52 65 61 6C 56 69 65 77 20 44 65 62 |the RealView Deb|
 00000030: 75 67 67 65 72 21 0D 0A                         |ugger!..|
 BeagleEdk2 >cp fs0:C:\t.txt fs1:\t.txt
 BeagleEdk2 >hex fs1:\t.txt
 00000000: 54 68 69 73 20 66 69 6C 65 20 69 73 20 66 72 6F |This file is fro|
 00000010: 6D 20 6D 79 20 50 43 20 72 75 6E 6E 69 6E 67 20 |m my PC running |
 00000020: 74 68 65 20 52 65 61 6C 56 69 65 77 20 44 65 62 |the RealView Deb|
 00000030: 75 67 67 65 72 21 0D 0A                         |ugger!..|



The blk1: device represents the Raw SD Card, and LBA zero is the Master Boot Record (MBR). The blk2: device is the partition that contains the FAT file system, and LBA zero of this device represents the BIOS Parameter Block (BPB) of the FAT filesystem . The blk1: example shows how you can use the extended device information for a block device to make the file act like a subset of the blocks on a disk. The blk2: example shows how you can operate on the entire block device with a command that allows you to specify what part of the device you would like to operate on.

 BeagleEdk2 >hex blk1:0:200 
 00000000: 33 C0 8E D0 BC 00 7C FB 50 07 50 1F FC BE 1B 7C |3.....|.P.P....||
 00000010: BF 1B 06 50 57 B9 E5 01 F3 A4 CB BD BE 07 B1 04 |...PW...........|
 00000020: 38 6E 00 7C 09 75 13 83 C5 10 E2 F4 CD 18 8B F5 |8n.|.u..........|
 00000030: 83 C6 10 49 74 19 38 2C 74 F6 A0 B5 07 B4 07 8B |...It.8,t.......|
 00000040: F0 AC 3C 00 74 FC BB 07 00 B4 0E CD 10 EB F2 88 |..<.t...........|
 00000050: 4E 10 E8 46 00 73 2A FE 46 10 80 7E 04 0B 74 0B |N..F.s*.F..~..t.|
 00000060: 80 7E 04 0C 74 05 A0 B6 07 75 D2 80 46 02 06 83 |.~..t....u..F...|
 00000070: 46 08 06 83 56 0A 00 E8 21 00 73 05 A0 B6 07 EB |F...V...!.s.....|
 00000080: BC 81 3E FE 7D 55 AA 74 0B 80 7E 10 00 74 C8 A0 |..>.}U.t..~..t..|
 00000090: B7 07 EB A9 8B FC 1E 57 8B F5 CB BF 05 00 8A 56 |.......W.......V|
 000000A0: 00 B4 08 CD 13 72 23 8A C1 24 3F 98 8A DE 8A FC |.....r#..$?.....|
 000000B0: 43 F7 E3 8B D1 86 D6 B1 06 D2 EE 42 F7 E2 39 56 |C..........B..9V|
 000000C0: 0A 77 23 72 05 39 46 08 73 1C EB 1A 90 BB 00 7C |.w#r.9F.s......||
 000000D0: 8B 4E 02 8B 56 00 CD 13 73 51 4F 74 4E 32 E4 8A |.N..V...sQOtN2..|
 000000E0: 56 00 CD 13 EB E4 8A 56 00 60 BB AA 55 B4 41 CD |V......V.`..U.A.|
 000000F0: 13 72 36 81 FB 55 AA 75 30 F6 C1 01 74 2B 61 60 |.r6..U.u0...t+a`|
 00000100: 6A 00 6A 00 FF 76 0A FF 76 08 6A 00 68 00 7C 6A |j.j..v..v.j.h.|j|
 00000110: 01 6A 10 B4 42 8B F4 CD 13 61 61 73 0E 4F 74 0B |.j..B....aas.Ot.|
 00000120: 32 E4 8A 56 00 CD 13 EB D6 61 F9 C3 49 6E 76 61 |2..V.....a..Inva|
 00000130: 6C 69 64 20 70 61 72 74 69 74 69 6F 6E 20 74 61 |lid partition ta|
 00000140: 62 6C 65 00 45 72 72 6F 72 20 6C 6F 61 64 69 6E |ble.Error loadin|
 00000150: 67 20 6F 70 65 72 61 74 69 6E 67 20 73 79 73 74 |g operating syst|
 00000160: 65 6D 00 4D 69 73 73 69 6E 67 20 6F 70 65 72 61 |em.Missing opera|
 00000170: 74 69 6E 67 20 73 79 73 74 65 6D 00 00 00 00 00 |ting system.....|
 00000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 00000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 000001A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 000001B0: 00 00 00 00 00 00 00 00 B5 81 2F 52 00 00 80 01 |........../R....|
 000001C0: 01 00 0C FE FF D2 3F 00 00 00 C1 FF EF 00 00 00 |......?.........|
 000001D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 000001E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 000001F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA |..............U.|
 BeagleEdk2 >hex blk2: 0 200
 00000000: EB 58 90 4D 53 44 4F 53 35 2E 30 00 02 08 24 00 |.X.MSDOS5.0...$.|
 00000010: 02 00 00 00 00 F8 00 00 3F 00 FF 00 3F 00 00 00 |........?...?...|
 00000020: C1 FF EF 00 E2 3B 00 00 00 00 00 00 02 00 00 00 |.....;..........|
 00000030: 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 00000040: 80 00 29 5F D0 36 50 4E 4F 20 4E 41 4D 45 20 20 |..)_.6PNO NAME  |
 00000050: 20 20 46 41 54 33 32 20 20 20 33 C9 8E D1 BC F4 |  FAT32   3.....|
 00000060: 7B 8E C1 8E D9 BD 00 7C 88 4E 02 8A 56 40 B4 08 |{......|.N..V@..|
 00000070: CD 13 73 05 B9 FF FF 8A F1 66 0F B6 C6 40 66 0F |..s......f...@f.|
 00000080: B6 D1 80 E2 3F F7 E2 86 CD C0 ED 06 41 66 0F B7 |....?.......Af..|
 00000090: C9 66 F7 E1 66 89 46 F8 83 7E 16 00 75 38 83 7E |.f..f.F..~..u8.~|
 000000A0: 2A 00 77 32 66 8B 46 1C 66 83 C0 0C BB 00 80 B9 |*.w2f.F.f.......|
 000000B0: 01 00 E8 2B 00 E9 48 03 A0 FA 7D B4 7D 8B F0 AC |...+..H...}.}...|
 000000C0: 84 C0 74 17 3C FF 74 09 B4 0E BB 07 00 CD 10 EB |..t.<.t.........|
 000000D0: EE A0 FB 7D EB E5 A0 F9 7D EB E0 98 CD 16 CD 19 |...}....}.......|
 000000E0: 66 60 66 3B 46 F8 0F 82 4A 00 66 6A 00 66 50 06 |f`f;F...J.fj.fP.|
 000000F0: 53 66 68 10 00 01 00 80 7E 02 00 0F 85 20 00 B4 |Sfh.....~.... ..|
 00000100: 41 BB AA 55 8A 56 40 CD 13 0F 82 1C 00 81 FB 55 |A..U.V@........U|
 00000110: AA 0F 85 14 00 F6 C1 01 0F 84 0D 00 FE 46 02 B4 |.............F..|
 00000120: 42 8A 56 40 8B F4 CD 13 B0 F9 66 58 66 58 66 58 |B.V@......fXfXfX|
 00000130: 66 58 EB 2A 66 33 D2 66 0F B7 4E 18 66 F7 F1 FE |fX.*f3.f..N.f...|
 00000140: C2 8A CA 66 8B D0 66 C1 EA 10 F7 76 1A 86 D6 8A |...f..f....v....|
 00000150: 56 40 8A E8 C0 E4 06 0A CC B8 01 02 CD 13 66 61 |V@............fa|
 00000160: 0F 82 54 FF 81 C3 00 02 66 40 49 0F 85 71 FF C3 |..T.....f@I..q..|
 00000170: 4E 54 4C 44 52 20 20 20 20 20 20 00 00 00 00 00 |NTLDR      .....|
 00000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 00000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
 000001A0: 00 00 00 00 00 00 00 00 00 00 00 00 0D 0A 52 65 |..............Re|
 000001B0: 6D 6F 76 65 20 64 69 73 6B 73 20 6F 72 20 6F 74 |move disks or ot|
 000001C0: 68 65 72 20 6D 65 64 69 61 2E FF 0D 0A 44 69 73 |her media....Dis|
 000001D0: 6B 20 65 72 72 6F 72 FF 0D 0A 50 72 65 73 73 20 |k error...Press |
 000001E0: 61 6E 79 20 6B 65 79 20 74 6F 20 72 65 73 74 61 |any key to resta|
 000001F0: 72 74 0D 0A 00 00 00 00 00 AC CB D8 00 00 55 AA |rt............U.|



The address device type is powerful as it lets you use an arbitrary chunk of memory in any command that operates on devices. In the follow example the hex command is used to dump the first 0x40 bytes of the FV via the fv0: device, and the same result is possible by using an address device that points to the memory buffer. The hex.4 example shows how you can use the dot syntax to modify the width of a command. The default width for hex is one byte, and by putting hex.4 the with is changed to four bytes.

 BeagleEdk2 >dev
 Firmware Volume Devices:
   fv0: 0x80008208 - 0x80087FC7 : 0x0007FDC0
   fv1: 0x87F47000 - 0x87FC783F : 0x00080840
 File System Devices:
   fs0: SemihostFs:
   fs1: ANDREW'S_SD:
 Block IO Devices:
   blk0: Size = 0x10000000
   blk1: Removable Size = 0x1E0000000
   blk2: fs1: Removable Partition Size = 0x1DFFF8200
 BeagleEdk2 >hex fv0: 0 40
 00000000: 37 01 00 EA 00 00 00 00 7E F0 B0 E1 00 00 00 00 |7.......~.......|
 00000010: 78 E5 8C 8C 3D 8A 1C 4F 99 35 89 61 85 C3 2D D3 |x...=..O.5.a..-.|
 00000020: C0 FD 07 00 00 00 00 00 5F 46 56 48 FF FE 03 00 |........_FVH....|
 00000030: 48 00 6D 1B 00 00 00 02 F7 1F 00 00 40 00 00 00 |H.m.........@...|
 BeagleEdk2 >hex a:80008208:40
 80008208: 37 01 00 EA 00 00 00 00 7E F0 B0 E1 00 00 00 00 |7.......~.......|
 80008218: 78 E5 8C 8C 3D 8A 1C 4F 99 35 89 61 85 C3 2D D3 |x...=..O.5.a..-.|
 80008228: C0 FD 07 00 00 00 00 00 5F 46 56 48 FF FE 03 00 |........_FVH....|
 80008238: 48 00 6D 1B 00 00 00 02 F7 1F 00 00 40 00 00 00 |H.m.........@...|
 BeagleEdk2 >hex.4 a:80008208:40
 80008208: EA000137 00000000 E1B0F07E 00000000 |7.......~.......|
 80008218: 8C8CE578 4F1C8A3D 61893599 D32DC385 |x...=..O.5.a..-.|
 80008228: 0007FDC0 00000000 4856465F 0003FEFF |........_FVH....|
 80008238: 1B6D0048 02000000 00001FF7 00000040 |H.m.........@...|
Clone this wiki locally