summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-partition.py41
1 files changed, 32 insertions, 9 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 564118ad8b..6ba39a01f7 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -29,6 +29,7 @@ import re
29from wic import msger 29from wic import msger
30from wic.pluginbase import SourcePlugin 30from wic.pluginbase import SourcePlugin
31from wic.utils.oe.misc import * 31from wic.utils.oe.misc import *
32from glob import glob
32 33
33class BootimgPartitionPlugin(SourcePlugin): 34class BootimgPartitionPlugin(SourcePlugin):
34 name = 'bootimg-partition' 35 name = 'bootimg-partition'
@@ -87,7 +88,7 @@ class BootimgPartitionPlugin(SourcePlugin):
87 88
88 # list of tuples (src_name, dst_name) 89 # list of tuples (src_name, dst_name)
89 deploy_files = [] 90 deploy_files = []
90 for src_entry in re.findall(r'[\w;\-\./]+', boot_files): 91 for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files):
91 if ';' in src_entry: 92 if ';' in src_entry:
92 dst_entry = tuple(src_entry.split(';')) 93 dst_entry = tuple(src_entry.split(';'))
93 if not dst_entry[0] or not dst_entry[1]: 94 if not dst_entry[0] or not dst_entry[1]:
@@ -100,14 +101,36 @@ class BootimgPartitionPlugin(SourcePlugin):
100 101
101 for deploy_entry in deploy_files: 102 for deploy_entry in deploy_files:
102 src, dst = deploy_entry 103 src, dst = deploy_entry
103 src_path = os.path.join(bootimg_dir, src) 104 install_task = []
104 dst_path = os.path.join(hdddir, dst) 105 if '*' in src:
105 106 # by default install files under their basename
106 msger.debug('Install %s as %s' % (os.path.basename(src_path), 107 entry_name_fn = os.path.basename
107 dst_path)) 108 if dst != src:
108 install_cmd = "install -m 0644 -D %s %s" \ 109 # unless a target name was given, then treat name
109 % (src_path, dst_path) 110 # as a directory and append a basename
110 exec_cmd(install_cmd) 111 entry_name_fn = lambda name: \
112 os.path.join(dst,
113 os.path.basename(name))
114
115 srcs = glob(os.path.join(bootimg_dir, src))
116
117 msger.debug('Globbed sources: %s' % (', '.join(srcs)))
118 for entry in srcs:
119 entry_dst_name = entry_name_fn(entry)
120 install_task.append((entry,
121 os.path.join(hdddir,
122 entry_dst_name)))
123 else:
124 install_task = [(os.path.join(bootimg_dir, src),
125 os.path.join(hdddir, dst))]
126
127 for task in install_task:
128 src_path, dst_path = task
129 msger.debug('Install %s as %s' % (os.path.basename(src_path),
130 dst_path))
131 install_cmd = "install -m 0644 -D %s %s" \
132 % (src_path, dst_path)
133 exec_cmd(install_cmd)
111 134
112 msger.debug('Prepare boot partition using rootfs in %s' % (hdddir)) 135 msger.debug('Prepare boot partition using rootfs in %s' % (hdddir))
113 part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, 136 part.prepare_rootfs(cr_workdir, oe_builddir, hdddir,