OvmfPkg: Add support for UEFI shell

When building:
-D BUILD_NEW_SHELL - Build and include UEFI shell in firmware
-D USE_NEW_SHELL - Include UEFI shell binary build in firmware

The default is to use the older EFI shell.

Signed-off-by: jljusten

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11890 6f19259b-4bc3-4df7-8a09-765794883524
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 5020226..537cf7c 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -234,6 +234,14 @@
 

   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2

 

+!if $(BUILD_NEW_SHELL)

+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }

+!else

+!if $(USE_NEW_SHELL)

+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }

+!endif

+!endif

+

 ################################################################################

 #

 # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform

@@ -393,3 +401,29 @@
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf

   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf

 

+!if $(BUILD_NEW_SHELL)

+  ShellPkg/Application/Shell/Shell.inf {

+    <LibraryClasses>

+      ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf

+      HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf

+      FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf

+      ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf

+      SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf

+      PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf

+#      SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf

+#      SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf

+

+    <PcdsFixedAtBuild>

+      gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF

+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE

+      gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000

+  }

+!endif

+

diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 52b4c0b..ed15202 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -1,7 +1,7 @@
 ## @file

 #  Open Virtual Machine Firmware: FDF

 #

-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>

+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>

 #

 #  This program and the accompanying materials

 #  are licensed and made available under the terms and conditions of the BSD License

@@ -203,7 +203,16 @@
 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf

 

 INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf

+

+!if $(BUILD_NEW_SHELL)

+INF  ShellPkg/Application/Shell/Shell.inf

+!else

+!if $(USE_NEW_SHELL)

+INF  RuleOverride = BINARY ShellBinPkg/UefiShell/UefiShell.inf

+!else

 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf

+!endif

+!endif

 

 FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {

   SECTION RAW = MdeModulePkg/Logo/Logo.bmp

diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 083c340..a07ff80 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -234,6 +234,14 @@
 

   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2

 

+!if $(BUILD_NEW_SHELL)

+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }

+!else

+!if $(USE_NEW_SHELL)

+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }

+!endif

+!endif

+

 ################################################################################

 #

 # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform

@@ -394,3 +402,29 @@
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf

   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf

 

+!if $(BUILD_NEW_SHELL)

+  ShellPkg/Application/Shell/Shell.inf {

+    <LibraryClasses>

+      ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf

+      HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf

+      FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf

+      ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf

+      SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf

+      PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf

+#      SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf

+#      SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf

+

+    <PcdsFixedAtBuild>

+      gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF

+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE

+      gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000

+  }

+!endif

+

diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index abbe133..df21265 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -1,7 +1,7 @@
 ## @file

 #  Open Virtual Machine Firmware: FDF

 #

-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>

+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>

 #

 #  This program and the accompanying materials

 #  are licensed and made available under the terms and conditions of the BSD License

@@ -203,7 +203,16 @@
 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf

 

 INF  RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf

+

+!if $(BUILD_NEW_SHELL)

+INF  ShellPkg/Application/Shell/Shell.inf

+!else

+!if $(USE_NEW_SHELL)

+INF  RuleOverride = BINARY USE = X64 ShellBinPkg/UefiShell/UefiShell.inf

+!else

 INF  RuleOverride = BINARY USE = X64 EdkShellBinPkg/FullShell/FullShell.inf

+!endif

+!endif

 

 FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {

   SECTION RAW = MdeModulePkg/Logo/Logo.bmp

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index d6e070a..15dc417 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -234,6 +234,14 @@
 

   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2

 

+!if $(BUILD_NEW_SHELL)

+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }

+!else

+!if $(USE_NEW_SHELL)

+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }

+!endif

+!endif

+

 ################################################################################

 #

 # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform

@@ -393,3 +401,29 @@
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf

   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf

 

+!if $(BUILD_NEW_SHELL)

+  ShellPkg/Application/Shell/Shell.inf {

+    <LibraryClasses>

+      ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf

+      NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf

+      HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf

+      FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf

+      ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf

+      SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf

+      PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf

+#      SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf

+#      SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf

+

+    <PcdsFixedAtBuild>

+      gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF

+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE

+      gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000

+  }

+!endif

+

diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 7ae95cd..f0388b1 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -1,7 +1,7 @@
 ## @file

 #  Open Virtual Machine Firmware: FDF

 #

-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>

+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>

 #

 #  This program and the accompanying materials

 #  are licensed and made available under the terms and conditions of the BSD License

@@ -203,7 +203,16 @@
 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf

 

 INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf

+

+!if $(BUILD_NEW_SHELL)

+INF  ShellPkg/Application/Shell/Shell.inf

+!else

+!if $(USE_NEW_SHELL)

+INF  RuleOverride = BINARY ShellBinPkg/UefiShell/UefiShell.inf

+!else

 INF  RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf

+!endif

+!endif

 

 FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {

   SECTION RAW = MdeModulePkg/Logo/Logo.bmp