def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir):
"""
Prepare content for an ext2/3/4 rootfs partition.
"""
du_cmd = "sudo du -ks %s" % rootfs_dir
out = exec_cmd(du_cmd)
actual_rootfs_size = int(out.split()[0])
rootfs_size = self.get_rootfs_size(actual_rootfs_size)
with open(rootfs, 'w') as sparse:
os.ftruncate(sparse.fileno(), rootfs_size * 1024)
extra_imagecmd = "-i 8192"
label_str = ""
if self.label:
label_str = "-L %s" % self.label
mkfs_cmd = "sudo mkfs.%s -F %s %s %s -d %s" % \
(self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir)
exec_cmd(mkfs_cmd)
try:
mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs)
exec_cmd(mkfs_cmd)
except WicExecError as e:
if e.returncode != 1:
raise e
评论列表
文章目录