From: "Eric Jin" <eric.jin@intel.com>
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@microsoft.com>,
Bret Barkelew <Bret.Barkelew@microsoft.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>,
Bob Feng <bob.c.feng@intel.com>
Subject: [PATCH 1/2] BaseTools/Capsule: Add WindowsCapsuleSupportHelper
Date: Wed, 7 Aug 2019 17:08:45 +0800 [thread overview]
Message-ID: <20190807090845.5920-1-eric.jin@intel.com> (raw)
Add initial version WindowsCapsuleSupportHelper.py
original source comes from
https://github.com/microsoft/mu_basecore/blob/dev/201905/BaseTools/Plugin/WindowsCapsuleSupportHelper/WindowsCapsuleSupportHelper.py
commit ebd9aad90dee3a3094b575928670cf81b8c685b5
Convert EOL to CRLF
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
.../Capsule/WindowsCapsuleSupportHelper.py | 62 +++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py
diff --git a/BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py b/BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py
new file mode 100644
index 0000000000..166af58d81
--- /dev/null
+++ b/BaseTools/Source/Python/Capsule/WindowsCapsuleSupportHelper.py
@@ -0,0 +1,62 @@
+##
+# UefiBuild Plugin that supports Window Capsule files based on the
+# Windows Firmware Update Platform spec.
+# Creates INF, Cat, and then signs it
+#
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import sys
+import re
+import datetime
+import os
+import logging
+from MuEnvironment import PluginManager
+from MuPythonLibrary.Uefi.Capsule.CatGenerator import *
+from MuPythonLibrary.Uefi.Capsule.InfGenerator import *
+from MuPythonLibrary.UtilityFunctions import CatalogSignWithSignTool
+from MuPythonLibrary.Windows.VsWhereUtilities import FindToolInWinSdk
+
+
+class WindowsCapsuleSupportHelper(PluginManager.IUefiHelperPlugin):
+
+ def RegisterHelpers(self, obj):
+ fp = os.path.abspath(__file__)
+ obj.Register("PackageWindowsCapsuleFiles", WindowsCapsuleSupportHelper.PackageWindowsCapsuleFiles, fp)
+
+
+ @staticmethod
+ def PackageWindowsCapsuleFiles(OutputFolder, ProductName, ProductFmpGuid, CapsuleVersion_DotString,
+ CapsuleVersion_HexString, ProductFwProvider, ProductFwMfgName, ProductFwDesc, CapsuleFileName, PfxFile=None, PfxPass=None,
+ Rollback=False, Arch='amd64', OperatingSystem_String='Win10'):
+
+ logging.debug("CapsulePackage: Create Windows Capsule Files")
+
+ #Make INF
+ InfFilePath = os.path.join(OutputFolder, ProductName + ".inf")
+ InfTool = InfGenerator(ProductName, ProductFwProvider, ProductFmpGuid, Arch, ProductFwDesc, CapsuleVersion_DotString, CapsuleVersion_HexString)
+ InfTool.Manufacturer = ProductFwMfgName #optional
+ ret = InfTool.MakeInf(InfFilePath, CapsuleFileName, Rollback)
+ if(ret != 0):
+ raise Exception("CreateWindowsInf Failed with errorcode %d" % ret)
+
+ #Make CAT
+ CatFilePath = os.path.realpath(os.path.join(OutputFolder, ProductName + ".cat"))
+ CatTool = CatGenerator(Arch, OperatingSystem_String)
+ ret = CatTool.MakeCat(CatFilePath)
+
+ if(ret != 0):
+ raise Exception("Creating Cat file Failed with errorcode %d" % ret)
+
+ if(PfxFile is not None):
+ #Find Signtool
+ SignToolPath = FindToolInWinSdk("signtool.exe")
+ if not os.path.exists(SignToolPath):
+ raise Exception("Can't find signtool on this machine.")
+ #dev sign the cat file
+ ret = CatalogSignWithSignTool(SignToolPath, CatFilePath, PfxFile, PfxPass)
+ if(ret != 0):
+ raise Exception("Signing Cat file Failed with errorcode %d" % ret)
+
+ return ret
--
2.20.1.windows.1
reply other threads:[~2019-08-07 9:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190807090845.5920-1-eric.jin@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