ShellPkg/DynamicCommand: Fix bug that cannot start in boot
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 28 Nov 2017 11:43:16 +0000 (19:43 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 29 Nov 2017 02:32:02 +0000 (10:32 +0800)
When dynamic command drivers are built into FV and start during
boot, they fails. Because Shell protocol doesn't exist during boot.
The patch sets Shell protocol and also set PcdShellLibAutoInitialize
to FALSE to ensure that
1. Shell protocol check doesn't happen in driver's entry point.
2. Driver can get the Shell protocol in DynamicCommand.Handler().

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c
ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c
ShellPkg/ShellPkg.dsc

index 6f3997fff4063f52aa5865d12a35dd74af943f02..b10c59f49c2892db1f534ea9ef50933279ea2e79 100644 (file)
@@ -38,6 +38,7 @@ DpCommandHandler (
   )\r
 {\r
   gEfiShellParametersProtocol = ShellParameters;\r
+  gEfiShellProtocol           = Shell;\r
   return RunDp (gImageHandle, SystemTable);\r
 }\r
 \r
index 928ef08468e150b56dacca8da4df70657f0b3ced..9e6489dd6fc5abedb6c549b47a666abdddc97274 100644 (file)
@@ -39,6 +39,7 @@ TftpCommandHandler (
   )\r
 {\r
   gEfiShellParametersProtocol = ShellParameters;\r
+  gEfiShellProtocol           = Shell;\r
   return RunTftp (gImageHandle, SystemTable);\r
 }\r
 \r
index 65e89594550e9cd3a8743edbbe673f0adc0748f7..86382139a5a26e6be5ac1cab19e0019377ebd75e 100644 (file)
 !endif #$(NO_SHELL_PROFILES)\r
   }\r
 \r
-  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf\r
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {\r
+    <PcdsFixedAtBuild>\r
+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE\r
+  }\r
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf\r
   ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf {\r
+    <PcdsFixedAtBuild>\r
+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE\r
     <LibraryClasses>\r
       PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf\r
   }\r