summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/source/bootimg-partition.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-partition.py')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-partition.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index e0d9a50585..b4869154fe 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -23,15 +23,18 @@
23# Maciej Borzecki <maciej.borzecki (at] open-rnd.pl> 23# Maciej Borzecki <maciej.borzecki (at] open-rnd.pl>
24# 24#
25 25
26import logging
26import os 27import os
27import re 28import re
29import sys
28 30
29from glob import glob 31from glob import glob
30 32
31from wic import msger
32from wic.pluginbase import SourcePlugin 33from wic.pluginbase import SourcePlugin
33from wic.utils.misc import exec_cmd, get_bitbake_var 34from wic.utils.misc import exec_cmd, get_bitbake_var
34 35
36logger = logging.getLogger('wic')
37
35class BootimgPartitionPlugin(SourcePlugin): 38class BootimgPartitionPlugin(SourcePlugin):
36 """ 39 """
37 Create an image of boot partition, copying over files 40 Create an image of boot partition, copying over files
@@ -78,16 +81,18 @@ class BootimgPartitionPlugin(SourcePlugin):
78 if not bootimg_dir: 81 if not bootimg_dir:
79 bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") 82 bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
80 if not bootimg_dir: 83 if not bootimg_dir:
81 msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") 84 logger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
85 sys.exit(1)
82 86
83 msger.debug('Bootimg dir: %s' % bootimg_dir) 87 logger.debug('Bootimg dir: %s', bootimg_dir)
84 88
85 boot_files = get_bitbake_var("IMAGE_BOOT_FILES") 89 boot_files = get_bitbake_var("IMAGE_BOOT_FILES")
86 90
87 if not boot_files: 91 if not boot_files:
88 msger.error('No boot files defined, IMAGE_BOOT_FILES unset') 92 logger.error('No boot files defined, IMAGE_BOOT_FILES unset')
93 sys.exit(1)
89 94
90 msger.debug('Boot files: %s' % boot_files) 95 logger.debug('Boot files: %s', boot_files)
91 96
92 # list of tuples (src_name, dst_name) 97 # list of tuples (src_name, dst_name)
93 deploy_files = [] 98 deploy_files = []
@@ -95,11 +100,12 @@ class BootimgPartitionPlugin(SourcePlugin):
95 if ';' in src_entry: 100 if ';' in src_entry:
96 dst_entry = tuple(src_entry.split(';')) 101 dst_entry = tuple(src_entry.split(';'))
97 if not dst_entry[0] or not dst_entry[1]: 102 if not dst_entry[0] or not dst_entry[1]:
98 msger.error('Malformed boot file entry: %s' % (src_entry)) 103 logger.error('Malformed boot file entry: %s', src_entry)
104 sys.exit(1)
99 else: 105 else:
100 dst_entry = (src_entry, src_entry) 106 dst_entry = (src_entry, src_entry)
101 107
102 msger.debug('Destination entry: %r' % (dst_entry,)) 108 logger.debug('Destination entry: %r', dst_entry)
103 deploy_files.append(dst_entry) 109 deploy_files.append(dst_entry)
104 110
105 for deploy_entry in deploy_files: 111 for deploy_entry in deploy_files:
@@ -117,7 +123,7 @@ class BootimgPartitionPlugin(SourcePlugin):
117 123
118 srcs = glob(os.path.join(bootimg_dir, src)) 124 srcs = glob(os.path.join(bootimg_dir, src))
119 125
120 msger.debug('Globbed sources: %s' % (', '.join(srcs))) 126 logger.debug('Globbed sources: %s', ', '.join(srcs))
121 for entry in srcs: 127 for entry in srcs:
122 entry_dst_name = entry_name_fn(entry) 128 entry_dst_name = entry_name_fn(entry)
123 install_task.append((entry, 129 install_task.append((entry,
@@ -129,12 +135,12 @@ class BootimgPartitionPlugin(SourcePlugin):
129 135
130 for task in install_task: 136 for task in install_task:
131 src_path, dst_path = task 137 src_path, dst_path = task
132 msger.debug('Install %s as %s' % (os.path.basename(src_path), 138 logger.debug('Install %s as %s',
133 dst_path)) 139 os.path.basename(src_path), dst_path)
134 install_cmd = "install -m 0644 -D %s %s" \ 140 install_cmd = "install -m 0644 -D %s %s" \
135 % (src_path, dst_path) 141 % (src_path, dst_path)
136 exec_cmd(install_cmd) 142 exec_cmd(install_cmd)
137 143
138 msger.debug('Prepare boot partition using rootfs in %s' % (hdddir)) 144 logger.debug('Prepare boot partition using rootfs in %s', hdddir)
139 part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, 145 part.prepare_rootfs(cr_workdir, oe_builddir, hdddir,
140 native_sysroot) 146 native_sysroot)