UEFI Shell Specification
Total Page:16
File Type:pdf, Size:1020Kb
UEFI Shell Specification January 26, 2016 Revision 2.2 The material contained herein is not a license, either expressly or impliedly, to any intellectual property owned or controlled by any of the authors or developers of this material or to any contribution thereto. The material contained herein is provided on an "AS IS" basis and, to the maximum extent permitted by applicable law, this information is provided AS IS AND WITH ALL FAULTS, and the authors and developers of this material hereby disclaim all other warranties and conditions, either express, implied or statutory, including, but not limited to, any (if any) implied warranties, duties or conditions of merchantability, of fitness for a particular purpose, of accuracy or completeness of responses, of results, of workmanlike effort, of lack of viruses and of lack of negligence, all with regard to this material and any contribution thereto. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." The Unified EFI Forum, Inc. reserves any features or instructions so marked for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT WITH REGARD TO THE SPECIFICATION AND ANY CONTRIBUTION THERETO. IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. Copyright 2008, - 2016 Unified EFI, Inc. All Rights Reserved ii Contents 1 Introduction ...................................................................................................... 1 1.1 Overview ............................................................................................... 1 1.2 Related Information ................................................................................ 1 1.3 Terms ................................................................................................... 1 2 Code Definitions ................................................................................................ 3 2.1 Introduction ........................................................................................... 3 2.2 EFI_SHELL_PROTOCOL ............................................................................ 3 EFI_SHELL_PROTOCOL ............................................................................ 3 EFI_SHELL_PROTOCOL.BatchIsActive() ..................................................... 9 EFI_SHELL_PROTOCOL.CloseFile() .......................................................... 10 EFI_SHELL_PROTOCOL.CreateFile() ........................................................ 11 EFI_SHELL_PROTOCOL.DeleteFile() ........................................................ 13 EFI_SHELL_PROTOCOL.DeleteFileByName() ............................................. 14 EFI_SHELL_PROTOCOL.DisablePageBreak() ............................................. 15 EFI_SHELL_PROTOCOL.EnablePageBreak() .............................................. 16 EFI_SHELL_PROTOCOL.Execute() ........................................................... 17 EFI_SHELL_PROTOCOL.FindFiles() .......................................................... 19 EFI_SHELL_PROTOCOL.FindFilesInDir() ................................................... 20 EFI_SHELL_PROTOCOL.FlushFile() .......................................................... 21 EFI_SHELL_PROTOCOL.FreeFileList() ...................................................... 22 EFI_SHELL_PROTOCOL.GetAlias() ........................................................... 23 EFI_SHELL_PROTOCOL.GetCurDir() ........................................................ 24 EFI_SHELL_PROTOCOL.GetDeviceName() ................................................ 25 EFI_SHELL_PROTOCOL.GetDevicePathFromMap() ..................................... 27 EFI_SHELL_PROTOCOL.GetDevicePathFromFilePath()................................ 28 EFI_SHELL_PROTOCOL.GetEnv() ............................................................ 29 EFI_SHELL_PROTOCOL.GetEnvEx() ......................................................... 30 EFI_SHELL_PROTOCOL.GetFileInfo() ....................................................... 31 EFI_SHELL_PROTOCOL.GetFilePathFromDevicePath()................................ 32 EFI_SHELL_PROTOCOL.GetFilePosition().................................................. 33 EFI_SHELL_PROTOCOL.GetFileSize() ....................................................... 34 EFI_SHELL_PROTOCOL.GetGuidFromName() ........................................... 35 EFI_SHELL_PROTOCOL.GetGuidName() ................................................... 36 EFI_SHELL_PROTOCOL.GetHelpText() ..................................................... 37 EFI_SHELL_PROTOCOL.GetMapFromDevicePath() ..................................... 38 EFI_SHELL_PROTOCOL.GetPageBreak() .................................................. 39 EFI_SHELL_PROTOCOL.IsRootShell() ...................................................... 40 EFI_SHELL_PROTOCOL.OpenFileByName() .............................................. 41 EFI_SHELL_PROTOCOL.OpenFileList() ..................................................... 43 EFI_SHELL_PROTOCOL.OpenRoot() ........................................................ 45 EFI_SHELL_PROTOCOL.OpenRootByHandle() ........................................... 46 EFI_SHELL_PROTOCOL.ReadFile() .......................................................... 47 EFI_SHELL_PROTOCOL.RegisterGuidName() ............................................ 48 EFI_SHELL_PROTOCOL.RemoveDupInFileList() ......................................... 49 EFI_SHELL_PROTOCOL.SetAlias() ........................................................... 50 EFI_SHELL_PROTOCOL.SetCurDir() ........................................................ 52 EFI_SHELL_PROTOCOL.SetEnv() ............................................................ 53 EFI_SHELL_PROTOCOL.SetFileInfo() ....................................................... 54 iii EFI_SHELL_PROTOCOL.SetFilePosition() .................................................. 55 EFI_SHELL_PROTOCOL.SetMap() ............................................................ 56 EFI_SHELL_PROTOCOL.WriteFile() .......................................................... 57 2.3 EFI_SHELL_PARAMETERS_PROTOCOL ..................................................... 58 EFI_SHELL_PARAMETERS_PROTOCOL ..................................................... 58 2.4 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL .......................................... 59 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL .......................................... 59 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.Handler() ........................... 60 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.GetHelp() ........................... 61 3 UEFI Shell Features .......................................................................................... 63 3.1 Levels Of Support ................................................................................. 63 3.2 Invocation ........................................................................................... 64 3.3 Initialization ......................................................................................... 65 3.3.1 ...... Finding startup.nsh .................................................................. 66 3.3.2 ...... Supported Profiles ................................................................... 66 3.3.3 ...... Dynamic Profiles ...................................................................... 67 3.4 Command-Line ..................................................................................... 67 3.4.1 ...... Special Characters ................................................................... 67 3.4.2 ...... Escape Characters ................................................................... 68 3.4.3 ...... Quoting .................................................................................. 68 3.4.4 ...... Redirection ............................................................................. 69 3.4.5 ...... Comments .............................................................................. 72 3.5 Current Directory .................................................................................. 72 3.6 Variables ............................................................................................. 72 3.6.1 ...... Environment Variables ............................................................. 73 3.6.2 ...... Positional Parameters ............................................................... 75 3.6.3 ...... Index Parameters .................................................................... 76 3.6.4 ...... Aliases ................................................................................... 76 3.7 File Names ........................................................................................... 76 3.7.1 ...... Wildcard Expansion .................................................................. 77 3.7.2 ...... Mappings ................................................................................ 77 3.7.3 ...... Consistent