# # Read binary input file # try: if args.Verbose: print ('Read binary input file {File}'.format (File = args.InputFile.name)) Buffer = args.InputFile.read () args.InputFile.close () except: print ('GenerateCapsule: error: can not read binary input file {File}'.format (File = args.InputFile.name)) sys.exit (1) # # Create objects # UefiCapsuleHeader = UefiCapsuleHeaderClass () FmpCapsuleHeader = FmpCapsuleHeaderClass () FmpAuthHeader = FmpAuthHeaderClass () FmpPayloadHeader = FmpPayloadHeaderClass () if args.Encode: Result = Buffer if UseSignTool or UseOpenSsl: try: FmpPayloadHeader.FwVersion = args.FwVersion FmpPayloadHeader.LowestSupportedVersion = args.LowestSupportedVersion FmpPayloadHeader.Payload = Result Result = FmpPayloadHeader.Encode () if args.Verbose: FmpPayloadHeader.DumpInfo () except:
"--pfx-file", dest='PfxFile', help="pfx file path used to sign resource update driver") parser.add_argument( "--arch", dest='Arch', help="supported architecture:arm/x64/amd64/arm64/aarch64", default='amd64') parser.add_argument( "--operating-system-string", dest='OperatingSystemString', help= "supported operating system:win10/10/10_au/10_rs2/10_rs3/10_rs4/server10/server2016/serverrs2/serverrs3/serverrs4", default="win10") args = parser.parse_args() InputFile = os.path.join(args.OutputFolder, '') + args.CapsuleFileName UefiCapsuleHeader = UefiCapsuleHeaderClass() FmpCapsuleHeader = FmpCapsuleHeaderClass() CapsuleGuidCheck(InputFile, args.ProductFmpGuid) ArgCheck(args) ProductName = os.path.splitext(args.CapsuleFileName)[0] WindowsDriver = WindowsCapsuleSupportHelper() WindowsDriver.PackageWindowsCapsuleFiles( args.OutputFolder, ProductName, args.ProductFmpGuid, args.CapsuleVersion_DotString, args.CapsuleVersion_HexString, args.ProductFwProvider, args.ProductFwMfgName, args.ProductFwDesc, args.CapsuleFileName, args.PfxFile, None, None, args.Arch, args.OperatingSystemString)