1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2018 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
6 from entry import Entry
10 class Entry_fill(Entry):
11 """An entry which is filled to a particular byte value
13 Properties / Entry arguments:
14 - fill-byte: Byte to use to fill the entry
16 Note that the size property must be set since otherwise this entry does not
17 know how large it should be.
19 You can often achieve the same effect using the pad-byte property of the
20 overall image, in that the space between entries will then be padded with
21 that byte. But this entry is sometimes useful for explicitly setting the
22 byte value of a region.
24 def __init__(self, section, etype, node):
25 Entry.__init__(self, section, etype, node)
27 self.Raise("'fill' entry must have a size property")
28 self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
30 def ObtainContents(self):
31 self.SetContents(chr(self.fill_value) * self.size)