diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py index b91837d3d6..71fcfc5ac3 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -651,7 +651,7 @@ class GenVPD : EdkLogger.error("BPDG", BuildToolError.FILE_OPEN_FAILURE, "File open failed for %s" % self.VpdFileName, None) try : - fMapFile = open(MapFileName, "w", 0) + fMapFile = open(MapFileName, "w") except: # Open failed EdkLogger.error("BPDG", BuildToolError.FILE_OPEN_FAILURE, "File open failed for %s" % self.MapFileName, None) @@ -675,8 +675,12 @@ class GenVPD : # Write Vpd binary file fStringIO.seek (eachPcd.PcdBinOffset) if isinstance(eachPcd.PcdValue, list): - ValueList = [chr(Item) for Item in eachPcd.PcdValue] - fStringIO.write(''.join(ValueList)) + for i in range(len(eachPcd.PcdValue)): + Value = eachPcd.PcdValue[i:i + 1] + if isinstance(bytes(Value), str): + fStringIO.write(chr(Value[0])) + else: + fStringIO.write(bytes(Value)) else: fStringIO.write (eachPcd.PcdValue)