From 16ccac42cff45475b04dc6a06a24d569baedb427 Mon Sep 17 00:00:00 2001 From: andrewfish Date: Wed, 10 Feb 2010 00:46:41 +0000 Subject: Add CWD and thus a cd command to EBL shell. Fix WatchdogTimout code in EBL, it was inside a PCD feature flag and should have been outside of the PCD so it is in all paths. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9958 6f19259b-4bc3-4df7-8a09-765794883524 --- EmbeddedPkg/Ebl/Dir.c | 45 +++++++++++++++++++++++++++++++++++++++++---- EmbeddedPkg/Ebl/Main.c | 7 ++++--- 2 files changed, 45 insertions(+), 7 deletions(-) (limited to 'EmbeddedPkg/Ebl') diff --git a/EmbeddedPkg/Ebl/Dir.c b/EmbeddedPkg/Ebl/Dir.c index 4e9f7b98b2..ff1b557ed1 100644 --- a/EmbeddedPkg/Ebl/Dir.c +++ b/EmbeddedPkg/Ebl/Dir.c @@ -52,7 +52,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gFvFileType[] = { only print out files that contain the string *.efi dir fv1:\ ; perform a dir on fv1: device in the efi directory NOTE: fv devices do not contian subdirs - dir fv1:\ * PEIM ; will match all files of type SEC + dir fv1:\ * PEIM ; will match all files of type PEIM @param Argc Number of command arguments in Argv @param Argv Array of strings that represent the parsed command line. @@ -88,14 +88,19 @@ EblDirCmd ( UINTN Length; UINTN BestMatchCount; CHAR16 UnicodeFileName[MAX_CMD_LINE]; + CHAR8 *Path; if (Argc <= 1) { - // CWD not currently supported - return EFI_SUCCESS; + Path = EfiGetCwd (); + if (Path == NULL) { + return EFI_SUCCESS; + } + } else { + Path = Argv[1]; } - File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0); + File = EfiOpen (Path, EFI_FILE_MODE_READ, 0); if (File == NULL) { return EFI_SUCCESS; } @@ -277,6 +282,32 @@ Done: return EFI_SUCCESS; } +/** + Change the Current Working Directory + + Argv[0] - "cd" + Argv[1] - Device Name:path. Path is optional + + @param Argc Number of command arguments in Argv + @param Argv Array of strings that represent the parsed command line. + Argv[0] is the comamnd name + + @return EFI_SUCCESS + +**/ +EFI_STATUS +EblCdCmd ( + IN UINTN Argc, + IN CHAR8 **Argv + ) +{ + if (Argc <= 1) { + return EFI_SUCCESS; + } + + return EfiSetCwd (Argv[1]); +} + GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdDirTemplate[] = @@ -286,6 +317,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdDirTemplate[] = " dirdev [*match]; directory listing of dirdev. opt match a substring", NULL, EblDirCmd + }, + { + "cd", + " device - set the current working directory", + NULL, + EblCdCmd } }; diff --git a/EmbeddedPkg/Ebl/Main.c b/EmbeddedPkg/Ebl/Main.c index d3dcc58a92..ed2104cfe7 100644 --- a/EmbeddedPkg/Ebl/Main.c +++ b/EmbeddedPkg/Ebl/Main.c @@ -464,7 +464,7 @@ EblPrompt ( ) { EblSetTextColor (EFI_YELLOW); - AsciiPrint ((CHAR8 *)PcdGetPtr (PcdEmbeddedPrompt)); + AsciiPrint ((CHAR8 *)PcdGetPtr (PcdEmbeddedPrompt), EfiGetCwd ()); EblSetTextColor (0); AsciiPrint ("%a", ">"); } @@ -559,6 +559,9 @@ EdkBootLoaderEntry ( EblInitializeExternalCmd (); EblInitializeNetworkCmd(); + // Disable the 5 minute EFI watchdog time so we don't get automatically reset + gBS->SetWatchdogTimer (0, 0, 0, NULL); + if (FeaturePcdGet (PcdEmbeddedMacBoot)) { // A MAC will boot in graphics mode, so turn it back to text here // This protocol was removed from edk2. It is only an edk thing. We need to make our own copy. @@ -567,8 +570,6 @@ EdkBootLoaderEntry ( // Enable the biggest output screen size possible gST->ConOut->SetMode (gST->ConOut, (UINTN)gST->ConOut->Mode->MaxMode - 1); - // Disable the 5 minute EFI watchdog time so we don't get automatically reset - gBS->SetWatchdogTimer (0, 0, 0, NULL); } // Save current screen mode -- cgit v1.2.3