mirror of https://github.com/acidanthera/audk.git
BaseTools/BinToPcd: --offset must be 8-byte aligned
https://bugzilla.tianocore.org/show_bug.cgi?id=974 https://bugzilla.tianocore.org/show_bug.cgi?id=965 Update help to state that --offset must be 8-byte aligned. Verify that --offset is 8-byte aligned and print an error message if it is not 8-byte aligned. Cc: Yanyan Sun <yanyan.sun@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
b2e043b689
commit
8e96580999
|
@ -89,7 +89,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument("-m", "--max-size", dest = 'MaxSize', type = ValidateUnsignedInteger,
|
||||
help = "Maximum size of the PCD. Ignored with --type HII.")
|
||||
parser.add_argument("-f", "--offset", dest = 'Offset', type = ValidateUnsignedInteger,
|
||||
help = "VPD offset if --type is VPD. UEFI Variable offset if --type is HII.")
|
||||
help = "VPD offset if --type is VPD. UEFI Variable offset if --type is HII. Must be 8-byte aligned.")
|
||||
parser.add_argument("-n", "--variable-name", dest = 'VariableName',
|
||||
help = "UEFI variable name. Only used with --type HII.")
|
||||
parser.add_argument("-g", "--variable-guid", type = ValidateGuidName, dest = 'VariableGuid',
|
||||
|
@ -178,6 +178,12 @@ if __name__ == '__main__':
|
|||
Pcd = ' %s|*|%d|%s' % (args.PcdName, args.MaxSize, PcdValue)
|
||||
else:
|
||||
#
|
||||
# --offset value must be 8-byte aligned
|
||||
#
|
||||
if (args.Offset % 8) != 0:
|
||||
print 'BinToPcd: error: argument --offset must be 8-byte aligned.'
|
||||
sys.exit()
|
||||
#
|
||||
# Use the --offset value provided.
|
||||
#
|
||||
Pcd = ' %s|%d|%d|%s' % (args.PcdName, args.Offset, args.MaxSize, PcdValue)
|
||||
|
@ -194,6 +200,12 @@ if __name__ == '__main__':
|
|||
# Use UEFI Variable offset of 0 if --offset is not provided
|
||||
#
|
||||
args.Offset = 0
|
||||
#
|
||||
# --offset value must be 8-byte aligned
|
||||
#
|
||||
if (args.Offset % 8) != 0:
|
||||
print 'BinToPcd: error: argument --offset must be 8-byte aligned.'
|
||||
sys.exit()
|
||||
Pcd = ' %s|L"%s"|%s|%d|%s' % (args.PcdName, args.VariableName, args.VariableGuid, args.Offset, PcdValue)
|
||||
if args.Verbose:
|
||||
print 'BinToPcd: Convert binary file to PCD statement compatible with PCD sections'
|
||||
|
|
Loading…
Reference in New Issue