diff options
author | Chen, Christine <Yuwei.Chen@intel.com> | 2022-09-16 09:50:56 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-10-19 06:32:07 +0000 |
commit | 0e6db46b1be173e7207bfadc05221a20f9b0dd02 (patch) | |
tree | fa22c572ee5c6e373d6dae753f67ee6a2122e7ef /BaseTools/Source/Python/FMMT/core/FvHandler.py | |
parent | b03dceb87f400e2e5437f775427fab5338532ee7 (diff) | |
download | edk2-0e6db46b1be173e7207bfadc05221a20f9b0dd02.tar.gz edk2-0e6db46b1be173e7207bfadc05221a20f9b0dd02.tar.bz2 edk2-0e6db46b1be173e7207bfadc05221a20f9b0dd02.zip |
BaseTools/FMMT: Add Extract FV function
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3938
With this patch "-e" parameter supports extract FV function.
Usage: FMMT -e Inputfile TargetFv Outputfile
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/FMMT/core/FvHandler.py')
-rw-r--r-- | BaseTools/Source/Python/FMMT/core/FvHandler.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py b/BaseTools/Source/Python/FMMT/core/FvHandler.py index c81541ec18..e8b8480098 100644 --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py @@ -155,7 +155,6 @@ class FvHandler: def CompressData(self, TargetTree) -> None:
TreePath = TargetTree.GetTreePath()
pos = len(TreePath)
- self.Status = False
while pos:
if not self.Status:
if TreePath[pos-1].type == SECTION_TREE and TreePath[pos-1].Data.Type == 0x02:
@@ -487,7 +486,6 @@ class FvHandler: ~self.NewFfs.Data.Header.State)
# If TargetFv have enough free space, just move part of the free space to NewFfs, split free space to NewFfs and new free space.
if TargetLen < 0:
- self.Status = True
self.TargetFfs.Data.Data = b'\xff' * (-TargetLen)
TargetFv.Data.Free_Space = (-TargetLen)
TargetFv.Data.ModFvExt()
@@ -498,13 +496,14 @@ class FvHandler: ModifyFfsType(self.NewFfs)
# Recompress from the Fv node to update all the related node data.
self.CompressData(TargetFv)
- elif TargetLen == 0:
self.Status = True
+ elif TargetLen == 0:
TargetFv.Child.remove(self.TargetFfs)
TargetFv.insertChild(self.NewFfs)
ModifyFfsType(self.NewFfs)
# Recompress from the Fv node to update all the related node data.
self.CompressData(TargetFv)
+ self.Status = True
# If TargetFv do not have enough free space, need move part of the free space of TargetFv's parent Fv to TargetFv/NewFfs.
else:
if TargetFv.type == FV_TREE:
|