binman: add support for creating dummy files for external blobs

While converting to binman for an imx8mq board, it has been found that
building in the u-boot CI fails. This is because an imx8mq requires an
external binary (signed_hdmi_imx8m.bin). If this file cannot be found
mkimage fails.
To be able to build this board in the u-boot CI a binman option
(--fake-ext-blobs) is introduced that can be switched on via the u-boot
makefile option BINMAN_FAKE_EXT_BLOBS. With that the needed dummy files are
created.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Heiko Thiery
2022-01-06 11:49:41 +01:00
committed by Tom Rini
parent a14af7216a
commit a89c8f2111
10 changed files with 139 additions and 8 deletions

View File

@@ -479,7 +479,8 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded):
def ProcessImage(image, update_fdt, write_map, get_contents=True,
allow_resize=True, allow_missing=False):
allow_resize=True, allow_missing=False,
allow_fake_blobs=False):
"""Perform all steps for this image, including checking and # writing it.
This means that errors found with a later image will be reported after
@@ -495,12 +496,15 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True,
allow_resize: True to allow entries to change size (this does a re-pack
of the entries), False to raise an exception
allow_missing: Allow blob_ext objects to be missing
allow_fake_blobs: Allow blob_ext objects to be faked with dummy files
Returns:
True if one or more external blobs are missing, False if all are present
True if one or more external blobs are missing or faked,
False if all are present
"""
if get_contents:
image.SetAllowMissing(allow_missing)
image.SetAllowFakeBlob(allow_fake_blobs)
image.GetEntryContents()
image.GetEntryOffsets()
@@ -549,7 +553,13 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True,
tout.Warning("Image '%s' is missing external blobs and is non-functional: %s" %
(image.name, ' '.join([e.name for e in missing_list])))
_ShowHelpForMissingBlobs(missing_list)
return bool(missing_list)
faked_list = []
image.CheckFakedBlobs(faked_list)
if faked_list:
tout.Warning("Image '%s:%s' has faked external blobs and is non-functional: %s" %
(image.name, image.image_name,
' '.join([e.GetDefaultFilename() for e in faked_list])))
return bool(missing_list) or bool(faked_list)
def Binman(args):
@@ -636,13 +646,15 @@ def Binman(args):
images = PrepareImagesAndDtbs(dtb_fname, args.image,
args.update_fdt, use_expanded)
if args.test_section_timeout:
# Set the first image to timeout, used in testThreadTimeout()
images[list(images.keys())[0]].test_section_timeout = True
missing = False
invalid = False
for image in images.values():
missing |= ProcessImage(image, args.update_fdt, args.map,
allow_missing=args.allow_missing)
invalid |= ProcessImage(image, args.update_fdt, args.map,
allow_missing=args.allow_missing,
allow_fake_blobs=args.fake_ext_blobs)
# Write the updated FDTs to our output files
for dtb_item in state.GetAllFdts():
@@ -652,7 +664,7 @@ def Binman(args):
data = state.GetFdtForEtype('u-boot-dtb').GetContents()
elf.UpdateFile(*elf_params, data)
if missing:
if invalid:
tout.Warning("\nSome images are invalid")
# Use this to debug the time take to pack the image