dtb_item.Flush()
return images
+def CheckForProblems(image):
+ """Check for problems with image generation
+
+ Shows warning about missing, faked or optional external blobs, as well as
+ missing bintools.
+
+ Args:
+ image (Image): Image to process
+
+ Returns:
+ bool: True if there are any problems which result in a non-functional
+ image
+ """
+ missing_list = []
+ image.CheckMissing(missing_list)
+ if missing_list:
+ tout.error("Image '%s' is missing external blobs and is non-functional: %s\n" %
+ (image.name, ' '.join([e.name for e in missing_list])))
+ _ShowHelpForMissingBlobs(tout.ERROR, missing_list)
+
+ faked_list = []
+ image.CheckFakedBlobs(faked_list)
+ if faked_list:
+ tout.warning(
+ "Image '%s' has faked external blobs and is non-functional: %s\n" %
+ (image.name, ' '.join([os.path.basename(e.GetDefaultFilename())
+ for e in faked_list])))
+
+ optional_list = []
+ image.CheckOptional(optional_list)
+ if optional_list:
+ tout.warning(
+ "Image '%s' is missing optional external blobs but is still functional: %s\n" %
+ (image.name, ' '.join([e.name for e in optional_list])))
+ _ShowHelpForMissingBlobs(tout.WARNING, optional_list)
+
+ missing_bintool_list = []
+ image.check_missing_bintools(missing_bintool_list)
+ if missing_bintool_list:
+ tout.warning(
+ "Image '%s' has missing bintools and is non-functional: %s\n" %
+ (image.name, ' '.join([os.path.basename(bintool.name)
+ for bintool in missing_bintool_list])))
+ return any([missing_list, faked_list, missing_bintool_list])
def ProcessImage(image, update_fdt, write_map, get_contents=True,
allow_resize=True, allow_missing=False,
if write_map:
image.WriteMap()
- missing_list = []
- image.CheckMissing(missing_list)
- if missing_list:
- tout.error("Image '%s' is missing external blobs and is non-functional: %s\n" %
- (image.name, ' '.join([e.name for e in missing_list])))
- _ShowHelpForMissingBlobs(tout.ERROR, missing_list)
-
- faked_list = []
- image.CheckFakedBlobs(faked_list)
- if faked_list:
- tout.warning(
- "Image '%s' has faked external blobs and is non-functional: %s\n" %
- (image.name, ' '.join([os.path.basename(e.GetDefaultFilename())
- for e in faked_list])))
-
- optional_list = []
- image.CheckOptional(optional_list)
- if optional_list:
- tout.warning(
- "Image '%s' is missing optional external blobs but is still functional: %s\n" %
- (image.name, ' '.join([e.name for e in optional_list])))
- _ShowHelpForMissingBlobs(tout.WARNING, optional_list)
-
- missing_bintool_list = []
- image.check_missing_bintools(missing_bintool_list)
- if missing_bintool_list:
- tout.warning(
- "Image '%s' has missing bintools and is non-functional: %s\n" %
- (image.name, ' '.join([os.path.basename(bintool.name)
- for bintool in missing_bintool_list])))
- return any([missing_list, faked_list, missing_bintool_list])
-
+ has_problems = CheckForProblems(image)
+ return has_problems
def Binman(args):
"""The main control code for binman