summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/source/bootimg-partition.py
diff options
context:
space:
mode:
authorMarcus Folkesson <marcus.folkesson@gmail.com>2024-07-10 10:53:09 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-07-23 11:17:11 +0100
commitd045fed31acd3f31fbe99815204e8540dc5f6846 (patch)
treee1a9bc7b27c386a65c6d35cd06086cd1fe2feb85 /scripts/lib/wic/plugins/source/bootimg-partition.py
parent28fd497a26bdcc12d952f81436a6d873d81cd462 (diff)
downloadpoky-d045fed31acd3f31fbe99815204e8540dc5f6846.tar.gz
bootimg-partition: break out code to a common library.
Break out the code that parse IMAGE_BOOT_FILES to a common library. (From OE-Core rev: 1e07fe51bdb24070308c85e83df0b80ab9f83cea) Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Konrad Weihmann <kweihmann@outlook.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-partition.py')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-partition.py39
1 files changed, 2 insertions, 37 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 1071d1af3f..589853a439 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -16,7 +16,7 @@ import logging
16import os 16import os
17import re 17import re
18 18
19from glob import glob 19from oe.bootfiles import get_boot_files
20 20
21from wic import WicError 21from wic import WicError
22from wic.engine import get_custom_config 22from wic.engine import get_custom_config
@@ -66,42 +66,7 @@ class BootimgPartitionPlugin(SourcePlugin):
66 66
67 logger.debug('Boot files: %s', boot_files) 67 logger.debug('Boot files: %s', boot_files)
68 68
69 # list of tuples (src_name, dst_name) 69 cls.install_task = get_boot_files(kernel_dir, boot_files)
70 deploy_files = []
71 for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files):
72 if ';' in src_entry:
73 dst_entry = tuple(src_entry.split(';'))
74 if not dst_entry[0] or not dst_entry[1]:
75 raise WicError('Malformed boot file entry: %s' % src_entry)
76 else:
77 dst_entry = (src_entry, src_entry)
78
79 logger.debug('Destination entry: %r', dst_entry)
80 deploy_files.append(dst_entry)
81
82 cls.install_task = [];
83 for deploy_entry in deploy_files:
84 src, dst = deploy_entry
85 if '*' in src:
86 # by default install files under their basename
87 entry_name_fn = os.path.basename
88 if dst != src:
89 # unless a target name was given, then treat name
90 # as a directory and append a basename
91 entry_name_fn = lambda name: \
92 os.path.join(dst,
93 os.path.basename(name))
94
95 srcs = glob(os.path.join(kernel_dir, src))
96
97 logger.debug('Globbed sources: %s', ', '.join(srcs))
98 for entry in srcs:
99 src = os.path.relpath(entry, kernel_dir)
100 entry_dst_name = entry_name_fn(entry)
101 cls.install_task.append((src, entry_dst_name))
102 else:
103 cls.install_task.append((src, dst))
104
105 if source_params.get('loader') != "u-boot": 70 if source_params.get('loader') != "u-boot":
106 return 71 return
107 72