1*ec127af0SSimon Glass# SPDX-License-Identifier: GPL-2.0+ 2*ec127af0SSimon Glass# Copyright (c) 2018 Google, Inc 3*ec127af0SSimon Glass# Written by Simon Glass <sjg@chromium.org> 4*ec127af0SSimon Glass# 5*ec127af0SSimon Glass# Entry-type module for a blob where the filename comes from a property in the 6*ec127af0SSimon Glass# node or an entry argument. The property is called '<blob_fname>-path' where 7*ec127af0SSimon Glass# <blob_fname> is provided by the subclass using this entry type. 8*ec127af0SSimon Glass 9*ec127af0SSimon Glassfrom collections import OrderedDict 10*ec127af0SSimon Glass 11*ec127af0SSimon Glassfrom blob import Entry_blob 12*ec127af0SSimon Glassfrom entry import EntryArg 13*ec127af0SSimon Glass 14*ec127af0SSimon Glass 15*ec127af0SSimon Glassclass Entry_blob_named_by_arg(Entry_blob): 16*ec127af0SSimon Glass """A blob entry which gets its filename property from its subclass 17*ec127af0SSimon Glass 18*ec127af0SSimon Glass Properties / Entry arguments: 19*ec127af0SSimon Glass - <xxx>-path: Filename containing the contents of this entry (optional, 20*ec127af0SSimon Glass defaults to 0) 21*ec127af0SSimon Glass 22*ec127af0SSimon Glass where <xxx> is the blob_fname argument to the constructor. 23*ec127af0SSimon Glass 24*ec127af0SSimon Glass This entry cannot be used directly. Instead, it is used as a parent class 25*ec127af0SSimon Glass for another entry, which defined blob_fname. This parameter is used to 26*ec127af0SSimon Glass set the entry-arg or property containing the filename. The entry-arg or 27*ec127af0SSimon Glass property is in turn used to set the actual filename. 28*ec127af0SSimon Glass 29*ec127af0SSimon Glass See cros_ec_rw for an example of this. 30*ec127af0SSimon Glass """ 31*ec127af0SSimon Glass def __init__(self, section, etype, node, blob_fname): 32*ec127af0SSimon Glass Entry_blob.__init__(self, section, etype, node) 33*ec127af0SSimon Glass self._filename, = self.GetEntryArgsOrProps( 34*ec127af0SSimon Glass [EntryArg('%s-path' % blob_fname, str)]) 35