summaryrefslogtreecommitdiff
path: root/tools/binman/etype
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:24 -0600
committerSimon Glass <sjg@chromium.org>2018-09-28 11:09:01 -0600
commit6ed45ba0a831393ab6c5d3355384238d2b4f47da (patch)
treebed509d46fc12e537b381c813b4020030a68450c /tools/binman/etype
parent93d174135ac44cbbe81c87ea564488309949e6d4 (diff)
downloadu-boot-6ed45ba0a831393ab6c5d3355384238d2b4f47da.tar.gz
binman: Support updating all device tree files
Binman currently supports updating the main device tree with things like the position of each entry. Extend this support to SPL and TPL as well, since they may need (a subset of) this information. Also adjust DTB output files to have a .out extension since this seems clearer than having a .dtb extension with 'out' in the name somwhere. Also add a few missing comments and update the DT setup code to use ReadFile and WriteFile(). Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype')
-rw-r--r--tools/binman/etype/blob_dtb.py33
-rw-r--r--tools/binman/etype/section.py3
-rw-r--r--tools/binman/etype/u_boot_dtb.py9
-rw-r--r--tools/binman/etype/u_boot_dtb_with_ucode.py8
-rw-r--r--tools/binman/etype/u_boot_spl_dtb.py6
-rw-r--r--tools/binman/etype/u_boot_tpl_dtb.py6
6 files changed, 52 insertions, 13 deletions
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
new file mode 100644
index 0000000000..cc5b4a3f76
--- /dev/null
+++ b/tools/binman/etype/blob_dtb.py
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2018 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for U-Boot device tree files
+#
+
+import state
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_blob_dtb(Entry_blob):
+ """A blob that holds a device tree
+
+ This is a blob containing a device tree. The contents of the blob are
+ obtained from the list of available device-tree files, managed by the
+ 'state' module.
+ """
+ def __init__(self, section, etype, node):
+ Entry_blob.__init__(self, section, etype, node)
+
+ def ObtainContents(self):
+ """Get the device-tree from the list held by the 'state' module"""
+ self._filename = self.GetDefaultFilename()
+ self._pathname, data = state.GetFdtContents(self._filename)
+ self.SetContents(data)
+ return True
+
+ def ProcessContents(self):
+ """Re-read the DTB contents so that we get any calculated properties"""
+ _, data = state.GetFdtContents(self._filename)
+ self.SetContents(data)
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index f5b2ed67cf..a30cc91545 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -34,6 +34,9 @@ class Entry_section(Entry):
Entry.__init__(self, section, etype, node)
self._section = bsection.Section(node.name, node)
+ def GetFdtSet(self):
+ return self._section.GetFdtSet()
+
def ProcessFdt(self, fdt):
return self._section.ProcessFdt(fdt)
diff --git a/tools/binman/etype/u_boot_dtb.py b/tools/binman/etype/u_boot_dtb.py
index fb3dd1cf64..6263c4ebee 100644
--- a/tools/binman/etype/u_boot_dtb.py
+++ b/tools/binman/etype/u_boot_dtb.py
@@ -6,9 +6,9 @@
#
from entry import Entry
-from blob import Entry_blob
+from blob_dtb import Entry_blob_dtb
-class Entry_u_boot_dtb(Entry_blob):
+class Entry_u_boot_dtb(Entry_blob_dtb):
"""U-Boot device tree
Properties / Entry arguments:
@@ -17,9 +17,12 @@ class Entry_u_boot_dtb(Entry_blob):
This is the U-Boot device tree, containing configuration information for
U-Boot. U-Boot needs this to know what devices are present and which drivers
to activate.
+
+ Note: This is mostly an internal entry type, used by others. This allows
+ binman to know which entries contain a device tree.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ Entry_blob_dtb.__init__(self, section, etype, node)
def GetDefaultFilename(self):
return 'u-boot.dtb'
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 3fab766011..73f5fbf903 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -6,11 +6,11 @@
#
from entry import Entry
-from blob import Entry_blob
+from blob_dtb import Entry_blob_dtb
import state
import tools
-class Entry_u_boot_dtb_with_ucode(Entry_blob):
+class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
"""A U-Boot device tree file, with the microcode removed
Properties / Entry arguments:
@@ -25,7 +25,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob):
it available to u_boot_ucode.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ Entry_blob_dtb.__init__(self, section, etype, node)
self.ucode_data = ''
self.collate = False
self.ucode_offset = None
@@ -69,7 +69,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob):
def ObtainContents(self):
# Call the base class just in case it does something important.
- Entry_blob.ObtainContents(self)
+ Entry_blob_dtb.ObtainContents(self)
self._pathname = state.GetFdtPath(self._filename)
self.ReadBlobContents()
if self.ucode:
diff --git a/tools/binman/etype/u_boot_spl_dtb.py b/tools/binman/etype/u_boot_spl_dtb.py
index cb29ba3fd8..e7354646f1 100644
--- a/tools/binman/etype/u_boot_spl_dtb.py
+++ b/tools/binman/etype/u_boot_spl_dtb.py
@@ -6,9 +6,9 @@
#
from entry import Entry
-from blob import Entry_blob
+from blob_dtb import Entry_blob_dtb
-class Entry_u_boot_spl_dtb(Entry_blob):
+class Entry_u_boot_spl_dtb(Entry_blob_dtb):
"""U-Boot SPL device tree
Properties / Entry arguments:
@@ -19,7 +19,7 @@ class Entry_u_boot_spl_dtb(Entry_blob):
to activate.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ Entry_blob_dtb.__init__(self, section, etype, node)
def GetDefaultFilename(self):
return 'spl/u-boot-spl.dtb'
diff --git a/tools/binman/etype/u_boot_tpl_dtb.py b/tools/binman/etype/u_boot_tpl_dtb.py
index 9c4e668347..bdeb0f75a2 100644
--- a/tools/binman/etype/u_boot_tpl_dtb.py
+++ b/tools/binman/etype/u_boot_tpl_dtb.py
@@ -6,9 +6,9 @@
#
from entry import Entry
-from blob import Entry_blob
+from blob_dtb import Entry_blob_dtb
-class Entry_u_boot_tpl_dtb(Entry_blob):
+class Entry_u_boot_tpl_dtb(Entry_blob_dtb):
"""U-Boot TPL device tree
Properties / Entry arguments:
@@ -19,7 +19,7 @@ class Entry_u_boot_tpl_dtb(Entry_blob):
to activate.
"""
def __init__(self, section, etype, node):
- Entry_blob.__init__(self, section, etype, node)
+ Entry_blob_dtb.__init__(self, section, etype, node)
def GetDefaultFilename(self):
return 'tpl/u-boot-tpl.dtb'