diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 553: Fixes problem where lmc fails to create images when the hwpack doesn't provide a valid dtbfile

Message ID 20120829073810.9443.33736.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Deepti B. Kalakeri Aug. 29, 2012, 7:38 a.m. UTC
Merge authors:
  Ricardo Salveti (rsalveti)
Related merge proposals:
  https://code.launchpad.net/~rsalveti/linaro-image-tools/check-argument-before-use-boot-files/+merge/121356
  proposed by: Ricardo Salveti (rsalveti)
  review: Approve - Deepti B. Kalakeri (deeptik)
------------------------------------------------------------
revno: 553 [merge]
fixes bug: https://launchpad.net/bugs/1042011
committer: Deepti B. Kalakeri <deepti.kalakeri@linaro.org>
branch nick: linaro-image-tools
timestamp: Wed 2012-08-29 13:06:37 +0530
message:
  Fixes problem where lmc fails to create images when the hwpack doesn't provide a valid dtbfile
modified:
  linaro_image_tools/media_create/boards.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py	2012-08-05 09:22:09 +0000
+++ linaro_image_tools/media_create/boards.py	2012-08-27 00:51:26 +0000
@@ -835,22 +835,27 @@ 
 
     @classmethod
     def _get_kflavor_files_v2(cls, path):
-        kernel = _get_file_matching(os.path.join(path, cls.vmlinuz))
-        if kernel is not None:
-            logger = logging.getLogger("linaro_image_tools")
+        kernel = initrd = dtb = None
+        logger = logging.getLogger("linaro_image_tools")
+
+        if cls.vmlinuz:
+            kernel = _get_file_matching(os.path.join(path, cls.vmlinuz))
+        if not cls.vmlinuz or not kernel:
+            raise ValueError("Unable to find a valid kernel image.")
+
+        if cls.initrd:
             initrd = _get_file_matching(os.path.join(path, cls.initrd))
-            if initrd is None:
-                logger.warn(
-                    "Could not find a valid initrd, skipping uInitd.")
+        if not cls.initrd or not initrd:
+            logger.warn("Could not find a valid initrd, skipping uInitd.")
+
+        if cls.dtb_file:
             dtb = _get_file_matching(os.path.join(path, cls.dtb_file))
-            if dtb is None and cls.dtb_file is not None:
-                logger.warn(
-                    "Could not find a valid dtb file, skipping it.")
-            logger.info("Will use kernel=%s, initrd=%s, dtb=%s." % \
+        if not cls.dtb_file or not dtb:
+            logger.warn("Could not find a valid dtb file, skipping it.")
+
+        logger.info("Will use kernel=%s, initrd=%s, dtb=%s." % \
                              (kernel, initrd, dtb))
-            return (kernel, initrd, dtb)
-        raise ValueError(
-            "No kernel found matching %s." % (cls.vmlinuz))
+        return (kernel, initrd, dtb)
 
     @classmethod
     def populate_raw_partition(cls, media, boot_dir):