summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/engine.py5
-rw-r--r--scripts/lib/wic/help.py3
-rw-r--r--scripts/lib/wic/pluginbase.py11
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py6
4 files changed, 15 insertions, 10 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 18776fa8a0..4ccca482e7 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -290,7 +290,7 @@ class Disk:
290 290
291 def _get_part_image(self, pnum): 291 def _get_part_image(self, pnum):
292 if pnum not in self.partitions: 292 if pnum not in self.partitions:
293 raise WicError("Partition %s is not in the image") 293 raise WicError("Partition %s is not in the image" % pnum)
294 part = self.partitions[pnum] 294 part = self.partitions[pnum]
295 # check if fstype is supported 295 # check if fstype is supported
296 for fstype in self.fstypes: 296 for fstype in self.fstypes:
@@ -313,6 +313,9 @@ class Disk:
313 seek=self.partitions[pnum].start) 313 seek=self.partitions[pnum].start)
314 314
315 def dir(self, pnum, path): 315 def dir(self, pnum, path):
316 if pnum not in self.partitions:
317 raise WicError("Partition %s is not in the image" % pnum)
318
316 if self.partitions[pnum].fstype.startswith('ext'): 319 if self.partitions[pnum].fstype.startswith('ext'):
317 return exec_cmd("{} {} -R 'ls -l {}'".format(self.debugfs, 320 return exec_cmd("{} {} -R 'ls -l {}'".format(self.debugfs,
318 self._get_part_image(pnum), 321 self._get_part_image(pnum),
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 3a40fc0ea2..03d84bd1d7 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -523,7 +523,8 @@ DESCRIPTION
523 523
524 Source plugins can also be implemented and added by external 524 Source plugins can also be implemented and added by external
525 layers - any plugins found in a scripts/lib/wic/plugins/source/ 525 layers - any plugins found in a scripts/lib/wic/plugins/source/
526 directory in an external layer will also be made available. 526 or lib/wic/plugins/source/ directory in an external layer will
527 also be made available.
527 528
528 When the wic implementation needs to invoke a partition-specific 529 When the wic implementation needs to invoke a partition-specific
529 implementation, it looks for the plugin that has the same name as 530 implementation, it looks for the plugin that has the same name as
diff --git a/scripts/lib/wic/pluginbase.py b/scripts/lib/wic/pluginbase.py
index f74d6430fd..d9b4e57747 100644
--- a/scripts/lib/wic/pluginbase.py
+++ b/scripts/lib/wic/pluginbase.py
@@ -18,7 +18,7 @@ from wic.misc import get_bitbake_var
18 18
19PLUGIN_TYPES = ["imager", "source"] 19PLUGIN_TYPES = ["imager", "source"]
20 20
21SCRIPTS_PLUGIN_DIR = "scripts/lib/wic/plugins" 21SCRIPTS_PLUGIN_DIR = ["scripts/lib/wic/plugins", "lib/wic/plugins"]
22 22
23logger = logging.getLogger('wic') 23logger = logging.getLogger('wic')
24 24
@@ -38,10 +38,11 @@ class PluginMgr:
38 cls._plugin_dirs = [os.path.join(os.path.dirname(__file__), 'plugins')] 38 cls._plugin_dirs = [os.path.join(os.path.dirname(__file__), 'plugins')]
39 layers = get_bitbake_var("BBLAYERS") or '' 39 layers = get_bitbake_var("BBLAYERS") or ''
40 for layer_path in layers.split(): 40 for layer_path in layers.split():
41 path = os.path.join(layer_path, SCRIPTS_PLUGIN_DIR) 41 for script_plugin_dir in SCRIPTS_PLUGIN_DIR:
42 path = os.path.abspath(os.path.expanduser(path)) 42 path = os.path.join(layer_path, script_plugin_dir)
43 if path not in cls._plugin_dirs and os.path.isdir(path): 43 path = os.path.abspath(os.path.expanduser(path))
44 cls._plugin_dirs.insert(0, path) 44 if path not in cls._plugin_dirs and os.path.isdir(path):
45 cls._plugin_dirs.insert(0, path)
45 46
46 if ptype not in PLUGINS: 47 if ptype not in PLUGINS:
47 # load all ptype plugins 48 # load all ptype plugins
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 2441cc33ad..5148df288a 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -403,7 +403,7 @@ class PartitionedImage():
403 # Reserve a sector for EBR for every logical partition 403 # Reserve a sector for EBR for every logical partition
404 # before alignment is performed. 404 # before alignment is performed.
405 if part.type == 'logical': 405 if part.type == 'logical':
406 self.offset += 1 406 self.offset += 2
407 407
408 align_sectors = 0 408 align_sectors = 0
409 if part.align: 409 if part.align:
@@ -446,7 +446,7 @@ class PartitionedImage():
446 self.extendedpart = part.num 446 self.extendedpart = part.num
447 else: 447 else:
448 self.extended_size_sec += align_sectors 448 self.extended_size_sec += align_sectors
449 self.extended_size_sec += part.size_sec + 1 449 self.extended_size_sec += part.size_sec + 2
450 else: 450 else:
451 self.primary_part_num += 1 451 self.primary_part_num += 1
452 part.num = self.primary_part_num 452 part.num = self.primary_part_num
@@ -512,7 +512,7 @@ class PartitionedImage():
512 # add a sector at the back, so that there is enough 512 # add a sector at the back, so that there is enough
513 # room for all logical partitions. 513 # room for all logical partitions.
514 self._create_partition(self.path, "extended", 514 self._create_partition(self.path, "extended",
515 None, part.start - 1, 515 None, part.start - 2,
516 self.extended_size_sec) 516 self.extended_size_sec)
517 517
518 if part.fstype == "swap": 518 if part.fstype == "swap":