def __init__(self):\r
self.Identifier = b'PLDH'\r
self.HeaderLength = sizeof(UPLD_INFO_HEADER)\r
- self.SpecRevision = 0x0009\r
+ self.SpecRevision = 0x0070\r
self.Revision = 0x0000010105\r
self.ImageId = b'UEFI'\r
self.ProducerId = b'INTEL'\r
\r
+def GenSpecRevision (Argument):\r
+ try:\r
+ (MajorStr, MinorStr) = Argument.split('.')\r
+ except:\r
+ raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision format (Major[8-bits].Minor[8-bits]).'.format (Argument))\r
+ #\r
+ # Spec Revision Bits 15 : 8 - Major Version. Bits 7 : 0 - Minor Version.\r
+ #\r
+ if len(MinorStr) > 0 and len(MinorStr) < 3:\r
+ try:\r
+ Minor = int(MinorStr, 16) if len(MinorStr) == 2 else (int(MinorStr, 16) << 4)\r
+ except:\r
+ raise argparse.ArgumentTypeError ('{} Minor version of SpecRevision is not a valid integer value.'.format (Argument))\r
+ else:\r
+ raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision format (Major[8-bits].Minor[8-bits]).'.format (Argument))\r
+\r
+ if len(MajorStr) > 0 and len(MajorStr) < 3:\r
+ try:\r
+ Major = int(MajorStr, 16)\r
+ except:\r
+ raise argparse.ArgumentTypeError ('{} Major version of SpecRevision is not a valid integer value.'.format (Argument))\r
+ else:\r
+ raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision format (Major[8-bits].Minor[8-bits]).'.format (Argument))\r
+\r
+ return int('0x{0:02x}{1:02x}'.format(Major, Minor), 0)\r
+\r
+def Validate32BitInteger (Argument):\r
+ try:\r
+ Value = int (Argument, 0)\r
+ except:\r
+ raise argparse.ArgumentTypeError ('{} is not a valid integer value.'.format (Argument))\r
+ if Value < 0:\r
+ raise argparse.ArgumentTypeError ('{} is a negative value.'.format (Argument))\r
+ if Value > 0xffffffff:\r
+ raise argparse.ArgumentTypeError ('{} is larger than 32-bits.'.format (Argument))\r
+ return Value\r
+\r
def RunCommand(cmd):\r
print(cmd)\r
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,cwd=os.environ['WORKSPACE'])\r
# Buid Universal Payload Information Section ".upld_info"\r
#\r
upld_info_hdr = UPLD_INFO_HEADER()\r
+ upld_info_hdr.SpecRevision = Args.SpecRevision\r
+ upld_info_hdr.Revision = Args.Revision\r
+ upld_info_hdr.ProducerId = Args.ProducerId.encode()[:16]\r
upld_info_hdr.ImageId = Args.ImageId.encode()[:16]\r
upld_info_hdr.Attribute |= 1 if BuildTarget == "DEBUG" else 0\r
fp = open(UpldInfoFile, 'wb')\r
parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID (16 bytes maximal).', default ='UEFI')\r
parser.add_argument('-q', '--Quiet', action='store_true', help='Disable all build messages except FATAL ERRORS.')\r
parser.add_argument("-p", "--pcd", action="append")\r
+ parser.add_argument("-s", "--SpecRevision", type=GenSpecRevision, default ='0.7', help='Indicates compliance with a revision of this specification in the BCD format.')\r
+ parser.add_argument("-r", "--Revision", type=Validate32BitInteger, default ='0x0000010105', help='Revision of the Payload binary. Major.Minor.Revision.Build')\r
+ parser.add_argument("-o", "--ProducerId", default ='INTEL', help='A null-terminated OEM-supplied string that identifies the payload producer (16 bytes maximal).')\r
MacroList = {}\r
args = parser.parse_args()\r
if args.Macro is not None:\r