summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
authorPaul Barker <pbarker@konsulko.com>2020-01-08 11:25:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-10 20:32:04 +0000
commitd4cd27a9837426e809190548a83c6c7c76505114 (patch)
tree27203bd06cc01655ea6c33ed596bce4eea4136a2 /scripts/lib/wic
parent07b6b284204e912b5d08bdd0ca51b766ab7dd9c1 (diff)
downloadopenembedded-core-contrib-d4cd27a9837426e809190548a83c6c7c76505114.tar.gz
wic: Add --include-path argument
This option adds the contents of the given path to a partition built with the rootfs source plugin. The path is relative to the directory in which wic is running not the rootfs itself so use of an absolute path is recommended. This option is most useful when multiple copies of the rootfs are added to an image and it is required to add extra content to only one of these copies. This option only has an effect with the rootfs source plugin. Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/help.py10
-rw-r--r--scripts/lib/wic/ksparser.py1
-rw-r--r--scripts/lib/wic/partition.py1
-rw-r--r--scripts/lib/wic/plugins/source/rootfs.py7
4 files changed, 17 insertions, 2 deletions
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 29c4e436d8..4d342fcf05 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -969,6 +969,16 @@ DESCRIPTION
is omitted, not the directory itself. This option only
has an effect with the rootfs source plugin.
+ --include-path: This option is specific to wic. It adds the contents
+ of the given path to the resulting image. The path is
+ relative to the directory in which wic is running not
+ the rootfs itself so use of an absolute path is
+ recommended. This option is most useful when multiple
+ copies of the rootfs are added to an image and it is
+ required to add extra content to only one of these
+ copies. This option only has an effect with the rootfs
+ source plugin.
+
--extra-space: This option is specific to wic. It adds extra
space after the space filled by the content
of the partition. The final size can go
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 6a643ba3af..707a2e8019 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -137,6 +137,7 @@ class KickStart():
part.add_argument('--active', action='store_true')
part.add_argument('--align', type=int)
part.add_argument('--exclude-path', nargs='+')
+ part.add_argument('--include-path', nargs='+')
part.add_argument("--extra-space", type=sizetype)
part.add_argument('--fsoptions', dest='fsopts')
part.add_argument('--fstype', default='vfat',
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index d809408e1a..2d95f78439 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -30,6 +30,7 @@ class Partition():
self.device = None
self.extra_space = args.extra_space
self.exclude_path = args.exclude_path
+ self.include_path = args.include_path
self.fsopts = args.fsopts
self.fstype = args.fstype
self.label = args.label
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index e26e95b991..705aeb5563 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -71,7 +71,7 @@ class RootfsPlugin(SourcePlugin):
new_rootfs = None
# Handle excluded paths.
- if part.exclude_path is not None:
+ if part.exclude_path or part.include_path:
# We need a new rootfs directory we can delete files from. Copy to
# workdir.
new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
@@ -81,7 +81,10 @@ class RootfsPlugin(SourcePlugin):
copyhardlinktree(part.rootfs_dir, new_rootfs)
- for orig_path in part.exclude_path:
+ for path in part.include_path or []:
+ copyhardlinktree(path, new_rootfs)
+
+ for orig_path in part.exclude_path or []:
path = orig_path
if os.path.isabs(path):
logger.error("Must be relative: --exclude-path=%s" % orig_path)