From: Star Zeng <star.zeng@intel.com>
To: edk2-devel@lists.01.org
Cc: Star Zeng <star.zeng@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH 1/6] MdeModulePkg CapsuleApp: Check Arg count for -P GET option
Date: Fri, 13 Jul 2018 17:08:38 +0800 [thread overview]
Message-ID: <1531472923-253528-2-git-send-email-star.zeng@intel.com> (raw)
In-Reply-To: <1531472923-253528-1-git-send-email-star.zeng@intel.com>
Also add help info for CapsuleApp -P GET option.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
index e9be39fd71be..80b66bc6f371 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
@@ -740,7 +740,8 @@ PrintUsage (
Print(L" which is defined in UEFI specification.\n");
Print(L" -C: Clear capsule report variable (EFI_CAPSULE_REPORT_GUID),\n");
Print(L" which is defined in UEFI specification.\n");
- Print(L" -P: Dump UEFI FMP protocol info.\n");
+ Print(L" -P: Dump UEFI FMP protocol info, or get image with specified\n");
+ Print(L" ImageTypeId and index to a file if 'GET' option is used.\n");
Print(L" -E: Dump UEFI ESRT table info.\n");
Print(L" -G: Convert a BMP file to be an UX capsule,\n");
Print(L" according to Windows Firmware Update document\n");
@@ -820,7 +821,15 @@ UefiMain (
DumpFmpData();
}
if (Argc >= 3) {
- if (StrCmp(Argv[2], L"GET") == 0) {
+ if (StrCmp(Argv[2], L"GET") != 0) {
+ Print(L"CapsuleApp: Unrecognized option(%s).\n", Argv[2]);
+ return EFI_UNSUPPORTED;
+ } else {
+ if (Argc != 7) {
+ Print(L"CapsuleApp: Incorrect parameter count.\n");
+ return EFI_UNSUPPORTED;
+ }
+
EFI_GUID ImageTypeId;
UINTN ImageIndex;
//
@@ -832,9 +841,11 @@ UefiMain (
return EFI_INVALID_PARAMETER;
}
ImageIndex = StrDecimalToUintn(Argv[4]);
- if (StrCmp(Argv[5], L"-O") == 0) {
- DumpFmpImage(&ImageTypeId, ImageIndex, Argv[6]);
+ if (StrCmp(Argv[5], L"-O") != 0) {
+ Print(L"CapsuleApp: NO output file name.\n");
+ return EFI_UNSUPPORTED;
}
+ DumpFmpImage(&ImageTypeId, ImageIndex, Argv[6]);
}
}
return EFI_SUCCESS;
--
2.7.0.windows.1
next prev parent reply other threads:[~2018-07-13 9:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 9:08 [PATCH 0/6] CapsuleApp: Some enhancements Star Zeng
2018-07-13 9:08 ` Star Zeng [this message]
2018-07-13 9:08 ` [PATCH 2/6] MdeModulePkg CapsuleApp: Fix memory leak in DumpFmpImage() Star Zeng
2018-07-13 9:08 ` [PATCH 3/6] MdeModulePkg CapsuleApp: Do not parse bits in CapsuleFlags of ESRT Star Zeng
2018-07-13 9:08 ` [PATCH 4/6] MdeModulePkg CapsuleApp: Show clear message when option is unrecognized Star Zeng
2018-07-13 9:08 ` [PATCH 5/6] MdeModulePkg CapsuleApp: Check capsule header before using its Flags Star Zeng
2018-07-13 9:08 ` [PATCH 6/6] MdeModulePkg CapsuleApp: Use EFI_UNSUPPORTED for incorrect Argc case Star Zeng
2018-07-23 0:59 ` [PATCH 0/6] CapsuleApp: Some enhancements Yao, Jiewen
2018-07-27 1:33 ` Yao, Jiewen
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=1531472923-253528-2-git-send-email-star.zeng@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