6.UEFI Shell Users’ Guide
来源:互联网 发布:淘宝店铺资质1000元 编辑:程序博客网 时间:2024/05/19 18:46
更多内容参考《EFI Shell Getting Started Guide》
- 1UEFI Shell Overview
- 2EFI Shell Open Source
- 3Analogy to Old DOS: BIOS
- 4Shell Usage
- 5EFI File System
- 6Device Path
- 7Executing UEFI Applications
- 8Execute a UEFI Shell
- 9Wild Card Expansion
- 10Output Redirection
- 11EFI Shell Commands
- 12Internal EFI Shell Commands
- 13External Shell Commands
- 14EFI Shell Commands
- 15Unix-like Shell Commands
- 16Script File Example
- 17Help or ?: Command List in Shell
- 18DH – Dump Handle
UEFI Shell Overview
• Interactive way to use UEFI code in system
• Has command line prompt and Scripting
–Is similar to DOS and Linux* shell but not EXACTLY - its own unique syntax
• Is UEFI executable in itself
• Knows only about UEFI file systems that are FATxx
• Shell is a Sub-project on EFI Development Kit (EDK) on the EFI and Framework Open source Community Website
- Shell programs
- users’ guide
- EFI Shell Source
• EDK has Binary UEFI Shell for processors IA32, Intel® 64, IA-64
EFI Shell Open Source
• WEB Site: http:www.tianocore.org
• Project: EFI-Shell
• Documents & files : “EFI Shell Getting Started Guide”
Analogy to Old DOS: BIOS
Shell Usage
• Execute preboot programs
– Setup
– operating system install
– Test
– disk utilities
– Driver Diagnostics, Configurations
• Move files around between the hard disk, floppy disk, CD-ROM, USB flash devices, and so on
• Load a preboot EFI driver in the system (has an .efi suffix), examples:
– LAN stack tcpip drivers
– Update old drivers in flash
– New drivers for plugin cards
• Shell.efi verses Shell_full.efi
– Shell.efi smaller to fit in Flash
– Shell_full.efi Richer commands
EFI File System
Can manipulate EFI system fatxx partition only where boot loader and EFI application are
Shell> mapDevice mapping tablefs0 : Acpi(PNP0A03,1)/Pci(1F|0)/Pci(2|0)/ Scsi(Pun0,Lun0)/HD(Part1,Sig8983DFE0-F474-01C2-507B-9E5F8078F531) blk0 : Acpi(PNP0A03,0)/Pci(1F|1)/Ata(Primary,Slave) blk1 : Acpi(PNP0A03,0)/Pci(1F|1)/Ata(Primary,Master) blk2 : Acpi(PNP0A03,1)/Pci(1F|0)/Pci(2|0)/Scsi(Pun0, Lun0) blk3 : Acpi(PNP0A03,1)/Pci(1F|0)/Pci(2|0)/ Scsi(Pun0,Lun0)/HD(Part1,Sig8983DFE0-F474-01C2-507B-9E5F8078F531) blk4 : Acpi(PNP0A03,1)/Pci(1F|0)/Pci(2|0)/ Scsi(Pun0,Lun0)/HD(Part2,Sig898D07A0-F474-01C2-F1B3-12714F758821) lk5 : Acpi(PNP0A03,1)/Pci(1F|0)/Pci(2|0)/ Scsi(Pun0,Lun0)/HD(Part3,Sig89919B80-F474-01C2-D931-F8428177D974)
Device Path
• fs0:
Acpi(PNP0A03,1)/Pci(1F|0)/Pci(2|0)/Scsi(Pun0,Lun0)/HD(Part1, Sig8983DFE0-F474-01C2-507B-9E5F8078F531)
• Fs0:
Acpi(PNP0A03,1)
Pci(1F|0)/Pci(2|0)
Scsi(Pun0,Lun0)
HD(Part1,Sig8983DFE0-F474-01C2-507B-9E5F8078F531)
Executing UEFI Applications
• Enter the application name at the command prompt
• The EFI shell uses “path” environment variable
• The EFI shell automatically adds “.efi”
path = fs0:>efiools;fs0:;.fs0:> test.efi fs0:> test fs1:> test
If suffix is .nsh, it will execute shell commands inside of the .nsh file similar to .bat in DOS
Execute a UEFI Shell
• nshell
Launches another copy of the EFI shell
Might require shellenv.efi, depending on how the shell was built
• exit
Returns control to the EFI application that launched the EFI shell
– Could be the EFI Boot Manager
– Could be another copy of the EFI shell
Wild Card Expansion
• Syntax is similar to DOS commands
’*’ Matches any string
’?’ Matches any character
[chars] Matches set of characters
Tab will extend to matching files or Directories
fs0:> dir *.efi
fs0:> dir test?.efi
Output Redirection
Redirect standard output to a Unicode file
memmap 1> Foo.txt memmap > Foo.txt
Redirect standard output to an ASCII file
memmap 1>a Foo.txt memmap >a Foo.txt
Append a file using redirection of standard output
memmap 1>>a Foo.txt memmap >>a Foo.txt
Redirect standard error to a Unicode file
memmap 2> Foo.txt
Redirect standard error to an ASCII file
memmap 2>a Foo.txt
EFI Shell Commands
dmem driversdh dmpstore devtreehelp ? err devicesmap guid connectmount pci disconnectload mm openinfounload reset reconnectloadbmp stall drvcfgnshell getmtc drvdiagver hexedit loadpcirommemmap Setsizebcfg SetDblkalias
Internal EFI Shell Commands
Commands that are built intothe shell environment and are not .efi applications that are loaded
Chosen by the system integrator who builds the shell or by the applications person who delivers nshell.efi
Can be integrated into flash with core EFI, SAL, BIOS and so on or be supplied separately with the other .efi applications
Examples
helpdhmapguidaliassetexitCdtype
External Shell Commands
• Applications that rely on the shell library
• For example, Edit, hexdump and other tools that are supplied with the application toolkit
• Some shells integrate these applications as a value add or differentiator or the applications are necessary for their systems
• Flash space is a determining factor
EFI Shell Commands
• DOS like
attribdateedit timebreakclsmodevol
• Batch Commands
(*.nsh files)echoexitforgotoifPauseEquivalent to *.bat filesNote: startup.nsh = autoexec.bat
Unix-like Shell Commands
ls rm cp mvmkdir typealiassettouch
• Warning: syntax is not exactly the same as bash or csh
• Use ? or help to look up the syntax
• Use Alias to translate the commands to something familiar
• For example:
– Alias dir ls
– Alias del rm
– Alias copy cp
Script File Example
echo Loading TCP/IP stack...load efioolscpipv4.efiif not %lasterror% == 0 then echo Error starting network stack goto Done
echo loaded tcpipv4ifconfig lo0 inet 127.0.0.1 upifconfig sni0 inet 134.134.31.175 netmask 55.255.255.0 uproute add default 134.134.31.251 cd :Done
Help or ?: Command List in Shell
alias Displays, creates, or deletes aliases in the EFI shellattrib Displays or changes the attributes of files or directoriesbcfg Dislplays/modifies the driver/boot configurationbreak Executes a break pointcd Displays or changes the current directorycls Clears the standard output with an optional background colorComp Compares the contents of two filescp Copies one or more files/directories to another locationdate Displays the current date or sets the date in the systemdblk Displays the contents of blocks from a block devicedh Displays the handles in the EFI environmentdmem Displays the contents of memoryecho Displays messages or turns command echoing on or offerr Displays or changes the error levelexit Exits the EFI Shellfor Executes commands for each item in a set of itemsgoto Makes batch file execution jump to another locationguid Displays all the GUIDs in the EFI environmentif Executes commands in specified conditionsload Loads and optionally connects EFI driversls Displays a list of files and subdirectories in a directorymap Displays or defines mappingsmemmap Displays the memory mapmkdir Creates one or more directories mm Displays or modifies MEM/IO/PCI mode Displays or changes the mode of the console output devicemount Mounts a file system on a block devicemv Moves one or more files/directories to destinationpause Prints a message and suspends for keyboard inputpci Displays PCI devices or PCI function configuration spacereset Resets the systemrm Deletes one or more files or directoriesset Displays, creates, changes or deletes EFI environment variablesstall Stalls the processor for some microsecondstime Displays the current time or sets the time of the systemtype Displays the contents of a fileunload Unloads a protocol imagever Displays the version informationvol Displays volume information of the file system
DH – Dump Handle
All devices and images are in a database called the handle database
Devices are located in the system by their device paths
DH [-b] [-d] [-lXXX] [-v] [handle]|[-p prot_id]Displays the handles in the EFI environment-b - Displays one screen at a timehandle - Dumps information of a certain handle-p prot_id - Dumps all handles of a certain protocol-d - Dumps EFI Driver Model related information-lXXX - Dumps information using the ISO 639-2 language specified by XXX-v - Dumps information on all handles
- 6.UEFI Shell Users’ Guide
- Phrame Users Guide
- RA users Guide
- HDFS Users Guide
- HDFS Users Guide
- Windows Home Server Users Guide
- Uefi Shell 应用程序 初探
- UEFI SHELL ENV BUILD
- JAVASCRIPT ENGINE FOR GUIXML USERS' GUIDE
- Phusion Passenger users guide, Nginx version
- UEFI Shell命令操作总结
- Google Shell Style Guide
- How to implement an UEFI Shell Application
- 通过在uefi shell 命令行启动grub
- php 版shell.users 加管理员帐号方法
- UEFI
- Users
- users
- Hello World!
- CG大事记
- java容器(一)
- Java_09_15课堂总结
- Java中的多线程:sleep, wait, join 与 interrupt()的关系
- 6.UEFI Shell Users’ Guide
- 给力注册
- CG快报 2011.9.11
- WPF中为ListView动态绑定数据且添加一列复选框
- hdu 4033
- find的用法
- Oracle 工具
- c# 与c/c++/java的区别(待续)
- java synchronized详解