diff options
author | Harry Liebel <Harry.Liebel@arm.com> | 2014-10-27 10:52:11 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@Edk2> | 2014-10-27 10:52:11 +0000 |
commit | ced216f8b994bbc5a9a7a377668bf8f5a0d782e2 (patch) | |
tree | 769cf4bd43347e451ae208864f5845b505cf3c24 /ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c | |
parent | 53ae06f50dea91865edfacde1edc70c9e76b90d2 (diff) | |
download | edk2-platforms-ced216f8b994bbc5a9a7a377668bf8f5a0d782e2.tar.xz |
ArmPlatformPkg/ArmShellCmdRunAxf: Added 'runaxf' cmd to shell
Use the command to load and start a ARM Executable File from mass storage.
This is basically just an ELF file. The program is copied to memory and
the Entrypoint is called. Control is not expected to return back to the
Shell. This has only been tested on AArch64 with a limited set of AXF
binaries.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16247 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c')
-rw-r--r-- | ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c new file mode 100644 index 0000000000..67bbb9e863 --- /dev/null +++ b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c @@ -0,0 +1,95 @@ +/** @file
+*
+* Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
+*
+* This program and the accompanying materials are licensed and made available
+* under the terms and conditions of the BSD License which accompanies this
+* distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include <Uefi.h>
+
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiLib.h>
+#include <Library/ArmShellCmdLib.h>
+
+#include "ArmShellCmdRunAxf.h"
+
+EFI_HANDLE gRunAxfHiiHandle = NULL;
+
+#define RUNAXF_HII_GUID \
+ { \
+ 0xf5a6413b, 0x78d5, 0x448e, { 0xa2, 0x15, 0x22, 0x82, 0x8e, 0xbc, 0x61, 0x61 } \
+ }
+
+EFI_GUID gRunAxfHiiGuid = RUNAXF_HII_GUID;
+
+static EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mShellDynCmdProtocolRunAxf = {
+ L"runaxf", // *CommandName
+ ShellDynCmdRunAxfHandler, // Handler
+ ShellDynCmdRunAxfGetHelp // GetHelp
+};
+
+EFI_STATUS
+ShellDynCmdRunAxfInstall (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ EFI_STATUS Status;
+
+ // Register our shell command
+ Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,
+ &gEfiShellDynamicCommandProtocolGuid,
+ &mShellDynCmdProtocolRunAxf,
+ NULL);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ // Load the manual page for our command
+ //
+ // 3rd parameter 'HII strings array' must be name of .uni strings file
+ // followed by 'Strings', e.g. mycommands.uni must be specified as
+ // 'mycommandsStrings' because the build Autogen process defines this as a
+ // string array for the strings in your .uni file. Examine your Build folder
+ // under your package's DEBUG folder and you will find it defined in a
+ // xxxStrDefs.h file.
+ //
+ gRunAxfHiiHandle = HiiAddPackages (&gRunAxfHiiGuid, ImageHandle,
+ ArmShellCmdRunAxfStrings, NULL);
+ if (gRunAxfHiiHandle == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+ShellDynCmdRunAxfUninstall (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+
+ EFI_STATUS Status;
+
+ if (gRunAxfHiiHandle != NULL) {
+ HiiRemovePackages (gRunAxfHiiHandle);
+ }
+
+ Status = gBS->UninstallMultipleProtocolInterfaces (ImageHandle,
+ &gEfiShellDynamicCommandProtocolGuid,
+ &mShellDynCmdProtocolRunAxf,
+ NULL);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
|