From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E9DB420977871 for ; Tue, 29 May 2018 15:56:39 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2018 15:56:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,458,1520924400"; d="scan'208";a="58709497" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.50]) by fmsmga004.fm.intel.com with ESMTP; 29 May 2018 15:56:39 -0700 From: Michael D Kinney To: edk2-devel@lists.01.org Cc: Sean Brogan , Jiewen Yao , Yonghong Zhu , Liming Gao Date: Tue, 29 May 2018 15:56:34 -0700 Message-Id: <20180529225635.22536-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 Subject: [RFC 0/1] Add Capsule Generation Tools X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 22:56:40 -0000 https://bugzilla.tianocore.org/show_bug.cgi?id=945 Based on content from the following branch https://github.com/Microsoft/MS_UEFI/tree/share/beta/CapsuleTools Command line unit tests for python modules available from following branch: https://github.com/mdkinney/edk2/tree/Bug_945_StandAloneCapsuleTools_V2 https://github.com/mdkinney/edk2/tree/Bug_945_StandAloneCapsuleTools_V2/BaseToolsUnitTest * Convert C tools to Python * Add common python modules to: BaseTools/Source/Python/Common/Uefi/Capsule BaseTools/Source/Python/Common/Edk2/Capsule * Add GenerateCapsule.py to BaseTools/Source/Python/Capsule * Add Windows and Posix wrappers for GenerateCapsule.py usage: GenerateCapsule [-h] [-o OUTPUTFILE] (-e | -d | --dump-info) [--capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset}] [--capoemflag CAPSULEOEMFLAG] [--guid GUID] [--hardware-instance HARDWAREINSTANCE] [--monotonic-count MONOTONICCOUNT] [--version FWVERSION] [--lsv LOWESTSUPPORTEDVERSION] [--pfx-file SIGNTOOLPFXFILE] [--signer-private-cert OPENSSLSIGNERPRIVATECERTFILE] [--other-public-cert OPENSSLOTHERPUBLICCERTFILE] [--trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE] [--signing-tool-path SIGNINGTOOLPATH] [-v] [-q] [--debug [0-9]] InputFile Generate a capsule. Copyright (c) 2018, Intel Corporation. All rights reserved. positional arguments: InputFile Input binary payload filename. optional arguments: -h, --help show this help message and exit -o OUTPUTFILE, --output OUTPUTFILE Output filename. -e, --encode Encode file -d, --decode Decode file --dump-info Display FMP Payload Header information --capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset} Capsule flag can be PersistAcrossReset, or PopulateSystemTable or InitiateReset or not set --capoemflag CAPSULEOEMFLAG Capsule OEM Flag is an integer between 0x0000 and 0xffff. --guid GUID The FMP/ESRT GUID in registry format. Required for encode operations. --hardware-instance HARDWAREINSTANCE The 64-bit hardware instance. The default is 0x0000000000000000 --monotonic-count MONOTONICCOUNT 64-bit monotonic count value in header. Default is 0x0000000000000000. --version FWVERSION The 32-bit version of the binary payload (e.g. 0x11223344 or 5678). --lsv LOWESTSUPPORTEDVERSION The 32-bit lowest supported version of the binary payload (e.g. 0x11223344 or 5678). --pfx-file SIGNTOOLPFXFILE signtool PFX certificate filename. --signer-private-cert OPENSSLSIGNERPRIVATECERTFILE OpenSSL signer private certificate filename. --other-public-cert OPENSSLOTHERPUBLICCERTFILE OpenSSL other public certificate filename. --trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE OpenSSL trusted public certificate filename. --signing-tool-path SIGNINGTOOLPATH Path to signtool or Open SLL tool. Optional if path to tools are already in PATH. -v, --verbose Increase output messages -q, --quiet Reduce output messages --debug [0-9] Set debug level Cc: Sean Brogan Cc: Jiewen Yao Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney Kinney, Michael D (1): BaseTools/Capsule: Add Capsule Generation Tools BaseTools/BinWrappers/PosixLike/GenerateCapsule | 14 + .../BinWrappers/WindowsLike/GenerateCapsule.bat | 1 + BaseTools/Source/Python/Capsule/GenerateCapsule.py | 500 +++++++++++++++++++++ .../Python/Common/Edk2/Capsule/FmpPayloadHeader.py | 91 ++++ .../Source/Python/Common/Edk2/Capsule/__init__.py | 15 + BaseTools/Source/Python/Common/Edk2/__init__.py | 15 + .../Python/Common/Uefi/Capsule/FmpAuthHeader.py | 184 ++++++++ .../Python/Common/Uefi/Capsule/FmpCapsuleHeader.py | 302 +++++++++++++ .../Common/Uefi/Capsule/UefiCapsuleHeader.py | 136 ++++++ .../Source/Python/Common/Uefi/Capsule/__init__.py | 15 + BaseTools/Source/Python/Common/Uefi/__init__.py | 15 + 11 files changed, 1288 insertions(+) create mode 100644 BaseTools/BinWrappers/PosixLike/GenerateCapsule create mode 100644 BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat create mode 100644 BaseTools/Source/Python/Capsule/GenerateCapsule.py create mode 100644 BaseTools/Source/Python/Common/Edk2/Capsule/FmpPayloadHeader.py create mode 100644 BaseTools/Source/Python/Common/Edk2/Capsule/__init__.py create mode 100644 BaseTools/Source/Python/Common/Edk2/__init__.py create mode 100644 BaseTools/Source/Python/Common/Uefi/Capsule/FmpAuthHeader.py create mode 100644 BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py create mode 100644 BaseTools/Source/Python/Common/Uefi/Capsule/UefiCapsuleHeader.py create mode 100644 BaseTools/Source/Python/Common/Uefi/Capsule/__init__.py create mode 100644 BaseTools/Source/Python/Common/Uefi/__init__.py -- 2.14.2.windows.3