summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMartin Hundebøll <mnhu@prevas.dk>2017-11-28 13:56:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-10 22:45:19 +0000
commit23825ed16a5b3a019b8fabab46ece2ab1f79c2b1 (patch)
treeb12c893074ead7b50d309b2f4cce50541d71c20e /scripts
parent66099defd1fcc61753eb480c3cbe57ea5a2285f5 (diff)
downloadpoky-23825ed16a5b3a019b8fabab46ece2ab1f79c2b1.tar.gz
wic: support filesystem label for rawcopy
The '--label' argument should work for '--source rawcopy' as it does for '--source rootfs', so add a method in RawCopyPlugin to update the label on the temporary filesystem images. (From OE-Core rev: 303d6ca5ae986acd2e633b0dc5e386ee7771f8ab) Signed-off-by: Martin Hundebøll <mnhu@prevas.dk> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/plugins/source/rawcopy.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index 424ed26ed6..e86398ac8f 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -32,6 +32,25 @@ class RawCopyPlugin(SourcePlugin):
32 32
33 name = 'rawcopy' 33 name = 'rawcopy'
34 34
35 @staticmethod
36 def do_image_label(fstype, dst, label):
37 if fstype.startswith('ext'):
38 cmd = 'tune2fs -L %s %s' % (label, dst)
39 elif fstype in ('msdos', 'vfat'):
40 cmd = 'dosfslabel %s %s' % (dst, label)
41 elif fstype == 'btrfs':
42 cmd = 'btrfs filesystem label %s %s' % (dst, label)
43 elif fstype == 'swap':
44 cmd = 'mkswap -L %s %s' % (label, dst)
45 elif fstype == 'squashfs':
46 raise WicError("It's not possible to update a squashfs "
47 "filesystem label '%s'" % (label))
48 else:
49 raise WicError("Cannot update filesystem label: "
50 "Unknown fstype: '%s'" % (fstype))
51
52 exec_cmd(cmd)
53
35 @classmethod 54 @classmethod
36 def do_prepare_partition(cls, part, source_params, cr, cr_workdir, 55 def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
37 oe_builddir, bootimg_dir, kernel_dir, 56 oe_builddir, bootimg_dir, kernel_dir,
@@ -66,4 +85,7 @@ class RawCopyPlugin(SourcePlugin):
66 if filesize > part.size: 85 if filesize > part.size:
67 part.size = filesize 86 part.size = filesize
68 87
88 if part.label:
89 RawCopyPlugin.do_image_label(part.fstype, dst, part.label)
90
69 part.source_file = dst 91 part.source_file = dst