Esta secuencia de comandos de ejemplo muestra algunas funciones de protocolo.
Ejemplos de secuencias de comandos de Shell
Ejemplos
Los siguientes ejemplos de secuencias de comandos muestran cómo capturar una configuración
(exportar) para replicarla (importar) desde el archivo startup.nsh montado en un soporte virtual
de iLO.
Ejemplo
fs0:\>
/** @file
This is an example Shell Application. Note that there are
other ways to add a command to the shell. This example
demonstrates just one.
Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
This software contains information confidential and proprietary to
Hewlett-Packard Company. It shall not be reproduced in whole or in part,
or transferred to other documents, or disclosed to third parties, or used
for any purpose other than that for which it was obtained without the prior
written consent of Hewlett-Packard Company.
**/
#include <Protocol/EfiShell.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
/**
Implements simple shell HelloWorld Application that prints out
the string "Hello World" to the screen and then display UEFI
Shell revision and registered environment variables in system.
This example demonstrates how a new UEFI Shell Application can
be created to run at UEFI Shell Prompt.
@param ImageHandle
@param SystemTable
@retval EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
UefiMain (
IN EFI_HANDLE
IN EFI_SYSTEM_TABLE
)
{
EFI_SHELL_PROTOCOL
CONST CHAR16
CONST CHAR16
EFI_STATUS
Print (L"Hello World!\n");
//
// Locate UEFI Shell Protocol
//
Status = gBS->OpenProtocol (
if (EFI_ERROR(Status)) {
//
// Search for the shell protocol
//
Status = gBS->LocateProtocol (
Handle to the Image
Pointer to the System Table
In all cases
ImageHandle,
*SystemTable
*UefiShellProtocol;
*ConstEnvNameList;
*Value;
Status;
ImageHandle,
&gEfiShellProtocolGuid,
(VOID **)&UefiShellProtocol,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
&gEfiShellProtocolGuid,
NULL,
(VOID **)&UefiShellProtocol
Ejemplos de secuencias de comandos de Shell
75