]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: bootimg-partition: Select a preferred type if multi kernel images are installed
authorKevin Hao <kexin.hao@windriver.com>
Mon, 20 Aug 2018 10:42:25 +0000 (18:42 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 21 Aug 2018 13:49:34 +0000 (14:49 +0100)
Automatically select one kernel type image based on a predefined
precedence list if there are multi kernel images installed.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/plugins/source/bootimg-partition.py

index 2e9b9f5ed657fb8752dcd1fac6b18dcb42fbfe25..ddc880be366f4e355c1c402a84f52357a071f29a 100644 (file)
@@ -130,24 +130,28 @@ class BootimgPartitionPlugin(SourcePlugin):
 
         if not custom_cfg:
             # The kernel types supported by the sysboot of u-boot
-            kernel_types = ["uImage", "zImage", "Image", "vmlinux", "fitImage"]
+            kernel_types = ["zImage", "Image", "fitImage", "uImage", "vmlinux"]
             has_dtb = False
             fdt_dir = '/'
             kernel_name = None
-            for task in cls.install_task:
-                src, dst = task
-                # Find the kernel image name
-                for image in kernel_types:
+
+            # Find the kernel image name, from the highest precedence to lowest
+            for image in kernel_types:
+                for task in cls.install_task:
+                    src, dst = task
                     if re.match(image, src):
-                        if not kernel_name:
-                            kernel_name = os.path.join('/', dst)
-                        else:
-                            raise WicError('Multi kernel file founded')
+                        kernel_name = os.path.join('/', dst)
+                        break
+                if kernel_name:
+                    break
 
+            for task in cls.install_task:
+                src, dst = task
                 # We suppose that all the dtb are in the same directory
                 if re.search(r'\.dtb', src) and fdt_dir == '/':
                     has_dtb = True
                     fdt_dir = os.path.join(fdt_dir, os.path.dirname(dst))
+                    break
 
             if not kernel_name:
                 raise WicError('No kernel file founded')