summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorKevin Hao <kexin.hao@windriver.com>2018-08-20 18:42:25 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-21 14:49:42 +0100
commit42643285cd217cec087590f1b45632f04820caa3 (patch)
tree83b4374b107ad48c2a5f1cc2996b8448562ef4c4 /scripts/lib
parent511b7a565d1fde3712c6d2371de890290640ef78 (diff)
downloadpoky-42643285cd217cec087590f1b45632f04820caa3.tar.gz
wic: bootimg-partition: Select a preferred type if multi kernel images are installed
Automatically select one kernel type image based on a predefined precedence list if there are multi kernel images installed. (From OE-Core rev: d1d80566681d4cdc00aa3d4b5e4bcf5edb7132b7) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-partition.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 2e9b9f5ed6..ddc880be36 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -130,24 +130,28 @@ class BootimgPartitionPlugin(SourcePlugin):
130 130
131 if not custom_cfg: 131 if not custom_cfg:
132 # The kernel types supported by the sysboot of u-boot 132 # The kernel types supported by the sysboot of u-boot
133 kernel_types = ["uImage", "zImage", "Image", "vmlinux", "fitImage"] 133 kernel_types = ["zImage", "Image", "fitImage", "uImage", "vmlinux"]
134 has_dtb = False 134 has_dtb = False
135 fdt_dir = '/' 135 fdt_dir = '/'
136 kernel_name = None 136 kernel_name = None
137 for task in cls.install_task: 137
138 src, dst = task 138 # Find the kernel image name, from the highest precedence to lowest
139 # Find the kernel image name 139 for image in kernel_types:
140 for image in kernel_types: 140 for task in cls.install_task:
141 src, dst = task
141 if re.match(image, src): 142 if re.match(image, src):
142 if not kernel_name: 143 kernel_name = os.path.join('/', dst)
143 kernel_name = os.path.join('/', dst) 144 break
144 else: 145 if kernel_name:
145 raise WicError('Multi kernel file founded') 146 break
146 147
148 for task in cls.install_task:
149 src, dst = task
147 # We suppose that all the dtb are in the same directory 150 # We suppose that all the dtb are in the same directory
148 if re.search(r'\.dtb', src) and fdt_dir == '/': 151 if re.search(r'\.dtb', src) and fdt_dir == '/':
149 has_dtb = True 152 has_dtb = True
150 fdt_dir = os.path.join(fdt_dir, os.path.dirname(dst)) 153 fdt_dir = os.path.join(fdt_dir, os.path.dirname(dst))
154 break
151 155
152 if not kernel_name: 156 if not kernel_name:
153 raise WicError('No kernel file founded') 157 raise WicError('No kernel file founded')