# value: Text for the help
missing_blob_help = {}
-def _ReadImageDesc(binman_node):
+def _ReadImageDesc(binman_node, use_expanded):
"""Read the image descriptions from the /binman node
This normally produces a single Image object called 'image'. But if
Args:
binman_node: Node object of the /binman node
+ use_expanded: True if the FDT will be updated with the entry information
Returns:
OrderedDict of Image objects, each of which describes an image
"""
images = OrderedDict()
if 'multiple-images' in binman_node.props:
for node in binman_node.subnodes:
- images[node.name] = Image(node.name, node)
+ images[node.name] = Image(node.name, node,
+ use_expanded=use_expanded)
else:
- images['image'] = Image('image', binman_node)
+ images['image'] = Image('image', binman_node, use_expanded=use_expanded)
return images
def _FindBinmanNode(dtb):
return image
-def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt):
+def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded):
"""Prepare the images to be processed and select the device tree
This function:
dtb_fname: Filename of the device tree file to use (.dts or .dtb)
selected_images: List of images to output, or None for all
update_fdt: True to update the FDT wth entry offsets, etc.
+ use_expanded: True to use expanded versions of entries, if available.
+ So if 'u-boot' is called for, we use 'u-boot-expanded' instead. This
+ is needed if update_fdt is True (although tests may disable it)
Returns:
OrderedDict of images:
raise ValueError("Device tree '%s' does not have a 'binman' "
"node" % dtb_fname)
- images = _ReadImageDesc(node)
+ images = _ReadImageDesc(node, use_expanded)
if select_images:
skip = []
elf.debug = args.debug
cbfs_util.VERBOSE = args.verbosity > 2
state.use_fake_dtb = args.fake_dtb
+
+ # Normally we replace the 'u-boot' etype with 'u-boot-expanded', etc.
+ # When running tests this can be disabled using this flag. When not
+ # updating the FDT in image, it is not needed by binman, but we use it
+ # for consistency, so that the images look the same to U-Boot at
+ # runtime.
+ use_expanded = not args.no_expanded
try:
tools.SetInputDirs(args.indir)
tools.PrepareOutputDir(args.outdir, args.preserve)
state.SetEntryArgs(args.entry_arg)
images = PrepareImagesAndDtbs(dtb_fname, args.image,
- args.update_fdt)
+ args.update_fdt, use_expanded)
missing = False
for image in images.values():
missing |= ProcessImage(image, args.update_fdt, args.map,
exception). This should be used if the Image is being loaded from
a file rather than generated. In that case we obviously don't need
the entry arguments since the contents already exists.
+ use_expanded: True if we are updating the FDT wth entry offsets, etc.
+ and should use the expanded versions of the U-Boot entries.
+ Any entry type that includes a devicetree must put it in a
+ separate entry so that it will be updated. For example. 'u-boot'
+ normally just picks up 'u-boot.bin' which includes the
+ devicetree, but this is not updateable, since it comes into
+ binman as one piece and binman doesn't know that it is actually
+ an executable followed by a devicetree. Of course it could be
+ taught this, but then when reading an image (e.g. 'binman ls')
+ it may need to be able to split the devicetree out of the image
+ in order to determine the location of things. Instead we choose
+ to ignore 'u-boot-bin' in this case, and build it ourselves in
+ binman with 'u-boot-dtb.bin' and 'u-boot.dtb'. See
+ Entry_u_boot_expanded and Entry_blob_phase for details.
"""
def __init__(self, name, node, copy_to_orig=True, test=False,
- ignore_missing=False):
+ ignore_missing=False, use_expanded=False):
super().__init__(None, 'section', node, test=test)
self.copy_to_orig = copy_to_orig
self.name = 'main-section'
self.fdtmap_data = None
self.allow_repack = False
self._ignore_missing = ignore_missing
+ self.use_expanded = use_expanded
if not test:
self.ReadNode()