mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-07 13:23:20 +09:00
0668492728
When creating an entry, check for an expanded version of that entry, then use it instead. This allows, for example use of: u-boot { }; instead of having to write out in full: u-boot { type = "section"; u-boot-nodtb { }; u-boot-dtb { }; }; Add an implementaion of this and associated documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
# SPDX-License-Identifier: GPL-2.0+
|
|
# Copyright 2021 Google LLC
|
|
# Written by Simon Glass <sjg@chromium.org>
|
|
#
|
|
# Entry-type base class for U-Boot or SPL binary with devicetree
|
|
#
|
|
|
|
from binman.etype.section import Entry_section
|
|
|
|
class Entry_blob_phase(Entry_section):
|
|
"""Section that holds a phase binary
|
|
|
|
This is a base class that should not normally be used directly. It is used
|
|
when converting a 'u-boot' entry automatically into a 'u-boot-expanded'
|
|
entry; similarly for SPL.
|
|
"""
|
|
def __init__(self, section, etype, node, root_fname, dtb_file, bss_pad):
|
|
"""Set up a new blob for a phase
|
|
|
|
This holds an executable for a U-Boot phase, optional BSS padding and
|
|
a devicetree
|
|
|
|
Args:
|
|
section: entry_Section object for this entry's parent
|
|
etype: Type of object
|
|
node: Node defining this entry
|
|
root_fname: Root filename for the binary ('u-boot',
|
|
'spl/u-boot-spl', etc.)
|
|
dtb_file: Name of devicetree file ('u-boot.dtb', u-boot-spl.dtb',
|
|
etc.)
|
|
bss_pad: True to add BSS padding before the devicetree
|
|
"""
|
|
# Put this here to allow entry-docs and help to work without libfdt
|
|
global state
|
|
from binman import state
|
|
|
|
super().__init__(section, etype, node)
|
|
self.root_fname = root_fname
|
|
self.dtb_file = dtb_file
|
|
self.bss_pad = bss_pad
|
|
|
|
def ExpandEntries(self):
|
|
"""Create the subnodes"""
|
|
names = [self.root_fname + '-nodtb', self.root_fname + '-dtb']
|
|
if self.bss_pad:
|
|
names.insert(1, self.root_fname + '-bss-pad')
|
|
for name in names:
|
|
subnode = state.AddSubnode(self._node, name)
|
|
|
|
# Read entries again, now that we have some
|
|
self._ReadEntries()
|