1# SPDX-License-Identifier: GPL-2.0+ 2# Copyright 2021 Google LLC 3# Written by Simon Glass <sjg@chromium.org> 4# 5# Entry-type base class for U-Boot or SPL binary with devicetree 6# 7 8from binman.etype.section import Entry_section 9 10# This is imported if needed 11state = None 12 13class Entry_blob_phase(Entry_section): 14 """Section that holds a phase binary 15 16 This is a base class that should not normally be used directly. It is used 17 when converting a 'u-boot' entry automatically into a 'u-boot-expanded' 18 entry; similarly for SPL. 19 """ 20 def __init__(self, section, etype, node, root_fname, dtb_file, bss_pad): 21 """Set up a new blob for a phase 22 23 This holds an executable for a U-Boot phase, optional BSS padding and 24 a devicetree 25 26 Args: 27 section: entry_Section object for this entry's parent 28 etype: Type of object 29 node: Node defining this entry 30 root_fname: Root filename for the binary ('u-boot', 31 'spl/u-boot-spl', etc.) 32 dtb_file: Name of devicetree file ('u-boot.dtb', u-boot-spl.dtb', 33 etc.) 34 bss_pad: True to add BSS padding before the devicetree 35 """ 36 # Put this here to allow entry-docs and help to work without libfdt 37 global state 38 from binman import state 39 40 super().__init__(section, etype, node) 41 self.root_fname = root_fname 42 self.dtb_file = dtb_file 43 self.bss_pad = bss_pad 44 45 def gen_entries(self): 46 """Create the subnodes""" 47 names = [self.root_fname + '-nodtb', self.root_fname + '-dtb'] 48 if self.bss_pad: 49 names.insert(1, self.root_fname + '-bss-pad') 50 for name in names: 51 subnode = state.AddSubnode(self._node, name) 52 53 # Read entries again, now that we have some 54 self.ReadEntries() 55