O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Harnessing the UEFI Shell

Book Description

Focusing on the use of the UEFI Shell and its recently released formal specification, this book unlocks a wide range of usage models which can help people best utilize the shell solutions. This text also expands on the obvious intended utilization of the shell and explains how it can be used in various areas such as security, networking, configuration, and other anticipated uses such as manufacturing, diagnostics, etc. Among other topics, Harnessing the UEFI Shell demonstrates how to write Shell scripts, how to write a Shell application, how to use provisioning options and more. Since the Shell is also a UEFI component, the book will make clear how the two things interoperate and how both Shell developers as well as UEFI developers can dip into the other's field to further expand the power of their solutions.

Harnessing the UEFI Shell is authored by the three chairs of the UEFI working sub-teams, Michael Rothman (Intel, chair of the UEFI Configuration and UEFI Shell sub-teams), Vincent Zimmer (Intel, chair of the UEFI networking sub-team and security sub-team), and Tim Lewis (Insyde Software, chair of the UEFI security sub-team). This book is perfect for any OEMs that ship UEFI-based solutions (which is all of the MNCs such as IBM, Dell, HP, Apple, etc.), software developers who are focused on delivering solutions targeted to manufacturing, diagnostics, hobbyists, or stand-alone kiosk environments.

Table of Contents

  1. Cover
  2. Title Page
  3. Copyright
  4. Preface
  5. Contents
  6. Chapter 1 Introduction
    1. What is UEFI?
    2. What Do We Mean by Shell?
    3. A Short History of the UEFI Shell
    4. Brief Overview of the UEFI Shell
    5. UEFI Shell APIs
    6. Command Line Interface Features
    7. Why a Shell at all?
  7. Chapter 2 Under the UEFI Shell
    1. Shell and UEFI
    2. Evolution and Revolution
  8. Chapter 3 What Is the UEFI Shell?
    1. What Is Contained in the UEFI Shell?
    2. What Kind of Shell Do You Have?
    3. What!? No Shell? No Problem!
    4. Programmatic Shell Environment
    5. Using UEFI Shell Commands
    6. Interactive Shell Environment
    7. Scripting
    8. Program Launch
    9. File-System Abstractions
    10. Shell Script Resolves into a UEFI Firmware Action
  9. Chapter 4 Why We Need an Execution Environment before the OS
    1. Evolution of a Machine
    2. The Platform Initialization Flow
    3. UEFI Transitions
    4. States of a Platform
    5. Readiness of UEFI
    6. Migration Using the UEFI Shell
    7. Going Forward
  10. Chapter 5 Manufacturing
    1. Throughput
    2. Manufacturing Test Tools
    3. Hardware Access with Manufacturing Tools
    4. Converting Manufacturing Tools
    5. Conclusion
  11. Chapter 6 Bare Metal Provisionig
    1. Provisioning with the UEFI Shell
    2. UEFI Networking Stack
    3. Securing the Network
    4. Speeding Up the Network
    5. Example of Putting It Together
    6. Summary
  12. Chapter 7 Configuration of Provisioned Material
    1. Initialization Timeline
    2. Configuration Infrastructure Overview
    3. Using the Configuration Infrastructure
    4. Driver Model Interactions
    5. Provisioning the Platform
    6. Configuring through the UEFI Shell
    7. Basic Configuration
    8. Advanced Configuration Abilities
  13. Chapter 8 The Use of UEFI for Diagnostics
    1. Types of Diagnostics
    2. SMBIOS Table Organization
    3. SMBIOS Structure Table Entry Point
    4. Table Organization Graph
    5. Structure Standards
    6. Structure Evolution and Usage Guidelines
    7. Text Strings
    8. Required Structures and Data
    9. Features
    10. User Interface Design
    11. Design Guide
    12. Usage
    13. Examples
    14. Architecture Design
    15. Data Structure
    16. SMBIOS_STRUCTURE_TABLE
    17. SMBIOS_HEADER
    18. SMBIOS_STRUCTURE_POINTER
    19. STRUCTURE_STATISTICS
    20. Source Code for the Utility
    21. Summary
  14. Chapter 9 UEFI Shell Scripting
    1. Hello, World!
    2. Echo
    3. Echo All Parameters
    4. Echo All Parameters (Improved Version)
    5. Concatenate Text Files
    6. List Only Selected “ls” Information
    7. Install Script
    8. How to Make a Shell Script Appear as a Boot Option
  15. Chapter 10 UEFI Shell Programming
    1. A Simple UEFI Shell Application: HelloWorld
    2. The Source File: HelloWorld.c
    3. The Component Information (.inf) File
    4. A Simple Standard Application: HelloWorld2
    5. The Source File: HelloWorld2.c
    6. The Component Information (.inf) File: HelloWorld2.inf
    7. Read Keyboard Input in UEFI Shell Scripts: GetKey
    8. The Source File: GetKey.c
    9. The Component Information (.inf) File: GetKey.inf
    10. The Build Description (.dsc) File
    11. Calculate Math Expressions: Math
    12. The Source File: Math.c
    13. The Component Information (.inf) File: Math.inf
    14. Convert ASCII to Unicode and Back: UniCodeDecode
    15. The Source File: UniCodeDecode.c
    16. The Component Information (.inf) File
  16. Chapter 11 Managing UEFI Drivers Using the Shell
    1. Testing Specific Protocols
    2. Loading and Unloading UEFI Drivers
    3. Load
    4. LoadPciRom
    5. Unload
    6. Connecting UEFI Drivers
    7. Connect
    8. Disconnect
    9. Reconnect
    10. Driver and Device Information
    11. Drivers
    12. Devices
    13. DevTree
    14. Dh –d
    15. OpenInfo
    16. Testing the Driver Configuration and Driver Diagnostics Protocols
    17. DrvCfg
    18. DrvDiag
    19. Debugging Code Statements
    20. POST Codes
    21. Post Card Debug
    22. Text-Mode VGA Frame Buffer
    23. Other Options
  17. Appendix A Security Considerations
    1. UEFI Shell Binary Integrity
    2. Overview
    3. Signed Executable Overview
    4. Digital Signature
    5. Signed Executable Processing
    6. Signed Executable Generation Application (SignTool)
    7. UEFI Load Image
    8. SignTool
    9. Build Environment
    10. Example usage
  18. Appendix B Command Reference
    1. Command Profiles and Support Levels
    2. Command List
    3. Standardizing Command Output
    4. Command Details
    5. alias
    6. attrib
    7. bcfg
    8. cd
    9. cls
    10. comp
    11. connect
    12. cp/copy
    13. date
    14. dblk
    15. del
    16. devices
    17. devtree
    18. dh
    19. dir/ls
    20. disconnect
    21. dmem
    22. dmpstore
    23. drivers
    24. drvcfg
    25. drvdiag
    26. echo
    27. edit
    28. eficompress
    29. efidecompress
    30. exit
    31. for
    32. getmtc
    33. goto
    34. help
    35. hexedit
    36. if
    37. ifconfig
    38. ifconfig6
    39. load
    40. loadpcirom
    41. ls
    42. map
    43. md
    44. mem
    45. memmap
    46. mkdir
    47. mm
    48. mode
    49. mv
    50. openinfo
    51. parse
    52. pause
    53. pci
    54. ping
    55. ping6
    56. reconnect
    57. reset
    58. rm
    59. sermode
    60. set
    61. setsize
    62. setvar
    63. shift
    64. smbiosview
    65. stall
    66. time
    67. time
    68. touch
    69. type
    70. unload
    71. ver
    72. vol
  19. Appendix C Programming Reference
    1. Script-based Programming
    2. Parameter Passing
    3. Redirection and Piping
    4. Return Codes
    5. Environment Variables
    6. Non-Script-based Programming
    7. Shell Protocol
    8. Shell Parameters Protocol
  20. Appendix D UEFI Shell Library
    1. Functions
    2. File I/O Functions
    3. Miscellaneous Functions
    4. Command Line Parsing
    5. Text I/O
    6. String Functions
    7. ShellCloseFile()
    8. ShellCloseFileMetaArg()
    9. ShellCommandLineCheckDuplicate()
    10. ShellCommandLineFreeVarList()
    11. ShellCommandLineGetCount()
    12. ShellCommandLineGetFlag()
    13. ShellCommandLineGetValue()
    14. ShellCommandLineGetRawValue()
    15. ShellCommandLineParseEx()
    16. ShellCopySearchAndReplace()
    17. ShellConvertStringToUint64()
    18. ShellCreateDirectory()
    19. ShellDeleteFile()
    20. ShellDeleteFileByName()
    21. ShellExecute()
    22. ShellFileExists()
    23. ShellFileHandleReturnLine()
    24. ShellFileHandleReadLine()
    25. ShellFindFilePath()
    26. ShellFindFilePathEx()
    27. ShellFindFirstFile()
    28. ShellFindNextFile()
    29. ShellFlushFile()
    30. SHELL_FREE_NON_NULL()
    31. ShellGetCurrentDir()
    32. ShellGetEnvironmentVariable()
    33. ShellGetExecutionBreakFlag()
    34. ShellGetFileInfo()
    35. ShellGetFilePosition()
    36. ShellGetFileSize()
    37. ShellHexStrToUintn()
    38. ShellInitialize()
    39. ShellIsDecimalDigitCharacter()
    40. ShellIsDirectory()
    41. ShellIsFile()
    42. ShellIsFileInPath()
    43. ShellIsHexaDecimalDigitCharacter()
    44. ShellIsHexOrDecimalNumber()
    45. ShellOpenFileByDevicePath()
    46. ShellOpenFileByName()
    47. ShellOpenFileMetaArg()
    48. ShellPrintEx()
    49. ShellPrintHelp()
    50. ShellPrintHiiEx()
    51. ShellPromptForResponse()
    52. ShellPromptForResponseHii()
    53. ShellReadFile()
    54. ShellSetFileInfo()
    55. ShellSetFilePosition()
    56. ShellSetEnvironmentVariable()
    57. ShellSetPageBreakMode()
    58. ShellStrToUintn()
    59. ShellWriteFile()
    60. StrnCatGrow()
    61. Data Structures
    62. Format Strings
    63. Shell Parameters
  21. Index