mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
binman: Convert GetFdtSet() to use a dict
At present this function returns a set of device-tree filenames. It has no way of returning the actual device-tree object. Change it to a dictionary so that we can add this feature in a future patch. Also drop fdt_set since it is no-longer used. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
a8573c4c8f
commit
a8adb6dfeb
4 changed files with 23 additions and 22 deletions
|
@ -185,14 +185,16 @@ class Entry(object):
|
||||||
def GetDefaultFilename(self):
|
def GetDefaultFilename(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def GetFdtSet(self):
|
def GetFdts(self):
|
||||||
"""Get the set of device trees used by this entry
|
"""Get the device trees used by this entry
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Set containing the filename from this entry, if it is a .dtb, else
|
Empty dict, if this entry is not a .dtb, otherwise:
|
||||||
an empty set
|
Dict:
|
||||||
|
key: Filename from this entry (without the path)
|
||||||
|
value: Fdt object for this dtb, or None if not available
|
||||||
"""
|
"""
|
||||||
return set()
|
return {}
|
||||||
|
|
||||||
def ExpandEntries(self):
|
def ExpandEntries(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -32,11 +32,12 @@ class Entry_blob_dtb(Entry_blob):
|
||||||
data = self.CompressData(indata)
|
data = self.CompressData(indata)
|
||||||
return self.ProcessContentsUpdate(data)
|
return self.ProcessContentsUpdate(data)
|
||||||
|
|
||||||
def GetFdtSet(self):
|
def GetFdts(self):
|
||||||
"""Get the set of device trees used by this entry
|
"""Get the device trees used by this entry
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Set containing the filename from this entry
|
Dict:
|
||||||
|
key: Filename from this entry (without the path)
|
||||||
|
value: Fdt object for this dtb, or None if not available
|
||||||
"""
|
"""
|
||||||
fname = self.GetDefaultFilename()
|
return {self.GetDefaultFilename(): None}
|
||||||
return set([fname])
|
|
||||||
|
|
|
@ -95,11 +95,11 @@ class Entry_section(Entry):
|
||||||
entry.SetPrefix(self._name_prefix)
|
entry.SetPrefix(self._name_prefix)
|
||||||
self._entries[node.name] = entry
|
self._entries[node.name] = entry
|
||||||
|
|
||||||
def GetFdtSet(self):
|
def GetFdts(self):
|
||||||
fdt_set = set()
|
fdts = {}
|
||||||
for entry in self._entries.values():
|
for entry in self._entries.values():
|
||||||
fdt_set.update(entry.GetFdtSet())
|
fdts.update(entry.GetFdts())
|
||||||
return fdt_set
|
return fdts
|
||||||
|
|
||||||
def ProcessFdt(self, fdt):
|
def ProcessFdt(self, fdt):
|
||||||
"""Allow entries to adjust the device tree
|
"""Allow entries to adjust the device tree
|
||||||
|
|
|
@ -22,11 +22,8 @@ entry_args = {}
|
||||||
# ftest.py)
|
# ftest.py)
|
||||||
use_fake_dtb = False
|
use_fake_dtb = False
|
||||||
|
|
||||||
# Set of all device tree files references by images
|
# Dict of device trees, keyed by filename, but excluding the main one
|
||||||
fdt_set = set()
|
fdt_subset = {}
|
||||||
|
|
||||||
# Same as above, but excluding the main one
|
|
||||||
fdt_subset = set()
|
|
||||||
|
|
||||||
# The DTB which contains the full image information
|
# The DTB which contains the full image information
|
||||||
main_dtb = None
|
main_dtb = None
|
||||||
|
@ -140,11 +137,12 @@ def Prepare(images, dtb):
|
||||||
main_dtb = dtb
|
main_dtb = dtb
|
||||||
fdt_files.clear()
|
fdt_files.clear()
|
||||||
fdt_files['u-boot.dtb'] = dtb
|
fdt_files['u-boot.dtb'] = dtb
|
||||||
fdt_subset = set()
|
fdt_subset = {}
|
||||||
if not use_fake_dtb:
|
if not use_fake_dtb:
|
||||||
for image in images.values():
|
for image in images.values():
|
||||||
fdt_subset.update(image.GetFdtSet())
|
fdt_subset.update(image.GetFdts())
|
||||||
fdt_subset.discard('u-boot.dtb')
|
if 'u-boot.dtb' in fdt_subset:
|
||||||
|
del fdt_subset['u-boot.dtb']
|
||||||
for other_fname in fdt_subset:
|
for other_fname in fdt_subset:
|
||||||
infile = tools.GetInputFilename(other_fname)
|
infile = tools.GetInputFilename(other_fname)
|
||||||
other_fname_dtb = fdt_util.EnsureCompiled(infile)
|
other_fname_dtb = fdt_util.EnsureCompiled(infile)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue