blob_phase.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. from binman.etype.section import Entry_section
  8. class Entry_blob_phase(Entry_section):
  9. """Section that holds a phase binary
  10. This is a base class that should not normally be used directly. It is used
  11. when converting a 'u-boot' entry automatically into a 'u-boot-expanded'
  12. entry; similarly for SPL.
  13. """
  14. def __init__(self, section, etype, node, root_fname, dtb_file, bss_pad):
  15. """Set up a new blob for a phase
  16. This holds an executable for a U-Boot phase, optional BSS padding and
  17. a devicetree
  18. Args:
  19. section: entry_Section object for this entry's parent
  20. etype: Type of object
  21. node: Node defining this entry
  22. root_fname: Root filename for the binary ('u-boot',
  23. 'spl/u-boot-spl', etc.)
  24. dtb_file: Name of devicetree file ('u-boot.dtb', u-boot-spl.dtb',
  25. etc.)
  26. bss_pad: True to add BSS padding before the devicetree
  27. """
  28. # Put this here to allow entry-docs and help to work without libfdt
  29. global state
  30. from binman import state
  31. super().__init__(section, etype, node)
  32. self.root_fname = root_fname
  33. self.dtb_file = dtb_file
  34. self.bss_pad = bss_pad
  35. def ExpandEntries(self):
  36. """Create the subnodes"""
  37. names = [self.root_fname + '-nodtb', self.root_fname + '-dtb']
  38. if self.bss_pad:
  39. names.insert(1, self.root_fname + '-bss-pad')
  40. for name in names:
  41. subnode = state.AddSubnode(self._node, name)
  42. # Read entries again, now that we have some
  43. self._ReadEntries()