u-boot-brain/tools/binman/etype/blob_ext.py
Simon Glass 4f9f1056ec binman: Allow external binaries to be missing
Sometimes it is useful to build an image even though external binaries are
not present. This allows the build system to continue to function without
these files, albeit not producing valid images.

U-Boot does with with ATF (ARM Trusted Firmware) today.

Add a new flag to binman to request this behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-07-25 14:46:57 -06:00

39 lines
1.2 KiB
Python

# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# Entry-type module for external blobs, not built by U-Boot
#
import os
from binman.etype.blob import Entry_blob
from dtoc import fdt_util
from patman import tools
from patman import tout
class Entry_blob_ext(Entry_blob):
"""Entry containing an externally built binary blob
Note: This should not be used by itself. It is normally used as a parent
class by other entry types.
If the file providing this blob is missing, binman can optionally ignore it
and produce a broken image with a warning.
See 'blob' for Properties / Entry arguments.
"""
def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node)
self.external = True
def ObtainContents(self):
self._filename = self.GetDefaultFilename()
self._pathname = tools.GetInputFilename(self._filename,
self.section.GetAllowMissing())
# Allow the file to be missing
if not self._pathname:
self.SetContents(b'')
return True
return super().ObtainContents()