It is useful to be able to split an image into multiple sections, each with its own size and position, for cases where a flash device has read-only and read-write portions. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>lime2-spi
parent
badf0ec6e4
commit
1854695bd8
@ -0,0 +1,50 @@ |
||||
# SPDX-License-Identifier: GPL-2.0+ |
||||
# Copyright (c) 2018 Google, Inc |
||||
# Written by Simon Glass <sjg@chromium.org> |
||||
# |
||||
# Entry-type module for sections, which are entries which can contain other |
||||
# entries. |
||||
# |
||||
|
||||
from entry import Entry |
||||
import fdt_util |
||||
import tools |
||||
|
||||
import bsection |
||||
|
||||
class Entry_section(Entry): |
||||
def __init__(self, image, etype, node): |
||||
Entry.__init__(self, image, etype, node) |
||||
self._section = bsection.Section(node.name, node) |
||||
|
||||
def ObtainContents(self): |
||||
self._section.GetEntryContents() |
||||
|
||||
def GetData(self): |
||||
return self._section.GetData() |
||||
|
||||
def GetPositions(self): |
||||
"""Handle entries that want to set the position/size of other entries |
||||
|
||||
This calls each entry's GetPositions() method. If it returns a list |
||||
of entries to update, it updates them. |
||||
""" |
||||
self._section.GetEntryPositions() |
||||
return {} |
||||
|
||||
def Pack(self, pos): |
||||
"""Pack all entries into the section""" |
||||
self._section.PackEntries() |
||||
self.size = self._section.CheckSize() |
||||
return super(Entry_section, self).Pack(pos) |
||||
|
||||
def WriteSymbols(self, section): |
||||
"""Write symbol values into binary files for access at run time""" |
||||
self._section.WriteSymbols() |
||||
|
||||
def ProcessContents(self): |
||||
self._section.ProcessEntryContents() |
||||
super(Entry_section, self).ProcessContents() |
||||
|
||||
def CheckPosition(self): |
||||
self._section.CheckEntries() |
@ -0,0 +1,28 @@ |
||||
// SPDX-License-Identifier: GPL-2.0+ |
||||
|
||||
/dts-v1/; |
||||
|
||||
/ { |
||||
#address-cells = <1>; |
||||
#size-cells = <1>; |
||||
|
||||
binman { |
||||
pad-byte = <0x26>; |
||||
size = <0x28>; |
||||
section@0 { |
||||
read-only; |
||||
size = <0x10>; |
||||
pad-byte = <0x21>; |
||||
|
||||
u-boot { |
||||
}; |
||||
}; |
||||
section@1 { |
||||
size = <0x10>; |
||||
pad-byte = <0x61>; |
||||
|
||||
u-boot { |
||||
}; |
||||
}; |
||||
}; |
||||
}; |
Loading…
Reference in new issue