blob: 84fe85d62be97ac859c52dfc4a2e6ba07b8385b8 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# Copyright (c) 2013-2016 Intel Corporation.
5# All rights reserved.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# DESCRIPTION
21# This module provides the OpenEmbedded partition object definitions.
22#
23# AUTHORS
24# Tom Zanussi <tom.zanussi (at] linux.intel.com>
25# Ed Bartosh <ed.bartosh> (at] linux.intel.com>
26
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027import logging
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050028import os
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050029
Brad Bishop6e60e8b2018-02-01 10:27:11 -050030from wic import WicError
Brad Bishopd7bf8c12018-02-25 22:55:05 -050031from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032from wic.pluginbase import PluginMgr
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050033
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034logger = logging.getLogger('wic')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050035
Patrick Williamsc0f7c042017-02-23 20:41:17 -060036class Partition():
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050037
38 def __init__(self, args, lineno):
39 self.args = args
40 self.active = args.active
41 self.align = args.align
42 self.disk = args.disk
Brad Bishop6e60e8b2018-02-01 10:27:11 -050043 self.device = None
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050044 self.extra_space = args.extra_space
Brad Bishop6e60e8b2018-02-01 10:27:11 -050045 self.exclude_path = args.exclude_path
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050046 self.fsopts = args.fsopts
47 self.fstype = args.fstype
48 self.label = args.label
Brad Bishopd7bf8c12018-02-25 22:55:05 -050049 self.mkfs_extraopts = args.mkfs_extraopts
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050050 self.mountpoint = args.mountpoint
51 self.no_table = args.no_table
Brad Bishop6e60e8b2018-02-01 10:27:11 -050052 self.num = None
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050053 self.overhead_factor = args.overhead_factor
Brad Bishopd7bf8c12018-02-25 22:55:05 -050054 self.part_name = args.part_name
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050055 self.part_type = args.part_type
56 self.rootfs_dir = args.rootfs_dir
57 self.size = args.size
Brad Bishop6e60e8b2018-02-01 10:27:11 -050058 self.fixed_size = args.fixed_size
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050059 self.source = args.source
60 self.sourceparams = args.sourceparams
Patrick Williamsc0f7c042017-02-23 20:41:17 -060061 self.system_id = args.system_id
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050062 self.use_uuid = args.use_uuid
63 self.uuid = args.uuid
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050064
65 self.lineno = lineno
66 self.source_file = ""
67 self.sourceparams_dict = {}
68
69 def get_extra_block_count(self, current_blocks):
70 """
71 The --size param is reflected in self.size (in kB), and we already
72 have current_blocks (1k) blocks, calculate and return the
73 number of (1k) blocks we need to add to get to --size, 0 if
74 we're already there or beyond.
75 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076 logger.debug("Requested partition size for %s: %d",
77 self.mountpoint, self.size)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050078
79 if not self.size:
80 return 0
81
82 requested_blocks = self.size
83
Brad Bishop6e60e8b2018-02-01 10:27:11 -050084 logger.debug("Requested blocks %d, current_blocks %d",
85 requested_blocks, current_blocks)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050086
87 if requested_blocks > current_blocks:
88 return requested_blocks - current_blocks
89 else:
90 return 0
91
Brad Bishop6e60e8b2018-02-01 10:27:11 -050092 def get_rootfs_size(self, actual_rootfs_size=0):
93 """
94 Calculate the required size of rootfs taking into consideration
95 --size/--fixed-size flags as well as overhead and extra space, as
96 specified in kickstart file. Raises an error if the
97 `actual_rootfs_size` is larger than fixed-size rootfs.
98
99 """
100 if self.fixed_size:
101 rootfs_size = self.fixed_size
102 if actual_rootfs_size > rootfs_size:
103 raise WicError("Actual rootfs size (%d kB) is larger than "
104 "allowed size %d kB" %
105 (actual_rootfs_size, rootfs_size))
106 else:
107 extra_blocks = self.get_extra_block_count(actual_rootfs_size)
108 if extra_blocks < self.extra_space:
109 extra_blocks = self.extra_space
110
111 rootfs_size = actual_rootfs_size + extra_blocks
112 rootfs_size *= self.overhead_factor
113
114 logger.debug("Added %d extra blocks to %s to get to %d total blocks",
115 extra_blocks, self.mountpoint, rootfs_size)
116
117 return rootfs_size
118
119 @property
120 def disk_size(self):
121 """
122 Obtain on-disk size of partition taking into consideration
123 --size/--fixed-size options.
124
125 """
126 return self.fixed_size if self.fixed_size else self.size
127
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500128 def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
129 bootimg_dir, kernel_dir, native_sysroot):
130 """
131 Prepare content for individual partitions, depending on
132 partition command parameters.
133 """
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500134 if not self.source:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500135 if not self.size and not self.fixed_size:
136 raise WicError("The %s partition has a size of zero. Please "
137 "specify a non-zero --size/--fixed-size for that "
138 "partition." % self.mountpoint)
139
140 if self.fstype == "swap":
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500141 self.prepare_swap_partition(cr_workdir, oe_builddir,
142 native_sysroot)
143 self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500144 else:
145 if self.fstype == 'squashfs':
146 raise WicError("It's not possible to create empty squashfs "
147 "partition '%s'" % (self.mountpoint))
148
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500149 rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
150 self.lineno, self.fstype)
151 if os.path.isfile(rootfs):
152 os.remove(rootfs)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500153
154 prefix = "ext" if self.fstype.startswith("ext") else self.fstype
155 method = getattr(self, "prepare_empty_partition_" + prefix)
156 method(rootfs, oe_builddir, native_sysroot)
157 self.source_file = rootfs
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500158 return
159
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500160 plugins = PluginMgr.get_plugins('source')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500161
162 if self.source not in plugins:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500163 raise WicError("The '%s' --source specified for %s doesn't exist.\n\t"
164 "See 'wic list source-plugins' for a list of available"
165 " --sources.\n\tSee 'wic help source-plugins' for "
166 "details on adding a new source plugin." %
167 (self.source, self.mountpoint))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500168
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500169 srcparams_dict = {}
170 if self.sourceparams:
171 # Split sourceparams string of the form key1=val1[,key2=val2,...]
172 # into a dict. Also accepts valueless keys i.e. without =
173 splitted = self.sourceparams.split(',')
174 srcparams_dict = dict(par.split('=') for par in splitted if par)
175
176 plugin = PluginMgr.get_plugins('source')[self.source]
177 plugin.do_configure_partition(self, srcparams_dict, creator,
178 cr_workdir, oe_builddir, bootimg_dir,
179 kernel_dir, native_sysroot)
180 plugin.do_stage_partition(self, srcparams_dict, creator,
181 cr_workdir, oe_builddir, bootimg_dir,
182 kernel_dir, native_sysroot)
183 plugin.do_prepare_partition(self, srcparams_dict, creator,
184 cr_workdir, oe_builddir, bootimg_dir,
185 kernel_dir, rootfs_dir, native_sysroot)
186
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500187 # further processing required Partition.size to be an integer, make
188 # sure that it is one
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500189 if not isinstance(self.size, int):
190 raise WicError("Partition %s internal size is not an integer. "
191 "This a bug in source plugin %s and needs to be fixed." %
192 (self.mountpoint, self.source))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500193
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500194 if self.fixed_size and self.size > self.fixed_size:
195 raise WicError("File system image of partition %s is "
196 "larger (%d kB) than its allowed size %d kB" %
197 (self.mountpoint, self.size, self.fixed_size))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500198
199 def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir,
200 native_sysroot):
201 """
202 Prepare content for a rootfs partition i.e. create a partition
203 and fill it from a /rootfs dir.
204
205 Currently handles ext2/3/4, btrfs and vfat.
206 """
207 p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
208 p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR",
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500209 "%s/../pseudo" % get_bitbake_var("IMAGE_ROOTFS"))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500210 p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir)
211 p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1")
212 pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix
213 pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir
214 pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd
215 pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500216 pseudo += "%s " % get_bitbake_var("FAKEROOTCMD")
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500217
218 rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label,
219 self.lineno, self.fstype)
220 if os.path.isfile(rootfs):
221 os.remove(rootfs)
222
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500223 # Get rootfs size from bitbake variable if it's not set in .ks file
224 if not self.size:
225 # Bitbake variable ROOTFS_SIZE is calculated in
226 # Image._get_rootfs_size method from meta/lib/oe/image.py
227 # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT,
228 # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE
229 rsize_bb = get_bitbake_var('ROOTFS_SIZE')
230 if rsize_bb:
231 logger.warning('overhead-factor was specified, but size was not,'
232 ' so bitbake variables will be used for the size.'
233 ' In this case both IMAGE_OVERHEAD_FACTOR and '
234 '--overhead-factor will be applied')
235 self.size = int(round(float(rsize_bb)))
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500236
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500237 prefix = "ext" if self.fstype.startswith("ext") else self.fstype
238 method = getattr(self, "prepare_rootfs_" + prefix)
239 method(rootfs, oe_builddir, rootfs_dir, native_sysroot, pseudo)
240 self.source_file = rootfs
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500241
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500242 # get the rootfs size in the right units for kickstart (kB)
243 du_cmd = "du -Lbks %s" % rootfs
244 out = exec_cmd(du_cmd)
245 self.size = int(out.split()[0])
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500246
247 def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir,
248 native_sysroot, pseudo):
249 """
250 Prepare content for an ext2/3/4 rootfs partition.
251 """
252 du_cmd = "du -ks %s" % rootfs_dir
253 out = exec_cmd(du_cmd)
254 actual_rootfs_size = int(out.split()[0])
255
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500256 rootfs_size = self.get_rootfs_size(actual_rootfs_size)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500257
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500258 with open(rootfs, 'w') as sparse:
259 os.ftruncate(sparse.fileno(), rootfs_size * 1024)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500260
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500261 extraopts = self.mkfs_extraopts or "-F -i 8192"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500262
263 label_str = ""
264 if self.label:
265 label_str = "-L %s" % self.label
266
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500267 mkfs_cmd = "mkfs.%s %s %s %s -d %s" % \
268 (self.fstype, extraopts, rootfs, label_str, rootfs_dir)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500269 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
270
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500271 mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs)
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500272 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
273
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500274 def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir,
275 native_sysroot, pseudo):
276 """
277 Prepare content for a btrfs rootfs partition.
278
279 Currently handles ext2/3/4 and btrfs.
280 """
281 du_cmd = "du -ks %s" % rootfs_dir
282 out = exec_cmd(du_cmd)
283 actual_rootfs_size = int(out.split()[0])
284
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500285 rootfs_size = self.get_rootfs_size(actual_rootfs_size)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500286
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500287 with open(rootfs, 'w') as sparse:
288 os.ftruncate(sparse.fileno(), rootfs_size * 1024)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500289
290 label_str = ""
291 if self.label:
292 label_str = "-L %s" % self.label
293
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500294 mkfs_cmd = "mkfs.%s -b %d -r %s %s %s %s" % \
295 (self.fstype, rootfs_size * 1024, rootfs_dir, label_str,
296 self.mkfs_extraopts, rootfs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500297 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
298
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500299 def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir,
300 native_sysroot, pseudo):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500301 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500302 Prepare content for a msdos/vfat rootfs partition.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500303 """
304 du_cmd = "du -bks %s" % rootfs_dir
305 out = exec_cmd(du_cmd)
306 blocks = int(out.split()[0])
307
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500308 rootfs_size = self.get_rootfs_size(blocks)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500309
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500310 label_str = "-n boot"
311 if self.label:
312 label_str = "-n %s" % self.label
313
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500314 size_str = ""
315 if self.fstype == 'msdos':
316 size_str = "-F 16" # FAT 16
317
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500318 extraopts = self.mkfs_extraopts or '-S 512'
319
320 dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \
321 (label_str, size_str, extraopts, rootfs, rootfs_size)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500322 exec_native_cmd(dosfs_cmd, native_sysroot)
323
324 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
325 exec_native_cmd(mcopy_cmd, native_sysroot)
326
327 chmod_cmd = "chmod 644 %s" % rootfs
328 exec_cmd(chmod_cmd)
329
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500330 prepare_rootfs_vfat = prepare_rootfs_msdos
331
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500332 def prepare_rootfs_squashfs(self, rootfs, oe_builddir, rootfs_dir,
333 native_sysroot, pseudo):
334 """
335 Prepare content for a squashfs rootfs partition.
336 """
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500337 extraopts = self.mkfs_extraopts or '-noappend'
338 squashfs_cmd = "mksquashfs %s %s %s" % \
339 (rootfs_dir, rootfs, extraopts)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500340 exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
341
342 def prepare_empty_partition_ext(self, rootfs, oe_builddir,
343 native_sysroot):
344 """
345 Prepare an empty ext2/3/4 partition.
346 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500347 size = self.disk_size
348 with open(rootfs, 'w') as sparse:
349 os.ftruncate(sparse.fileno(), size * 1024)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500350
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500351 extraopts = self.mkfs_extraopts or "-i 8192"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500352
353 label_str = ""
354 if self.label:
355 label_str = "-L %s" % self.label
356
357 mkfs_cmd = "mkfs.%s -F %s %s %s" % \
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500358 (self.fstype, extraopts, label_str, rootfs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500359 exec_native_cmd(mkfs_cmd, native_sysroot)
360
361 def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
362 native_sysroot):
363 """
364 Prepare an empty btrfs partition.
365 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500366 size = self.disk_size
367 with open(rootfs, 'w') as sparse:
368 os.ftruncate(sparse.fileno(), size * 1024)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500369
370 label_str = ""
371 if self.label:
372 label_str = "-L %s" % self.label
373
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500374 mkfs_cmd = "mkfs.%s -b %d %s %s %s" % \
375 (self.fstype, self.size * 1024, label_str,
376 self.mkfs_extraopts, rootfs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500377 exec_native_cmd(mkfs_cmd, native_sysroot)
378
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500379 def prepare_empty_partition_msdos(self, rootfs, oe_builddir,
380 native_sysroot):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500381 """
382 Prepare an empty vfat partition.
383 """
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500384 blocks = self.disk_size
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500385
386 label_str = "-n boot"
387 if self.label:
388 label_str = "-n %s" % self.label
389
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500390 size_str = ""
391 if self.fstype == 'msdos':
392 size_str = "-F 16" # FAT 16
393
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500394 extraopts = self.mkfs_extraopts or '-S 512'
395
396 dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \
397 (label_str, extraopts, size_str, rootfs, blocks)
398
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500399 exec_native_cmd(dosfs_cmd, native_sysroot)
400
401 chmod_cmd = "chmod 644 %s" % rootfs
402 exec_cmd(chmod_cmd)
403
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500404 prepare_empty_partition_vfat = prepare_empty_partition_msdos
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500405
406 def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot):
407 """
408 Prepare a swap partition.
409 """
410 path = "%s/fs.%s" % (cr_workdir, self.fstype)
411
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500412 with open(path, 'w') as sparse:
413 os.ftruncate(sparse.fileno(), self.size * 1024)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500414
415 import uuid
416 label_str = ""
417 if self.label:
418 label_str = "-L %s" % self.label
419 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path)
420 exec_native_cmd(mkswap_cmd, native_sysroot)