xref: /openbmc/u-boot/tools/binman/etype/blob_dtb.py (revision 25fde1c0)
1# SPDX-License-Identifier: GPL-2.0+
2# Copyright (c) 2018 Google, Inc
3# Written by Simon Glass <sjg@chromium.org>
4#
5# Entry-type module for U-Boot device tree files
6#
7
8import state
9
10from entry import Entry
11from blob import Entry_blob
12
13class Entry_blob_dtb(Entry_blob):
14    """A blob that holds a device tree
15
16    This is a blob containing a device tree. The contents of the blob are
17    obtained from the list of available device-tree files, managed by the
18    'state' module.
19    """
20    def __init__(self, section, etype, node):
21        Entry_blob.__init__(self, section, etype, node)
22
23    def ObtainContents(self):
24        """Get the device-tree from the list held by the 'state' module"""
25        self._filename = self.GetDefaultFilename()
26        self._pathname, data = state.GetFdtContents(self._filename)
27        self.SetContents(data)
28        return True
29
30    def ProcessContents(self):
31        """Re-read the DTB contents so that we get any calculated properties"""
32        _, data = state.GetFdtContents(self._filename)
33        self.SetContents(data)
34