summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-09-06 05:50:46 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-09-07 08:44:57 +0800
commit7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b (patch)
tree49ae309eb22b6c799b3c8d09a81b9b2de3fce500 /BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
parentb48ec0e8ab1c881ea584ed76d2da0bac09db38ef (diff)
downloadedk2-7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b.tar.gz
edk2-7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b.tar.bz2
edk2-7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b.zip
BaseTools: refactor to remove duplicate functions
Update GenFdsGlobalVariable GetAlignment to support G. replace use of local function in Region with updated shared function. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob C Feng <bob.c.feng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py')
-rw-r--r--BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index eb106b5744..77873d36b9 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -512,14 +512,15 @@ class GenFdsGlobalVariable:
@staticmethod
def GetAlignment (AlignString):
- if AlignString is None:
+ if not AlignString:
return 0
- if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K"):
+ if AlignString.endswith('K'):
return int (AlignString.rstrip('K')) * 1024
- elif AlignString in ("1M", "2M", "4M", "8M", "16M"):
+ if AlignString.endswith('M'):
return int (AlignString.rstrip('M')) * 1024 * 1024
- else:
- return int (AlignString)
+ if AlignString.endswith('G'):
+ return int (AlignString.rstrip('G')) * 1024 * 1024 * 1024
+ return int (AlignString)
@staticmethod
def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,