diff options
author | Yuwei Chen <yuwei.chen@intel.com> | 2023-06-29 11:35:19 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-12-11 10:12:52 +0000 |
commit | b5f5106c1e2fb027776a88178fab844f81930b59 (patch) | |
tree | 0cad71458dec5be6562d61dc59e91577ae9f6b8e /BaseTools | |
parent | bb13a4adabcf0e5a1608583c386472773dca5726 (diff) | |
download | edk2-b5f5106c1e2fb027776a88178fab844f81930b59.tar.gz edk2-b5f5106c1e2fb027776a88178fab844f81930b59.tar.bz2 edk2-b5f5106c1e2fb027776a88178fab844f81930b59.zip |
BaseTools: FMMT replace new free space fixing in replace
In FMMT replace function, when newffs size <= targetffs size,
the new free space is calculated wrong as loss the pad data delta size.
That will cause invalid binary generated.
This patch fixes this issue.
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/FMMT/core/FvHandler.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py b/BaseTools/Source/Python/FMMT/core/FvHandler.py index ff3d637623..058b29321f 100644 --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py @@ -442,7 +442,7 @@ class FvHandler: # Start free space calculating and moving process.
self.ModifyTest(TargetFv.Parent, Needed_Space)
else:
- New_Free_Space = self.TargetFfs.Data.Size - self.NewFfs.Data.Size
+ New_Free_Space = self.TargetFfs.Data.Size + len(self.TargetFfs.Data.PadData) - self.NewFfs.Data.Size - len(self.NewFfs.Data.PadData)
# If TargetFv already have free space, move the new free space into it.
if TargetFv.Data.Free_Space:
TargetFv.Child[-1].Data.Data += b'\xff' * New_Free_Space
|