From: Ruiyu Ni Date: Tue, 28 Nov 2017 11:43:16 +0000 (+0800) Subject: ShellPkg/DynamicCommand: Fix bug that cannot start in boot X-Git-Tag: edk2-stable201903~2990 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=ff5a4bcff3e2afe4a94e62d457ccfc5361590067;hp=68b07ebae5d7c4124ff7b2a8d35e2f8b6cda18b8 ShellPkg/DynamicCommand: Fix bug that cannot start in boot 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 Reviewed-by: Jaben Carsey --- diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c index 6f3997fff4..b10c59f49c 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c @@ -38,6 +38,7 @@ DpCommandHandler ( ) { gEfiShellParametersProtocol = ShellParameters; + gEfiShellProtocol = Shell; return RunDp (gImageHandle, SystemTable); } diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c index 928ef08468..9e6489dd6f 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c @@ -39,6 +39,7 @@ TftpCommandHandler ( ) { gEfiShellParametersProtocol = ShellParameters; + gEfiShellProtocol = Shell; return RunTftp (gImageHandle, SystemTable); } diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc index 65e8959455..86382139a5 100644 --- a/ShellPkg/ShellPkg.dsc +++ b/ShellPkg/ShellPkg.dsc @@ -120,9 +120,14 @@ !endif #$(NO_SHELL_PROFILES) } - ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf { + + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + } ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf { + + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf }