public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Jaben Carsey <jaben.carsey@intel.com>
Subject: [PATCH 2/2] ShellPkg/DynamicCommand: Fix bug that cannot start in boot
Date: Tue, 28 Nov 2017 20:02:07 +0800	[thread overview]
Message-ID: <20171128120207.186068-3-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20171128120207.186068-1-ruiyu.ni@intel.com>

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>
Cc: Jaben Carsey <jaben.carsey@intel.com>
---
 ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c     | 1 +
 ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c | 1 +
 ShellPkg/ShellPkg.dsc                                           | 7 ++++++-
 3 files changed, 8 insertions(+), 1 deletion(-)

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 @@ [Components]
 !endif #$(NO_SHELL_PROFILES)
   }
 
-  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+  ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
+    <PcdsFixedAtBuild>
+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+  }
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf
   ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf {
+    <PcdsFixedAtBuild>
+      gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
     <LibraryClasses>
       PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf
   }
-- 
2.15.0.gvfs.1.preview.4



  parent reply	other threads:[~2017-11-28 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 12:02 [PATCH 0/2] Fix dynamic command cannot start in boot Ruiyu Ni
2017-11-28 12:02 ` [PATCH 1/2] ShellPkg/ShellLib: Fix dynamic command fails to start during boot Ruiyu Ni
2017-11-28 12:02 ` Ruiyu Ni [this message]
2017-11-28 15:00 ` [PATCH 0/2] Fix dynamic command cannot start in boot Carsey, Jaben

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171128120207.186068-3-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox