1# SPDX-License-Identifier: GPL-2.0+ 2# Copyright 2021 Google LLC 3# Written by Simon Glass <sjg@chromium.org> 4# 5# Entry-type module for expanded U-Boot SPL binary 6# 7 8from patman import tout 9 10from binman import state 11from binman.etype.blob_phase import Entry_blob_phase 12 13class Entry_u_boot_spl_expanded(Entry_blob_phase): 14 """U-Boot SPL flat binary broken out into its component parts 15 16 Properties / Entry arguments: 17 - spl-dtb: Controls whether this entry is selected (set to 'y' or '1' to 18 select) 19 20 This is a section containing the U-Boot binary, BSS padding if needed and a 21 devicetree. Using this entry type automatically creates this section, with 22 the following entries in it: 23 24 u-boot-spl-nodtb 25 u-boot-spl-bss-pad 26 u-boot-dtb 27 28 Having the devicetree separate allows binman to update it in the final 29 image, so that the entries positions are provided to the running U-Boot. 30 31 This entry is selected based on the value of the 'spl-dtb' entryarg. If 32 this is non-empty (and not 'n' or '0') then this expanded entry is selected. 33 """ 34 def __init__(self, section, etype, node): 35 bss_pad = state.GetEntryArgBool('spl-bss-pad') 36 super().__init__(section, etype, node, 'u-boot-spl', 'u-boot-spl-dtb', 37 bss_pad) 38 39 @classmethod 40 def UseExpanded(cls, node, etype, new_etype): 41 val = state.GetEntryArgBool('spl-dtb') 42 tout.DoOutput(tout.INFO if val else tout.DETAIL, 43 "Node '%s': etype '%s': %s %sselected" % 44 (node.path, etype, new_etype, '' if val else 'not ')) 45 return val 46