summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/FMMT/FMMT.py2
-rw-r--r--BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py12
-rw-r--r--BaseTools/Source/Python/FMMT/core/BiosTree.py30
-rw-r--r--BaseTools/Source/Python/FMMT/core/BiosTreeNode.py8
4 files changed, 1 insertions, 51 deletions
diff --git a/BaseTools/Source/Python/FMMT/FMMT.py b/BaseTools/Source/Python/FMMT/FMMT.py
index 7505b6c..d4fa07a 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -49,7 +49,7 @@ def print_banner():
class FMMT():
def __init__(self) -> None:
- self.firmware_packet = {}
+ pass
def SetConfigFilePath(self, configfilepath:str) -> str:
os.environ['FmmtConfPath'] = os.path.abspath(configfilepath)
diff --git a/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py b/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
index 7ebe11d..9dd717c 100644
--- a/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
+++ b/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
@@ -129,7 +129,6 @@ class SectionProduct(BinaryProduct):
Section_Info.Data = Whole_Data[Rel_Offset+Section_Info.HeaderLength: Rel_Offset+Section_Info.Size]
Section_Info.DOffset = Section_Offset + Section_Info.HeaderLength + Rel_Whole_Offset
Section_Info.HOffset = Section_Offset + Rel_Whole_Offset
- Section_Info.ROffset = Rel_Offset
if Section_Info.Header.Type == 0:
break
# The final Section in parent Section does not need to add padding, else must be 4-bytes align with parent Section start offset
@@ -173,7 +172,6 @@ class FfsProduct(BinaryProduct):
Section_Info.Data = Whole_Data[Rel_Offset+Section_Info.HeaderLength: Rel_Offset+Section_Info.Size]
Section_Info.DOffset = Section_Offset + Section_Info.HeaderLength + Rel_Whole_Offset
Section_Info.HOffset = Section_Offset + Rel_Whole_Offset
- Section_Info.ROffset = Rel_Offset
if Section_Info.Header.Type == 0:
break
# The final Section in Ffs does not need to add padding, else must be 4-bytes align with Ffs start offset
@@ -226,7 +224,6 @@ class FvProduct(BinaryProduct):
Ffs_Tree = BIOSTREE(Ffs_Info.Name)
Ffs_Info.HOffset = Ffs_Offset + Rel_Whole_Offset
Ffs_Info.DOffset = Ffs_Offset + Ffs_Info.Header.HeaderLength + Rel_Whole_Offset
- Ffs_Info.ROffset = Rel_Offset
if Ffs_Info.Name == PADVECTOR:
Ffs_Tree.type = FFS_PAD
Ffs_Info.Data = Whole_Data[Rel_Offset+Ffs_Info.Header.HeaderLength: Rel_Offset+Ffs_Info.Size]
@@ -362,15 +359,6 @@ class FdProduct(BinaryProduct):
tmp_index += 1
return Fd_Struct
-class ElfSectionProduct(BinaryProduct):
- ## Decompress the compressed section.
- def ParserData(self, Section_Tree, whole_Data: bytes, Rel_Whole_Offset: int=0) -> None:
- pass
- def ParserSectionData(self, Section_Tree, whole_Data: bytes, Rel_Whole_Offset: int=0) -> None:
- pass
- def ParserProgramData(self, Section_Tree, whole_Data: bytes, Rel_Whole_Offset: int=0) -> None:
- pass
-
class ElfProduct(BinaryProduct):
def ParserData(self, ParTree, Whole_Data: bytes, Rel_Whole_Offset: int=0) -> None:
diff --git a/BaseTools/Source/Python/FMMT/core/BiosTree.py b/BaseTools/Source/Python/FMMT/core/BiosTree.py
index c5a7b01..d99f964 100644
--- a/BaseTools/Source/Python/FMMT/core/BiosTree.py
+++ b/BaseTools/Source/Python/FMMT/core/BiosTree.py
@@ -72,36 +72,6 @@ class BIOSTREE:
self.Child.insert(pos, newNode)
newNode.Parent = self
- # lastNode.insertRel(newNode)
- def insertRel(self, newNode) -> None:
- if self.Parent:
- parentTree = self.Parent
- new_index = parentTree.Child.index(self) + 1
- parentTree.Child.insert(new_index, newNode)
- self.NextRel = newNode
- newNode.LastRel = self
-
- def deleteNode(self, deletekey: str) -> None:
- FindStatus, DeleteTree = self.FindNode(deletekey)
- if FindStatus:
- parentTree = DeleteTree.Parent
- lastTree = DeleteTree.LastRel
- nextTree = DeleteTree.NextRel
- if parentTree:
- index = parentTree.Child.index(DeleteTree)
- del parentTree.Child[index]
- if lastTree and nextTree:
- lastTree.NextRel = nextTree
- nextTree.LastRel = lastTree
- elif lastTree:
- lastTree.NextRel = None
- elif nextTree:
- nextTree.LastRel = None
- return DeleteTree
- else:
- logger.error('Could not find the target tree')
- return None
-
def FindNode(self, key: str, Findlist: list) -> None:
if self.key == key or (self.Data and self.Data.Name == key) or (self.type == FFS_TREE and self.Data.UiName == key):
Findlist.append(self)
diff --git a/BaseTools/Source/Python/FMMT/core/BiosTreeNode.py b/BaseTools/Source/Python/FMMT/core/BiosTreeNode.py
index 5ca4c20..92611f8 100644
--- a/BaseTools/Source/Python/FMMT/core/BiosTreeNode.py
+++ b/BaseTools/Source/Python/FMMT/core/BiosTreeNode.py
@@ -60,7 +60,6 @@ class ElfNode:
self.HeaderLength = len(struct2stream(self.Header))
self.HOffset = 0
self.DOffset = 0
- self.ROffset = 0
self.Data = b''
self.PadData = b''
self.Upld_Info_Align = False
@@ -122,7 +121,6 @@ class FvNode:
self.HeaderLength = self.Header.HeaderLength
self.HOffset = 0
self.DOffset = 0
- self.ROffset = 0
self.Data = b''
if self.Header.Signature != 1213613663:
logger.error('Invalid Fv Header! Fv {} signature {} is not "_FVH".'.format(struct2stream(self.Header), self.Header.Signature))
@@ -179,10 +177,8 @@ class FfsNode:
self.HeaderLength = self.Header.HeaderLength
self.HOffset = 0
self.DOffset = 0
- self.ROffset = 0
self.Data = b''
self.PadData = b''
- self.SectionMaxAlignment = SECTION_COMMON_ALIGNMENT # 4-align
def ModCheckSum(self) -> None:
HeaderData = struct2stream(self.Header)
@@ -217,13 +213,10 @@ class SectionNode:
self.Type = self.Header.Type
self.HOffset = 0
self.DOffset = 0
- self.ROffset = 0
self.Data = b''
self.OriData = b''
- self.OriHeader = b''
self.PadData = b''
self.IsPadSection = False
- self.SectionMaxAlignment = SECTION_COMMON_ALIGNMENT # 4-align
def GetExtHeader(self, Type: int, buffer: bytes, nums: int=0) -> None:
if Type == 0x01:
@@ -244,5 +237,4 @@ class FreeSpaceNode:
self.Size = len(buffer)
self.HOffset = 0
self.DOffset = 0
- self.ROffset = 0
self.PadData = b''