Specify little-endian, and then use the “Standard size” from the chart.
authorYao, Jiewen <jiewen.yao@intel.com>
Fri, 5 Dec 2014 00:28:11 +0000 (00:28 +0000)
committerjyao1 <jyao1@Edk2>
Fri, 5 Dec 2014 00:28:11 +0000 (00:28 +0000)
Enhance python tool.
The default being native size (and alignment) means by default the standard sizes are not used, which might cause different behavior on difference compiler.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Andrew Fish" <afish@apple.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16476 6f19259b-4bc3-4df7-8a09-765794883524

IntelFspPkg/Tools/GenCfgOpt.py

index 78b330a..555099b 100644 (file)
@@ -614,8 +614,8 @@ EndList
 \r
                 BinFd = open(BinFile, "rb")\r
                 IdStr    = BinFd.read(0x08)\r
-                ImageId  = struct.unpack('Q', IdStr)\r
-                ImageRev = struct.unpack('I', BinFd.read(0x04))\r
+                ImageId  = struct.unpack('<Q', IdStr)\r
+                ImageRev = struct.unpack('<I', BinFd.read(0x04))\r
                 BinFd.close()\r
 \r
                 HeaderFd.write("#define VPD_IMAGE_ID    0x%016X        /* '%s' */\n" % (ImageId[0], IdStr))\r